LANGUAGE property behavior change in CMake 3.19.0 breaks LLVM build
I'm building LLVM 11.0.0 (and almost all sub-projects, i.e. clang/compiler-rt/libcxx/openmp/...). It worked with CMake 3.18.4 but hit compiling error after upgrading to 3.19.0.
FAILED: projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_rtl_amd64.S.o
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/local/bin/ccache /usr/bin/gcc-8 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/tsan -I/tmp/scratch/llvm/compiler-rt/lib/tsan -Iinclude -I/tmp/scratch/llvm/llvm/include -I/tmp/scratch/llvm/compiler-rt/lib/tsan/.. -x c -fdebug-prefix-map='/tmp/scratch'='/usr/local/src' -fPIC -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -O3 -DNDEBUG -m64 -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fPIE -fno-rtti -msse3 -Wframe-larger-than=530 --sysroot=. -MD -MT projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_rtl_amd64.S.o -MF projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_rtl_amd64.S.o.d -o projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_rtl_amd64.S.o -c /tmp/scratch/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
cc1: warning: command line option â<80><98>-Wno-non-virtual-dtorâ<80><99> is valid for C++/ObjC++ but not for C
cc1: warning: command line option â<80><98>-fno-rttiâ<80><99> is valid for C++/ObjC++ but not for C
/tmp/scratch/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S:7:1: error: expected identifier or â<80><98>(â<80><99> before â<80><98>.â<80><99> token
.section .text
^
/tmp/scratch/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S:16:5: error: invalid preprocessing directive #Save
# Save scratch registers.
^~~~
Sounds like .S
are mistakenly treated as .c
.
Issue can we stably repro on CentOS 7 + gcc 9 and Ubuntu 18.04 + gcc 8