nsOfflineCacheUpdateService.cpp and OfflineCacheUpdateChild.cpp: warning: "LOG" redefined

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
9 years ago
7 years ago

People

(Reporter: dholbert, Unassigned)

Tracking

(Blocks 1 bug)

Trunk
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [build_warning], )

Filing bug on build warnings of the form [warning: "LOG" redefined], which mozilla-central currently hits 3 times in uriloader/prefetch, and which results in 30 lines of warning spam, below: 
> /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/nsOfflineCacheUpdateService.cpp:100:1: warning: "LOG" redefined
> In file included from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/string_util_posix.h:13,
>                  from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/string_util.h:105,
>                  from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/chrome/common/ipc_message_utils.h:13,
>                  from ../../dist/include/IPC/IPCMessageUtils.h:42,
>                  from ../../ipc/ipdl/_ipdlheaders/mozilla/docshell/POfflineCacheUpdate.h:13,
>                  from ../../ipc/ipdl/_ipdlheaders/mozilla/docshell/POfflineCacheUpdateChild.h:9,
>                  from /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/OfflineCacheUpdateChild.h:42,
>                  from /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/nsOfflineCacheUpdateService.cpp:40:
> /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/logging.h:92:1: warning: this is the location of the previous definition
--
> /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/OfflineCacheUpdateParent.cpp:57:1: warning: "LOG" redefined
> In file included from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/string_util_posix.h:13,
>                  from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/string_util.h:105,
>                  from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/chrome/common/ipc_message_utils.h:13,
>                  from ../../dist/include/IPC/IPCMessageUtils.h:42,
>                  from ../../ipc/ipdl/_ipdlheaders/mozilla/docshell/POfflineCacheUpdate.h:13,
>                  from ../../ipc/ipdl/_ipdlheaders/mozilla/docshell/POfflineCacheUpdateParent.h:9,
>                  from /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/OfflineCacheUpdateParent.h:42,
>                  from /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/OfflineCacheUpdateParent.cpp:39:
> /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/logging.h:92:1: warning: this is the location of the previous definition
--
> /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/OfflineCacheUpdateChild.cpp:79:1: warning: "LOG" redefined
> In file included from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/string_util_posix.h:13,
>                  from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/string_util.h:105,
>                  from /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/chrome/common/ipc_message_utils.h:13,
>                  from ../../dist/include/IPC/IPCMessageUtils.h:42,
>                  from ../../ipc/ipdl/_ipdlheaders/mozilla/docshell/POfflineCacheUpdate.h:13,
>                  from ../../ipc/ipdl/_ipdlheaders/mozilla/docshell/POfflineCacheUpdateChild.h:9,
>                  from /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/OfflineCacheUpdateChild.h:42,
>                  from /builds/slave/cen-lnx64-dbg/build/uriloader/prefetch/OfflineCacheUpdateChild.cpp:39:
> /builds/slave/cen-lnx64-dbg/build/ipc/chromium/src/base/logging.h:92:1: warning: this is the location of the previous definition
This is from e.g.
> 79 #define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args)
...in OfflineCacheUpdateChild.cpp clashing with...
> 92 #define LOG(info) mozilla::LogWrapper(mozilla::LOG_ ## info, __FILE__, __LINE__)
...in logging.h

Presumably we either want to either add an "#undef LOG" line in these .cpp files, or else we want to apply something like s/LOG/MY_LOG/ across them.
Jason, remind me, is there some quick trick we've been using to get around these in the past?
Looks like bug 576563 comment 2 has a suggestion (pointing to bug 545995), though I haven't read through bug 545995 in detail.
Summary: nsOfflineCacheUpdateService.cpp:100:1: warning: "LOG" redefined → nsOfflineCacheUpdateService.cpp and OfflineCacheUpdateChild.cpp: warning: "LOG" redefined
Yes, bug 545995 shows how we worked around this in nsHttp.h, but you may be able to just s/LOG/something_else/ if that works for ya.
This was fixed in https://hg.mozilla.org/mozilla-central/rev/97e4d66bc5fc
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.