Skip to content

Commit

Permalink
[crt] Use -std=c11 for crtbegin.o/crtend.o
Browse files Browse the repository at this point in the history
The source uses C11 syntax such as comments and some compilers print
warnings without specifying this flag.

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

llvm-svn: 360459
  • Loading branch information
petrhosek committed May 10, 2019
1 parent 7598b71 commit fc86c7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler-rt/cmake/config-ix.cmake
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/crt/CMakeLists.txt
Expand Up @@ -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)
Expand Down

0 comments on commit fc86c7f

Please sign in to comment.