Move PRETTY_FUNCTION macros to base/compiler_specific.h
This will help https://crrev.com/c/1340317.
[email protected]
Bug: 906125, 907410
Change-Id: Id6d666a0e8dc18d8646a81dd16fadec16fe44abe
Reviewed-on: https://chromium-review.googlesource.com/c/1344105
Commit-Queue: Alex Clarke <[email protected]>
Reviewed-by: Alex Clarke <[email protected]>
Reviewed-by: Sami Kyöstilä <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Cr-Commit-Position: refs/heads/master@{#610027}
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 924d1e4f..0d6bccc8 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -217,4 +217,13 @@
#define FALLTHROUGH
#endif
+#if defined(COMPILER_GCC)
+#define PRETTY_FUNCTION __PRETTY_FUNCTION__
+#elif defined(COMPILER_MSVC)
+#define PRETTY_FUNCTION __FUNCSIG__
+#else
+// See https://en.cppreference.com/w/c/language/function_definition#func
+#define PRETTY_FUNCTION __func__
+#endif
+
#endif // BASE_COMPILER_SPECIFIC_H_
diff --git a/third_party/blink/renderer/platform/geometry/layout_unit.h b/third_party/blink/renderer/platform/geometry/layout_unit.h
index 3cc81b3..834b3b1 100644
--- a/third_party/blink/renderer/platform/geometry/layout_unit.h
+++ b/third_party/blink/renderer/platform/geometry/layout_unit.h
@@ -33,6 +33,7 @@
#include <iosfwd>
#include <limits>
+#include "base/compiler_specific.h"
#include "base/numerics/safe_conversions.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
@@ -45,7 +46,7 @@
#if DCHECK_IS_ON()
#define REPORT_OVERFLOW(doesOverflow) \
DLOG_IF(ERROR, !(doesOverflow)) << "LayoutUnit overflow !(" << #doesOverflow \
- << ") in " << WTF_PRETTY_FUNCTION
+ << ") in " << PRETTY_FUNCTION
#else
#define REPORT_OVERFLOW(doesOverflow) ((void)0)
#endif
diff --git a/third_party/blink/renderer/platform/wtf/compiler.h b/third_party/blink/renderer/platform/wtf/compiler.h
index 40f79d4..56843da 100644
--- a/third_party/blink/renderer/platform/wtf/compiler.h
+++ b/third_party/blink/renderer/platform/wtf/compiler.h
@@ -41,16 +41,6 @@
#endif
#endif
-/* WTF_PRETTY_FUNCTION */
-
-#if defined(COMPILER_GCC)
-#define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__
-#elif defined(COMPILER_MSVC)
-#define WTF_PRETTY_FUNCTION __FUNCSIG__
-#else
-#define WTF_PRETTY_FUNCTION __func__
-#endif
-
/* NO_SANITIZE_UNRELATED_CAST - Disable runtime checks related to casts between
* unrelated objects (-fsanitize=cfi-unrelated-cast or -fsanitize=vptr). */
diff --git a/third_party/blink/renderer/platform/wtf/type_traits.h b/third_party/blink/renderer/platform/wtf/type_traits.h
index f8003ca..dac7ee25 100644
--- a/third_party/blink/renderer/platform/wtf/type_traits.h
+++ b/third_party/blink/renderer/platform/wtf/type_traits.h
@@ -25,6 +25,7 @@
#include <cstddef>
#include <type_traits>
#include <utility>
+#include "base/compiler_specific.h"
#include "base/template_util.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/platform/wtf/compiler.h"
@@ -34,7 +35,7 @@
// Returns a string that contains the type name of |T| as a substring.
template <typename T>
inline const char* GetStringWithTypeName() {
- return WTF_PRETTY_FUNCTION;
+ return PRETTY_FUNCTION;
}
template <typename T>
diff --git a/tools/ipc_fuzzer/fuzzer/fuzzer.cc b/tools/ipc_fuzzer/fuzzer/fuzzer.cc
index af3ba548..f7ff720 100644
--- a/tools/ipc_fuzzer/fuzzer/fuzzer.cc
+++ b/tools/ipc_fuzzer/fuzzer/fuzzer.cc
@@ -9,6 +9,7 @@
#include <utility>
#include <vector>
+#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/shared_memory_handle.h"
@@ -33,14 +34,6 @@
#include "tools/ipc_fuzzer/message_lib/all_messages.h"
#include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h"
-#if defined(COMPILER_GCC)
-#define PRETTY_FUNCTION __PRETTY_FUNCTION__
-#elif defined(COMPILER_MSVC)
-#define PRETTY_FUNCTION __FUNCSIG__
-#else
-#define PRETTY_FUNCTION __FUNCTION__
-#endif
-
namespace IPC {
class Message;
} // namespace IPC