commit 7ba0eee6172add6822b6666eef1a99aa6d4f380e
parent e2afb0c982dae5a77f6c7025a626bf57e0b68c3d
Author: Chun-Min Chang <chun.m.chang@gmail.com>
Date: Wed, 10 Dec 2025 18:58:00 +0000
Bug 2005083 - Undefine LOG macros at end of files r=webrtc-reviewers,pehrsons
This patch `#undef` LOG macros that were `#define`d at the beginning of each
file, preventing macro name collisions when defining LOG macros in new files
without requiring an explicit `#undef` first.
Differential Revision: https://phabricator.services.mozilla.com/D275692
Diffstat:
11 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/dom/media/ADTSDemuxer.cpp b/dom/media/ADTSDemuxer.cpp
@@ -597,3 +597,7 @@ bool ADTSDemuxer::ADTSSniffer(const uint8_t* aData, const uint32_t aLength) {
}
} // namespace mozilla
+
+#undef LOG
+#undef ADTSLOG
+#undef ADTSLOGV
diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp
@@ -34,10 +34,6 @@
namespace mozilla {
-#undef LOG
-#undef LOGW
-#undef LOGE
-
LazyLogModule gAudioStreamLog("AudioStream");
// For simple logs
#define LOG(x, ...) \
@@ -768,4 +764,8 @@ void AudioClock::SetPreservesPitch(bool aPreservesPitch) {
bool AudioClock::GetPreservesPitch() const { return mPreservesPitch; }
+#undef LOG
+#undef LOGW
+#undef LOGE
+
} // namespace mozilla
diff --git a/dom/media/CrossGraphPort.cpp b/dom/media/CrossGraphPort.cpp
@@ -12,13 +12,6 @@
namespace mozilla {
-#ifdef LOG
-# undef LOG
-#endif
-#ifdef LOG_TEST
-# undef LOG_TEST
-#endif
-
extern LazyLogModule gMediaTrackGraphLog;
#define LOG(type, msg) MOZ_LOG(gMediaTrackGraphLog, type, msg)
#define LOG_TEST(type) MOZ_LOG_TEST(gMediaTrackGraphLog, type)
@@ -161,3 +154,6 @@ int CrossGraphReceiver::EnqueueAudio(AudioChunk& aChunk) {
}
} // namespace mozilla
+
+#undef LOG
+#undef LOG_TEST
diff --git a/dom/media/MediaStreamTrack.cpp b/dom/media/MediaStreamTrack.cpp
@@ -18,10 +18,6 @@
#include "nsServiceManagerUtils.h"
#include "systemservices/MediaUtils.h"
-#ifdef LOG
-# undef LOG
-#endif
-
static mozilla::LazyLogModule gMediaStreamTrackLog("MediaStreamTrack");
#define LOG(type, msg) MOZ_LOG(gMediaStreamTrackLog, type, msg)
@@ -644,3 +640,5 @@ already_AddRefed<MediaInputPort> MediaStreamTrack::ForwardTrackContentsTo(
}
} // namespace mozilla::dom
+
+#undef LOG
diff --git a/dom/media/MediaTrackGraph.cpp b/dom/media/MediaTrackGraph.cpp
@@ -57,9 +57,6 @@ using AudioDeviceID = CubebUtils::AudioDeviceID;
using IsInShutdown = MediaTrack::IsInShutdown;
LazyLogModule gMediaTrackGraphLog("MediaTrackGraph");
-#ifdef LOG
-# undef LOG
-#endif // LOG
#define LOG(type, msg) MOZ_LOG(gMediaTrackGraphLog, type, msg)
NativeInputTrack* DeviceInputTrackManager::GetNativeInputTrack() {
@@ -4413,3 +4410,5 @@ MediaTrackGraphImpl::AfterProcessNextEvent(nsIThreadInternal*, bool) {
return NS_OK;
}
} // namespace mozilla
+
+#undef LOG
diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp
@@ -16,8 +16,6 @@
#include "mozilla/ipc/PBackgroundChild.h"
#include "nsThreadUtils.h"
-#undef LOG
-#undef LOG_ENABLED
mozilla::LazyLogModule gCamerasChildLog("CamerasChild");
#define LOG(args) MOZ_LOG(gCamerasChildLog, mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(gCamerasChildLog, mozilla::LogLevel::Debug)
@@ -568,3 +566,6 @@ FrameRelay* CamerasChild::Callback(int capture_id) {
}
} // namespace mozilla::camera
+
+#undef LOG
+#undef LOG_ENABLED
diff --git a/dom/media/systemservices/CamerasParent.cpp b/dom/media/systemservices/CamerasParent.cpp
@@ -39,9 +39,6 @@
# define getpid() _getpid()
#endif
-#undef LOG
-#undef LOG_VERBOSE
-#undef LOG_ENABLED
mozilla::LazyLogModule gCamerasParentLog("CamerasParent");
#define LOG(...) \
MOZ_LOG(gCamerasParentLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
@@ -1646,3 +1643,8 @@ already_AddRefed<CamerasParent> CamerasParent::Create() {
} // namespace camera
} // namespace mozilla
+
+#undef LOG
+#undef LOG_FUNCTION
+#undef LOG_VERBOSE
+#undef LOG_ENABLED
diff --git a/dom/media/systemservices/MediaChild.cpp b/dom/media/systemservices/MediaChild.cpp
@@ -12,7 +12,6 @@
#include "mozilla/dom/ContentChild.h"
#include "nsQueryObject.h"
-#undef LOG
mozilla::LazyLogModule gMediaChildLog("MediaChild");
#define LOG(args) MOZ_LOG(gMediaChildLog, mozilla::LogLevel::Debug, args)
@@ -92,3 +91,5 @@ bool DeallocPMediaChild(media::PMediaChild* aActor) {
}
} // namespace mozilla::media
+
+#undef LOG
diff --git a/dom/media/systemservices/MediaParent.cpp b/dom/media/systemservices/MediaParent.cpp
@@ -25,7 +25,6 @@
#include "nsNetUtil.h"
#include "nsThreadUtils.h"
-#undef LOG
mozilla::LazyLogModule gMediaParentLog("MediaParent");
#define LOG(args) MOZ_LOG(gMediaParentLog, mozilla::LogLevel::Debug, args)
@@ -530,5 +529,7 @@ bool DeallocPMediaParent(media::PMediaParent* aActor) {
} // namespace mozilla::media
+#undef LOG
+
// Instantiate templates to satisfy linker
template class mozilla::media::Parent<mozilla::media::NonE10s>;
diff --git a/dom/media/systemservices/VideoEngine.cpp b/dom/media/systemservices/VideoEngine.cpp
@@ -21,8 +21,6 @@ int32_t SetCaptureAndroidVM(JavaVM* javaVM);
namespace mozilla::camera {
-#undef LOG
-#undef LOG_ENABLED
mozilla::LazyLogModule gVideoEngineLog("VideoEngine");
#define LOG(args) MOZ_LOG(gVideoEngineLog, mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(gVideoEngineLog, mozilla::LogLevel::Debug)
@@ -300,4 +298,7 @@ VideoEngine::~VideoEngine() {
MOZ_ASSERT(mIdToCapturerMap.empty());
}
+#undef LOG
+#undef LOG_ENABLED
+
} // namespace mozilla::camera
diff --git a/dom/media/webrtc/MediaTrackConstraints.cpp b/dom/media/webrtc/MediaTrackConstraints.cpp
@@ -601,3 +601,5 @@ Maybe<VideoResizeModeEnum> MediaConstraintsHelper::GetResizeMode(
}
} // namespace mozilla
+
+#undef LOG