From 14abcc73227223def23a3eb06b47285c3a55a5b5 Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Fri, 16 May 2014 16:54:44 +0000 Subject: [PATCH] libvpx's UNUSED macro conflicts with webrtc/base's. Added missing include of assert.h. Globally defined function "Unused" in talk/base and its copy (webrtc/base) is causing a conflict. libvpx macro (UNUSED) can be found here: http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/libvpx/source/libvpx/vpx/vpx_codec.h BUG=N/A R=andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/17489004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6185 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/base/basictypes.h | 20 ---------- webrtc/base/common.h | 37 +++++++++---------- webrtc/base/httpserver.cc | 2 +- webrtc/base/openssladapter.cc | 4 +- webrtc/base/opensslstreamadapter.cc | 4 +- .../audio_device/android/single_rw_fifo.cc | 2 + 6 files changed, 25 insertions(+), 44 deletions(-) diff --git a/webrtc/base/basictypes.h b/webrtc/base/basictypes.h index 8fed1bad9f..8c6909497d 100644 --- a/webrtc/base/basictypes.h +++ b/webrtc/base/basictypes.h @@ -125,26 +125,6 @@ namespace rtc { ((t) - 1)) & ~((t) - 1)))) #define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1))) -// Note: UNUSED is also defined in common.h -#ifndef UNUSED -#define UNUSED(x) Unused(static_cast(&x)) -#define UNUSED2(x, y) Unused(static_cast(&x)); \ - Unused(static_cast(&y)) -#define UNUSED3(x, y, z) Unused(static_cast(&x)); \ - Unused(static_cast(&y)); \ - Unused(static_cast(&z)) -#define UNUSED4(x, y, z, a) Unused(static_cast(&x)); \ - Unused(static_cast(&y)); \ - Unused(static_cast(&z)); \ - Unused(static_cast(&a)) -#define UNUSED5(x, y, z, a, b) Unused(static_cast(&x)); \ - Unused(static_cast(&y)); \ - Unused(static_cast(&z)); \ - Unused(static_cast(&a)); \ - Unused(static_cast(&b)) -inline void Unused(const void*) {} -#endif // UNUSED - // Use these to declare and define a static local variable (static T;) so that // it is leaked so that its destructors are not called at exit. #define LIBJINGLE_DEFINE_STATIC_LOCAL(type, name, arguments) \ diff --git a/webrtc/base/common.h b/webrtc/base/common.h index 51a5d1e2d4..7f4a756391 100644 --- a/webrtc/base/common.h +++ b/webrtc/base/common.h @@ -23,25 +23,24 @@ // General Utilities ////////////////////////////////////////////////////////////////////// -// Note: UNUSED is also defined in basictypes.h -#ifndef UNUSED -#define UNUSED(x) Unused(static_cast(&x)) -#define UNUSED2(x, y) Unused(static_cast(&x)); \ - Unused(static_cast(&y)) -#define UNUSED3(x, y, z) Unused(static_cast(&x)); \ - Unused(static_cast(&y)); \ - Unused(static_cast(&z)) -#define UNUSED4(x, y, z, a) Unused(static_cast(&x)); \ - Unused(static_cast(&y)); \ - Unused(static_cast(&z)); \ - Unused(static_cast(&a)) -#define UNUSED5(x, y, z, a, b) Unused(static_cast(&x)); \ - Unused(static_cast(&y)); \ - Unused(static_cast(&z)); \ - Unused(static_cast(&a)); \ - Unused(static_cast(&b)) -inline void Unused(const void*) {} -#endif // UNUSED +#ifndef RTC_UNUSED +#define RTC_UNUSED(x) RtcUnused(static_cast(&x)) +#define RTC_UNUSED2(x, y) RtcUnused(static_cast(&x)); \ + RtcUnused(static_cast(&y)) +#define RTC_UNUSED3(x, y, z) RtcUnused(static_cast(&x)); \ + RtcUnused(static_cast(&y)); \ + RtcUnused(static_cast(&z)) +#define RTC_UNUSED4(x, y, z, a) RtcUnused(static_cast(&x)); \ + RtcUnused(static_cast(&y)); \ + RtcUnused(static_cast(&z)); \ + RtcUnused(static_cast(&a)) +#define RTC_UNUSED5(x, y, z, a, b) RtcUnused(static_cast(&x)); \ + RtcUnused(static_cast(&y)); \ + RtcUnused(static_cast(&z)); \ + RtcUnused(static_cast(&a)); \ + RtcUnused(static_cast(&b)) +inline void RtcUnused(const void*) {} +#endif // RTC_UNUSED #if !defined(WEBRTC_WIN) diff --git a/webrtc/base/httpserver.cc b/webrtc/base/httpserver.cc index caa58efc2a..0d22584226 100644 --- a/webrtc/base/httpserver.cc +++ b/webrtc/base/httpserver.cc @@ -222,7 +222,7 @@ HttpServer::Connection::onHttpComplete(HttpMode mode, HttpError err) { void HttpServer::Connection::onHttpClosed(HttpError err) { - UNUSED(err); + RTC_UNUSED(err); server_->Remove(connection_id_); } diff --git a/webrtc/base/openssladapter.cc b/webrtc/base/openssladapter.cc index c9f6b1aaa2..3618aadaae 100644 --- a/webrtc/base/openssladapter.cc +++ b/webrtc/base/openssladapter.cc @@ -144,8 +144,8 @@ static int socket_puts(BIO* b, const char* str) { } static long socket_ctrl(BIO* b, int cmd, long num, void* ptr) { - UNUSED(num); - UNUSED(ptr); + RTC_UNUSED(num); + RTC_UNUSED(ptr); switch (cmd) { case BIO_CTRL_RESET: diff --git a/webrtc/base/opensslstreamadapter.cc b/webrtc/base/opensslstreamadapter.cc index 203cc6d6a9..f057b8e50e 100644 --- a/webrtc/base/opensslstreamadapter.cc +++ b/webrtc/base/opensslstreamadapter.cc @@ -144,8 +144,8 @@ static int stream_puts(BIO* b, const char* str) { } static long stream_ctrl(BIO* b, int cmd, long num, void* ptr) { - UNUSED(num); - UNUSED(ptr); + RTC_UNUSED(num); + RTC_UNUSED(ptr); switch (cmd) { case BIO_CTRL_RESET: diff --git a/webrtc/modules/audio_device/android/single_rw_fifo.cc b/webrtc/modules/audio_device/android/single_rw_fifo.cc index d65ab9fbb6..3eb993c04d 100644 --- a/webrtc/modules/audio_device/android/single_rw_fifo.cc +++ b/webrtc/modules/audio_device/android/single_rw_fifo.cc @@ -10,6 +10,8 @@ #include "webrtc/modules/audio_device/android/single_rw_fifo.h" +#include + static int UpdatePos(int pos, int capacity) { return (pos + 1) % capacity; }