Bug 312258
| Summary: | inspector.gresource differs depending on the compiler used, breaking multiarch | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Alberto Garcia <berto> |
| Component: | WebKitGTK | Assignee: | Alberto Garcia <berto> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | bugs-noreply |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Alberto Garcia
This is what happens:
1. During compilation the InspectorBackendCommands.js.in file is generated
This contains several #if blocks, for example:
#if defined(ENABLE_WEBGL) && ENABLE_WEBGL
InspectorBackend.registerEnum("Canvas.ProgramType", {Compute: "compute", Render: "render"});
#endif // defined(ENABLE_WEBGL) && ENABLE_WEBGL
2. This is run through the C preprocessor to generate InspectorBackendCommands.js
clang -E -P -x c++ -C -DENABLE_FOO -DENABLE_BAR InspectorBackendCommands.js.in
3. The resulting file is added to inspector.gresource
In step (2), gcc is used if clang is not available, but unfortunately,
and due to the -C flag, gcc adds to the generated file several
comments from /usr/include/stdc-predef.h, e.g.:
/* wchar_t uses Unicode 10.0.0. Version 10.0 of the Unicode Standard is
synchronized with ISO/IEC 10646:2017, fifth edition, plus
the following additions from Amendment 1 to the fifth edition:
- 56 emoji characters
- 285 hentaigana
- 3 additional Zanabazar Square characters */
clang does not do that, so depending on the compiler used to build
WebKit the arch-independent inspector.gresource varies depending
on the architecture, breaking multiarch installations.
Removing the -C flag is not the best option since it would strip the
actual comments from InspectorBackendCommands.js.in (including the
License and the Apple copyright notice).
One alternative is to use -ffreestanding, supported by both gcc and
clang, which does not use the standard library and therefore does not
bring anything from stdc-predef.h. Since we're using the preprocessor
to check for WebKit's own ENABLE_* and WTF_PLATFORM_* this should not
have any effect.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alberto Garcia
Pull request: https://github.com/WebKit/WebKit/pull/62723
EWS
Committed 311268@main (2012029f8a67): <https://commits.webkit.org/311268@main>
Reviewed commits have been landed. Closing PR #62723 and removing active labels.