Annotate COMPILE_ASSERT with __attribute__((unused)).
Also renames UNUSED -> ATTRIBUTE_UNUSED to be able to use this when building peerconnection_jni.cc which apparently has this defined to something else. R=kjellander@webrtc.org TBR=mflodman@webrtc.org BUG=4018 Review URL: https://webrtc-codereview.appspot.com/28039005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7711 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
// COMPILE_ASSERT macro, borrowed from google3/base/macros.h.
|
// COMPILE_ASSERT macro, borrowed from google3/base/macros.h.
|
||||||
#ifndef WEBRTC_BASE_COMPILE_ASSERT_H_
|
#ifndef WEBRTC_BASE_COMPILE_ASSERT_H_
|
||||||
#define 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
|
// 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
|
// expression is true. For example, you could use it to verify the
|
||||||
@@ -35,7 +36,7 @@ struct CompileAssert {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define COMPILE_ASSERT(expr, msg) \
|
#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
|
#endif // COMPILE_ASSERT
|
||||||
|
|
||||||
// Implementation details of COMPILE_ASSERT:
|
// Implementation details of COMPILE_ASSERT:
|
||||||
|
|||||||
@@ -1356,7 +1356,7 @@ static void ReopenWav(rtc_WavWriter** wav_file,
|
|||||||
int seq1,
|
int seq1,
|
||||||
int seq2,
|
int seq2,
|
||||||
int sample_rate) {
|
int sample_rate) {
|
||||||
int written UNUSED;
|
int written ATTRIBUTE_UNUSED;
|
||||||
char filename[64];
|
char filename[64];
|
||||||
if (*wav_file) {
|
if (*wav_file) {
|
||||||
if (rtc_WavSampleRate(*wav_file) == sample_rate)
|
if (rtc_WavSampleRate(*wav_file) == sample_rate)
|
||||||
|
|||||||
@@ -110,13 +110,13 @@ typedef unsigned __int64 uint64_t;
|
|||||||
#endif // WARN_UNUSED_RESULT
|
#endif // WARN_UNUSED_RESULT
|
||||||
|
|
||||||
// Put after a variable that might not be used, to prevent compiler warnings:
|
// 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);
|
// assert(result == 17);
|
||||||
#ifndef UNUSED
|
#ifndef ATTRIBUTE_UNUSED
|
||||||
#ifdef __GNUC__
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
#define UNUSED __attribute__((unused))
|
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||||
#else
|
#else
|
||||||
#define UNUSED
|
#define ATTRIBUTE_UNUSED
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user