Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Unified Diff: webrtc/typedefs.h

Issue 2797983003: Make WARN_UNUSED_RESULT a no-op on gcc (Closed)
Patch Set: RTC_ prefix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/typedefs.h
diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h
index bc48c08290c7653416073ebe36a0d12a99259195..bd0bee75c2a8c13234fb402aa3a99abd0fcf639e 100644
--- a/webrtc/typedefs.h
+++ b/webrtc/typedefs.h
@@ -65,17 +65,18 @@
// 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>.
-// TODO(ajm): Hack to avoid multiple definitions until the base/ of webrtc and
-// libjingle are merged.
-#if !defined(WARN_UNUSED_RESULT)
-#if defined(__GNUC__) || defined(__clang__)
-#define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
+// int foo() RTC_WARN_UNUSED_RESULT;
+// To explicitly ignore a result, cast to void.
+// TODO(kwiberg): Remove when we can use [[nodiscard]] from C++17.
+#if defined(__clang__)
+#define RTC_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
+#elif defined(__GNUC__)
+// gcc has a __warn_unused_result__ attribute, but you can't quiet it by
+// casting to void, so we don't use it.
+#define RTC_WARN_UNUSED_RESULT
#else
-#define WARN_UNUSED_RESULT
+#define RTC_WARN_UNUSED_RESULT
#endif
-#endif // WARN_UNUSED_RESULT
// Put after a variable that might not be used, to prevent compiler warnings:
// int result ATTRIBUTE_UNUSED = DoSomething();
« no previous file with comments | « webrtc/modules/audio_coding/codecs/ilbc/get_cd_vec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698