From ded85f14efa0f4898178b7503fd643a9db40e4d0 Mon Sep 17 00:00:00 2001 From: "tommi@webrtc.org" Date: Mon, 14 Nov 2011 09:39:31 +0000 Subject: [PATCH] Enable WEBRTC_NO_TRACE for Chromium builds. I'm also fixing WEBRTC_TRACE so that it won't break the build but on Linux I had to do something non traditional as is explained in the comments. Review URL: http://webrtc-codereview.appspot.com/269012 git-svn-id: http://webrtc.googlecode.com/svn/trunk@939 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/build/common.gypi | 8 ++++++++ src/system_wrappers/interface/trace.h | 22 +++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/build/common.gypi b/src/build/common.gypi index 0484d74dfb..1af2e0481a 100644 --- a/src/build/common.gypi +++ b/src/build/common.gypi @@ -95,6 +95,14 @@ '..','../..', # common_types.h, typedefs.h ], 'conditions': [ + ['build_with_chromium==1', { + 'defines': [ + # This turns off tracing in webrtc to reduce the noise from + # the Chrome memory bots. Down the line we will enable WebRTC + # tracing for Chromium and remove this. + 'WEBRTC_NO_TRACE', + ], + }], ['OS=="linux"', { 'defines': [ 'WEBRTC_TARGET_PC', diff --git a/src/system_wrappers/interface/trace.h b/src/system_wrappers/interface/trace.h index 0f7df4d46e..3addfcf4da 100644 --- a/src/system_wrappers/interface/trace.h +++ b/src/system_wrappers/interface/trace.h @@ -19,12 +19,24 @@ #include "typedefs.h" #ifdef WEBRTC_NO_TRACE - #define WEBRTC_TRACE +#ifdef WIN32 + // Use __noop to avoid the C4353 compiler warning on Windows. + #define WEBRTC_TRACE __noop() #else - // Ideally we would use __VA_ARGS__ but it's not supported by all compilers - // such as VS2003 (it's supported in VS2005). TODO (hellner) why - // would this be better than current implementation (not convinced)? - #define WEBRTC_TRACE Trace::Add + // This is a workaround. Ideally we should be able to do + // something like: + // #define WEBRTC_TRACE(...) ((void)0) + // However, we have code that creates variables with the only + // intent of tracing out their value. So, if we take the above + // approach, then we'll get a compiler error about unused variables. :( + inline void WebRtcNoTrace(...) {} + #define WEBRTC_TRACE WebRtcNoTrace +#endif +#else + // Ideally we would use _VA_ARGS_ but it's not supported by all compilers + // such as VS2003 (it's supported in VS2005). TODO (hellner) why + // would this be better than current implementation (not convinced)? + #define WEBRTC_TRACE Trace::Add #endif namespace webrtc {