Bug 1277448 patch 1 - Move __func__ polyfill for older MSVC versions from xpcom/base/Logging.h to mfbt/Assertions.h r?Waldo
Note that xpcom/base/Logging.h currently includes mfbt/Assertions.h (as
mozilla/Assertions.h).
MozReview-Commit-ID: IQYssp747R3
--- a/mfbt/Assertions.h
+++ b/mfbt/Assertions.h
@@ -16,16 +16,27 @@
#include "mozilla/Attributes.h"
#include "mozilla/Compiler.h"
#include "mozilla/Likely.h"
#include "mozilla/MacroArgs.h"
#ifdef MOZ_DUMP_ASSERTION_STACK
#include "nsTraceRefcnt.h"
#endif
+/*
+ * __func__ was standardized in C++11 and is supported by clang, gcc, and MSVC
+ * 2015. Here we polyfill __func__ for earlier versions of MSVC.
+ * http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
+ */
+#ifdef _MSC_VER
+# if _MSC_VER < 1900
+# define __func__ __FUNCTION__
+# endif
+#endif
+
#if defined(MOZ_CRASHREPORTER) && defined(MOZILLA_INTERNAL_API) && \
!defined(MOZILLA_EXTERNAL_LINKAGE) && defined(__cplusplus)
namespace CrashReporter {
// This declaration is present here as well as in nsExceptionHandler.h
// nsExceptionHandler.h is not directly included in this file as it includes
// windows.h, which can cause problems when it is imported into some files due
// to the number of macros defined.
// XXX If you change this definition - also change the definition in
--- a/xpcom/base/Logging.h
+++ b/xpcom/base/Logging.h
@@ -220,24 +220,13 @@ void log_print(const LogModule* aModule,
if (MOZ_LOG_TEST(_module,_level)) { \
mozilla::detail::log_print(_module, _level, MOZ_LOG_EXPAND_ARGS _args); \
} \
PR_END_MACRO
#undef PR_LOG
#undef PR_LOG_TEST
-/*
- * __func__ was standardized in C++11 and is supported by clang, gcc, and MSVC
- * 2015. Here we polyfill __func__ for earlier versions of MSVC.
- * http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
- */
-#ifdef _MSC_VER
-# if _MSC_VER < 1900
-# define __func__ __FUNCTION__
-# endif
-#endif
-
// This #define is a Logging.h-only knob! Don't encourage people to get fancy
// with their log definitions by exporting it outside of Logging.h.
#undef MOZ_LOGGING_ENABLED
#endif // mozilla_logging_h