Bug 193750

Summary: check-webkit-style should warn when using soft-linking macros in a header
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Tools / TestsAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ap, commit-queue, darin, ddkilzer, ews-watchlist, glenn, lforschler, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=193815
https://bugs.webkit.org/show_bug.cgi?id=193866
https://bugs.webkit.org/show_bug.cgi?id=193868
https://bugs.webkit.org/show_bug.cgi?id=193884
Attachments:
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2019-01-23 16:56:17 PST
check-webkit-style should warn when using soft-linking macros in a header.

Using the soft-linking macros in a header will lead to code being compiled in every translation unit (source file) that the header is included in, which is usually not what the author intends, and leads to duplicate code.

Example output on pre-existing files:

$ ./Tools/Scripts/check-webkit-style -f '-,+softlink/header' Source/WebCore/PAL
ERROR: Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h:65:  Never soft-link frameworks in headers since this results in duplicate code in each source file where it is included.  [softlink/header] [5]
ERROR: Source/WebCore/PAL/pal/spi/mac/DataDetectorsSPI.h:109:  Never soft-link frameworks in headers since this results in duplicate code in each source file where it is included.  [softlink/header] [5]
ERROR: Source/WebCore/PAL/pal/spi/mac/DataDetectorsSPI.h:110:  Never soft-link frameworks in headers since this results in duplicate code in each source file where it is included.  [softlink/header] [5]
ERROR: Source/WebCore/PAL/pal/spi/mac/TUCallSPI.h:38:  Never soft-link frameworks in headers since this results in duplicate code in each source file where it is included.  [softlink/header] [5]
ERROR: Source/WebCore/PAL/pal/spi/mac/LookupSPI.h:33:  Never soft-link frameworks in headers since this results in duplicate code in each source file where it is included.  [softlink/header] [5]
ERROR: Source/WebCore/PAL/pal/spi/cocoa/NSAttributedStringSPI.h:34:  Never soft-link frameworks in headers since this results in duplicate code in each source file where it is included.  [softlink/header] [5]
ERROR: Source/WebCore/PAL/pal/spi/cocoa/RevealSPI.h:32:  Never soft-link frameworks in headers since this results in duplicate code in each source file where it is included.  [softlink/header] [5]
ERROR: Source/WebCore/PAL/pal/spi/cocoa/RevealSPI.h:33:  Never soft-link frameworks in headers since this results in duplicate code in each source file where it is included.  [softlink/header] [5]
Total errors found: 8 in 176 files
Comment 1 David Kilzer (:ddkilzer) 2019-01-23 17:40:33 PST
Created attachment 359977 [details]
Patch v1
Comment 2 WebKit Commit Bot 2019-01-23 18:47:58 PST
Comment on attachment 359977 [details]
Patch v1

Clearing flags on attachment: 359977

Committed r240402: <https://trac.webkit.org/changeset/240402>
Comment 3 WebKit Commit Bot 2019-01-23 18:48:00 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 Radar WebKit Bug Importer 2019-01-23 18:48:28 PST
<rdar://problem/47502698>