Chromium Code Reviews| Index: base/compiler_specific.h |
| diff --git a/base/compiler_specific.h b/base/compiler_specific.h |
| index 0f4c058b3be43963d76c23b0b3b8ec89fc8b3767..7e77296b93c0ff4b8866d148b1903d6717ae4f85 100644 |
| --- a/base/compiler_specific.h |
| +++ b/base/compiler_specific.h |
| @@ -78,8 +78,19 @@ |
| // Use like: |
| // int x = ...; |
| // ALLOW_UNUSED_LOCAL(x); |
| +#if defined(__clang_analyzer__) |
| + |
| +// Voidify 'x' on codepath-sensitive static analyzer builds, potentially |
| +// producing side effects. |
| +#define ALLOW_UNUSED_LOCAL(x) (void)x |
| + |
| +#else // !defined(__clang_analyzer__) |
| + |
| +// Voidify 'x' without side effects. |
| #define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0 |
| +#endif // defined(__clang_analyzer__) |
|
Peter Kasting
2017/04/24 21:59:25
Nit: I think this would be easier to read with com
Kevin M
2017/04/24 22:37:39
Yes, that's an improvement. Thanks, done.
|
| + |
| // Annotate a typedef or function indicating it's ok if it's not used. |
| // Use like: |
| // typedef Foo Bar ALLOW_UNUSED_TYPE; |