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

Unified Diff: base/compiler_specific.h

Issue 650393002: Modify ALLOW_UNUSED to allow enabling unused local warnings on MSVC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extraneous use Created 6 years, 2 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 | « no previous file | base/logging_unittest.cc » ('j') | base/logging_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/compiler_specific.h
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index a93d350aae0999964bf29c30b58469a728aa2ac9..b5a9e1f57808ff67a39f8361199fe9136e7d8587 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -94,11 +94,17 @@
// (Typically used to silence a compiler warning when the assignment
// is important for some other reason.)
// Use like:
-// int x ALLOW_UNUSED = ...;
+// int x = ...;
+// ALLOW_UNUSED_LOCAL(x);
+#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
+
+// Annotate a typedef or function indicating it's ok if it's not used.
+// Use like:
+// typedef Foo Bar ALLOW_UNUSED_TYPE;
#if defined(COMPILER_GCC)
-#define ALLOW_UNUSED __attribute__((unused))
+#define ALLOW_UNUSED_TYPE __attribute__((unused))
#else
-#define ALLOW_UNUSED
+#define ALLOW_UNUSED_TYPE
#endif
// Annotate a function indicating it should not be inlined.
« no previous file with comments | « no previous file | base/logging_unittest.cc » ('j') | base/logging_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698