Bug 185893

Summary: Logging macros are sensitive to pal/Logging.h vs Logging.h include order
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: PlatformAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, don.olmstead, mmaxfield, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Simon Fraser (smfr) 2018-05-22 16:43:08 PDT
Add a #include <pal/Logging.h> to a .cpp file can break the build, because subsequent files in the same UnifiedSources*.cpp may use the LOG macro, and pal/Logging.h and Logging.h #define LOG_CHANNEL_PREFIX to different things.

I don't think pal/Logging.h should define any log channels, nor define LOG_CHANNEL_PREFIX.
Comment 1 Simon Fraser (smfr) 2018-05-22 16:50:42 PDT
Errors look like:

Undefined symbols for architecture x86_64:
  "WebCore::PALLogIndexedDB", referenced from:
      WebCore::injectIDBKeyIntoScriptValue(JSC::ExecState&, WebCore::IDBKeyData const&, JSC::JSValue, WTF::Variant<WTF::String, WTF::Vector<WTF::String, 0ul, WTF::CrashOnOverflow, 16ul> > const&) in UnifiedSource170.o
  "WebCore::PALLogStorageAPI", referenced from:
      WebCore::canInjectIDBKeyIntoScriptValue(JSC::ExecState&, JSC::JSValue const&, WTF::Variant<WTF::String, WTF::Vector<WTF::String, 0ul, WTF::CrashOnOverflow, 16ul> > const&) in UnifiedSource170.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 2 Simon Fraser (smfr) 2018-05-22 17:26:44 PDT
I think we can just gut pal/Logging.h
Comment 3 Don Olmstead 2018-05-23 11:27:41 PDT
Might we want to move commonality up to WTF then specialize based on WebCore/PAL etc?
Comment 4 Simon Fraser (smfr) 2018-05-23 11:44:13 PDT
Yes, we should.
Comment 5 Simon Fraser (smfr) 2018-06-04 17:55:51 PDT
Created attachment 341941 [details]
Patch
Comment 6 WebKit Commit Bot 2018-06-06 11:20:37 PDT
Comment on attachment 341941 [details]
Patch

Clearing flags on attachment: 341941

Committed r232550: <https://trac.webkit.org/changeset/232550>
Comment 7 WebKit Commit Bot 2018-06-06 11:20:38 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2018-06-06 11:21:24 PDT
<rdar://problem/40859215>