Bug 1333686 - Part 3: Fix -Wmacro-redefined warnings in ipc/chromium. r?jld draft
authorChris Peterson <cpeterson@mozilla.com>
Mon, 16 Jan 2017 19:14:52 -0800
changeset 466349 1495b56628ae56ad9e87b759278f5f504eae62b9
parent 466093 e846d470828b4fe2dd12c23fb66d851b181ae0ec
child 466350 d10c53ee57dc44a37bcebe03f91ab614b94af681
push id42874
push usercpeterson@mozilla.com
push dateWed, 25 Jan 2017 21:04:50 +0000
reviewersjld
bugs1333686
milestone54.0a1
Bug 1333686 - Part 3: Fix -Wmacro-redefined warnings in ipc/chromium. r?jld The WARN_UNUSED_RESULT macro is defined in multiple Google header files in ipc/chromium and webrtc. Copy the WARN_UNUSED_RESULT definition from the latest security/sandbox/chromium/base/compiler_specific.h to our ipc/chromium code. Also remove the ALLOW_UNUSED macro definition because it is no longer defined in the latest compiler_specific.h and is not used anywhere. Warning: -Wmacro-redefined in ipc/chromium/src/base/compiler_specific.h: 'WARN_UNUSED_RESULT' macro redefined ipc/chromium/src/base/compiler_specific.h:73:9: warning: 'WARN_UNUSED_RESULT' macro redefined [-Wmacro-redefined] #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) media/webrtc/trunk/webrtc/typedefs.h:152:9: note: previous definition is here #define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) MozReview-Commit-ID: EUIlXGKLhDL
ipc/chromium/src/base/compiler_specific.h
--- a/ipc/chromium/src/base/compiler_specific.h
+++ b/ipc/chromium/src/base/compiler_specific.h
@@ -62,18 +62,20 @@
 #define MSVC_PUSH_WARNING_LEVEL(n)
 #define MSVC_POP_WARNING()
 #define MSVC_DISABLE_OPTIMIZE()
 #define MSVC_ENABLE_OPTIMIZE()
 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) code
 
 #endif  // COMPILER_MSVC
 
-
-#if defined(COMPILER_GCC)
-#define ALLOW_UNUSED __attribute__((unused))
+// Annotate a function indicating the caller must examine the return value.
+// Use like:
+//   int foo() WARN_UNUSED_RESULT;
+// To explicitly ignore a result, see |ignore_result()| in base/macros.h.
+#undef WARN_UNUSED_RESULT
+#if defined(COMPILER_GCC) || defined(__clang__)
 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-#else  // Not GCC
-#define ALLOW_UNUSED
+#else
 #define WARN_UNUSED_RESULT
 #endif
 
 #endif  // BASE_COMPILER_SPECIFIC_H_