| Summary: | [CMake] Clang warnings about C code being built in C++ mode | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Adrian Perez <aperez> |
| Component: | Tools / Tests | Assignee: | Lauro Moura <lmoura> |
| Status: | RESOLVED FIXED | ||
| Severity: | Minor | CC: | Hironori.Fujii, stephan.szabo, webkit-bug-importer, ysuzuki |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=247064 | ||
|
Description
Adrian Perez
2022-09-14 05:06:30 PDT
This is easily reproducible with: CC=clang CXX=clang++ cmake -S. -Bbuild -DPORT=GTK -GNinja ninja -Cbuild What about adding enable_language(C)? This is intentional since these files cannot be compiled as C in GCC probably because GCC lacks some constant propagation feature, which requires this explicit C++ handling. So, I think, if we are using clang, then we do not need to mark them as C++. We'd noticed something similar in the past, but we thought it was something specific to our downstream compilers, so in our case we ended up forcing a -xc++ into the build in our toolchain. It feels like this should work from the CMake side (setting the language to CXX for a file that has .c extension), so if it's more general and happens in a test project, I wonder if it's something that should get handled inside the CMake code (well the modules for the compiler). From discussion on CMake discourse, with a minimum 3.20 or policy CMP0119 set to NEW, we'd get the -xc++ automatically when setting the language, but that won't help us for older versions. Pull request: https://github.com/WebKit/WebKit/pull/5814 Committed 256626@main (e071c895f5fc): <https://commits.webkit.org/256626@main> Reviewed commits have been landed. Closing PR #5814 and removing active labels. |