RESOLVED FIXED193815
Move soft-linking of Lookup.framework out of LookupSPI.h
https://bugs.webkit.org/show_bug.cgi?id=193815
Summary Move soft-linking of Lookup.framework out of LookupSPI.h
David Kilzer (:ddkilzer)
Reported 2019-01-24 22:32:10 PST
Move soft-linking of Lookup.framework out of LookupSPI.h. Header should never soft-link frameworks or libraries since that code can be included in multiple translation units (source files), causing duplicate code to be generated. See Bug 193750 for a new check-webkit-style check that flags this issue.
Attachments
Patch v1 (28.13 KB, patch)
2019-01-24 22:38 PST, David Kilzer (:ddkilzer)
no flags
Patch v2 (33.42 KB, patch)
2019-01-25 10:48 PST, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2019-01-24 22:38:28 PST
Created attachment 360083 [details] Patch v1
Radar WebKit Bug Importer
Comment 2 2019-01-24 22:39:03 PST
Tim Horton
Comment 3 2019-01-24 23:54:03 PST
Comment on attachment 360083 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=360083&action=review > Source/WTF/wtf/cocoa/SoftLinking.h:632 > +#define SOFT_LINK_VARIABLE_MAY_FAIL_FOR_HEADER(functionNamespace, framework, variableName, variableType) \ 'Variable'?! Why is this different from SOFT_LINK_CONSTANT_*? (I'm too lazy to compare)
David Kilzer (:ddkilzer)
Comment 4 2019-01-25 10:15:37 PST
(In reply to Tim Horton from comment #3) > Comment on attachment 360083 [details] > Patch v1 > > View in context: > https://bugs.webkit.org/attachment.cgi?id=360083&action=review > > > Source/WTF/wtf/cocoa/SoftLinking.h:632 > > +#define SOFT_LINK_VARIABLE_MAY_FAIL_FOR_HEADER(functionNamespace, framework, variableName, variableType) \ > > 'Variable'?! Why is this different from SOFT_LINK_CONSTANT_*? (I'm too lazy > to compare) I made a bad design decision when implementing the SOFT_LINK_CONSTANT*() macros, which was to include a local declaration of the constant like this: #define SOFT_LINK_CONSTANT_FOR_HEADER(functionNamespace, framework, variableName, variableType) \ WTF_EXTERN_C_BEGIN \ extern const variableType variableName; \ WTF_EXTERN_C_END \ namespace functionNamespace { \ variableType get_##framework##_##variableName(); \ } If that declaration exactly doesn't match the original (either in an *SPI.h header or the "real" header), then we get compiler warnings-as-errors. Furthermore, the actual soft-linking code doesn't care about `const` keywords in the `variableType`, so to keep the declaration and keep the macros working, we'd need two different types (one that includes the original `const` keywords and one that doesn't). The simple fix is to separate concerns and let the declaration reside in an *SPI.h header or the "real" header, and remove the declaration from the SOFT_LINK_CONSTANT*() macros. (I tried it and the macOS Release build didn't break, so I'll make that change along with this patch.)
David Kilzer (:ddkilzer)
Comment 5 2019-01-25 10:48:32 PST
Created attachment 360124 [details] Patch v2
WebKit Commit Bot
Comment 6 2019-01-25 12:24:19 PST
Comment on attachment 360124 [details] Patch v2 Clearing flags on attachment: 360124 Committed r240494: <https://trac.webkit.org/changeset/240494>
WebKit Commit Bot
Comment 7 2019-01-25 12:24:21 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.