diff --git a/webrtc/base/compile_assert.h b/webrtc/base/compile_assert.h index 6d4249c8fb..ad9e179d65 100644 --- a/webrtc/base/compile_assert.h +++ b/webrtc/base/compile_assert.h @@ -11,6 +11,7 @@ // COMPILE_ASSERT macro, borrowed from google3/base/macros.h. #ifndef WEBRTC_BASE_COMPILE_ASSERT_H_ #define WEBRTC_BASE_COMPILE_ASSERT_H_ +#include "webrtc/typedefs.h" // The COMPILE_ASSERT macro can be used to verify that a compile time // expression is true. For example, you could use it to verify the @@ -35,7 +36,7 @@ struct CompileAssert { }; #define COMPILE_ASSERT(expr, msg) \ - typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] // NOLINT + typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ATTRIBUTE_UNUSED #endif // COMPILE_ASSERT // Implementation details of COMPILE_ASSERT: diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c index 50457d9bee..2f0434bbcc 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.c +++ b/webrtc/modules/audio_processing/aec/aec_core.c @@ -1356,7 +1356,7 @@ static void ReopenWav(rtc_WavWriter** wav_file, int seq1, int seq2, int sample_rate) { - int written UNUSED; + int written ATTRIBUTE_UNUSED; char filename[64]; if (*wav_file) { if (rtc_WavSampleRate(*wav_file) == sample_rate) diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h index 871f04ecdc..669451626b 100644 --- a/webrtc/typedefs.h +++ b/webrtc/typedefs.h @@ -110,13 +110,13 @@ typedef unsigned __int64 uint64_t; #endif // WARN_UNUSED_RESULT // Put after a variable that might not be used, to prevent compiler warnings: -// int result UNUSED = DoSomething(); +// int result ATTRIBUTE_UNUSED = DoSomething(); // assert(result == 17); -#ifndef UNUSED -#ifdef __GNUC__ -#define UNUSED __attribute__((unused)) +#ifndef ATTRIBUTE_UNUSED +#if defined(__GNUC__) || defined(__clang__) +#define ATTRIBUTE_UNUSED __attribute__((unused)) #else -#define UNUSED +#define ATTRIBUTE_UNUSED #endif #endif