Chromium Code Reviews| Index: base/compiler_specific.h |
| diff --git a/base/compiler_specific.h b/base/compiler_specific.h |
| index ba57cc38cdc2ef87dfe0697f25a950bcbec4dc0e..6210d1ace59ab6767e6f0fd1295955890f0feef5 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 |
|
Nico
2014/10/25 22:56:08
How is this different from ignore_result()?
Why n
Peter Kasting
2014/10/27 17:58:44
It doesn't implicitly take the address of |x| or i
|
| + |
| +// 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. |