Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build libsanitizer_common_rt with -Wno-format
Many lines that call `InternalScopedString::AppendF`, including the below, https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp#L31 are format-checked by https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/compiler-rt/lib/sanitizer_common/sanitizer_common.h#L650 which checks if the formats of arguments conform to that of functions like `printf`. But this errors out because the format strings currently do not match their arguments. llvm/llvm-project@9c8f888#diff-5bf0494d1b61b99e55aefb25e59e41b678f20a392c2c6d77e5fbdc97c2ca4c3f started the effort to check `__attribute__((format))` in the codebase, but apparently there were too many violating instances, it made the code build with `-Wno-format` (presumably as an temporary solution): https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/compiler-rt/lib/sanitizer_common/CMakeLists.txt#L223-L224 So this adds `-Wno-format` to our cflags as well. The reason it was fine without it until now is, we didn't build the whole file thanks to this line: https://github.com/emscripten-core/emscripten/blob/a9b347bfcabda59a5edff60ee18b8a0ab70aa9dc/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp#L15 But recent refactoring efforts including llvm/llvm-project#73032, llvm/llvm-project#73192, and llvm/llvm-project#73193 moved many parts out of that file to be built by a specific platform (e.g. fushia) and made the file build unconditionally. I tried to add back `#if SANITIZER_SYMBOLIZER_MARKUP` to that file but then this line (https://github.com/llvm/llvm-project/blob/26a1d6601d727a96f4301d0d8647b5a42760ae0c/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp#L67) breaks with an undefined referenc error. So just build the library with `-Wno-format`, which is also what the upstream is effectively doing, seems a simpler solution.
- Loading branch information