[compiler-rt] r360459 - [crt] Use -std=c11 for crtbegin.o/crtend.o

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 12:23:56 PDT 2019


Author: phosek
Date: Fri May 10 12:23:56 2019
New Revision: 360459

URL: http://llvm.org/viewvc/llvm-project?rev=360459&view=rev
Log:
[crt] Use -std=c11 for crtbegin.o/crtend.o

The source uses C11 syntax such as comments and some compilers print
warnings without specifying this flag.

Differential Revision: https://reviews.llvm.org/D61797

Modified:
    compiler-rt/trunk/cmake/config-ix.cmake
    compiler-rt/trunk/lib/crt/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=360459&r1=360458&r2=360459&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Fri May 10 12:23:56 2019
@@ -54,6 +54,7 @@ endif ()
 
 # CodeGen options.
 check_c_compiler_flag(-ffreestanding         COMPILER_RT_HAS_FFREESTANDING_FLAG)
+check_c_compiler_flag(-std=c11               COMPILER_RT_HAS_STD_C11_FLAG)
 check_cxx_compiler_flag(-fPIC                COMPILER_RT_HAS_FPIC_FLAG)
 check_cxx_compiler_flag(-fPIE                COMPILER_RT_HAS_FPIE_FLAG)
 check_cxx_compiler_flag(-fno-builtin         COMPILER_RT_HAS_FNO_BUILTIN_FLAG)

Modified: compiler-rt/trunk/lib/crt/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/crt/CMakeLists.txt?rev=360459&r1=360458&r2=360459&view=diff
==============================================================================
--- compiler-rt/trunk/lib/crt/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/crt/CMakeLists.txt Fri May 10 12:23:56 2019
@@ -71,6 +71,7 @@ endfunction()
 check_cxx_section_exists(".init_array" COMPILER_RT_HAS_INITFINI_ARRAY
   SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n")
 
+append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 CRT_CFLAGS)
 append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS)
 append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC CRT_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WNO_PEDANTIC -Wno-pedantic CRT_CFLAGS)




More information about the llvm-commits mailing list