Bug 193750 - check-webkit-style should warn when using soft-linking macros in a header
Summary: check-webkit-style should warn when using soft-linking macros in a header
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-01-23 16:56 PST by David Kilzer (:ddkilzer)
Modified: 2019-01-27 11:02 PST (History)
10 users (show)

See Also:


Attachments
Patch v1 (8.23 KB, patch)
2019-01-23 17:40 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>