From d1bcf1180a07c2168ea4f7b14d869e2986e01e2f Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Wed, 23 Oct 2013 19:11:32 +0000 Subject: [PATCH] Check if WARN_UNUSED_RESULT and COMPILE_ASSERT are defined. Works around a multiple definition error from webrtc and libjingle. Corresponds to the libjingle change here: https://critique.corp.google.com/#review/55489575-p10 TESTED=trybots R=wu@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2809004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5025 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/system_wrappers/interface/compile_assert.h | 5 ++++- webrtc/typedefs.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/webrtc/system_wrappers/interface/compile_assert.h b/webrtc/system_wrappers/interface/compile_assert.h index 0c8776d21d..cdeaa5676b 100644 --- a/webrtc/system_wrappers/interface/compile_assert.h +++ b/webrtc/system_wrappers/interface/compile_assert.h @@ -28,13 +28,16 @@ // the expression is false, most compilers will issue a warning/error // containing the name of the variable. +// TODO(ajm): Hack to avoid multiple definitions until the base/ of webrtc and +// libjingle are merged. +#if !defined(COMPILE_ASSERT) template struct CompileAssert { }; -#undef COMPILE_ASSERT #define COMPILE_ASSERT(expr, msg) \ typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] +#endif // COMPILE_ASSERT // Implementation details of COMPILE_ASSERT: // diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h index dc206f2985..35ccde488d 100644 --- a/webrtc/typedefs.h +++ b/webrtc/typedefs.h @@ -95,10 +95,14 @@ typedef unsigned __int64 uint64_t; // Annotate a function indicating the caller must examine the return value. // Use like: // int foo() WARN_UNUSED_RESULT; +// TODO(ajm): Hack to avoid multiple definitions until the base/ of webrtc and +// libjingle are merged. +#if !defined(WARN_UNUSED_RESULT) #if defined(__GNUC__) #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #else #define WARN_UNUSED_RESULT #endif +#endif // WARN_UNUSED_RESULT #endif // WEBRTC_TYPEDEFS_H_