[PATCH] Let cmake infer source file language by the file extension.

Douglas Katzman dougk at google.com
Wed Jun 24 14:16:54 PDT 2015


Hi chapuni,

The purpose of this is to avoid compiling '.S' files using '.c' flags, which removes "-pedantic" from the cc command. Not using -pedantic is good because there is nearly nothing to reasonably warn about; and the only thing that is warned about is that you can't correctly invoke GLUE2 in lib/builtins/assembly.h on platforms for which __USER_LABEL_PREFIX__ is the empty string.

There is essentially no correct way to avoid that - though there are perhaps dubious ways - and my feeling is that gcc is simply overzealous here because its intent was to warn about invoking a macro of two arguments when only one was supplied, which is not quite the same as giving it a macro having zero characters as one argument; but the preprocessor treats those the same for all intents and purposes.
Incidentally, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33305 was the gcc PR which requested the warning in the first place.

This patch depends on http://reviews.llvm.org/D10707

http://reviews.llvm.org/D10713

Files:
  CMakeLists.txt
  lib/builtins/CMakeLists.txt

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -9,7 +9,7 @@
 
 # Check if compiler-rt is built as a standalone project.
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-  project(CompilerRT C CXX)
+  project(CompilerRT C CXX ASM)
   set(COMPILER_RT_STANDALONE_BUILD TRUE)
 else()
   set(COMPILER_RT_STANDALONE_BUILD FALSE)
Index: lib/builtins/CMakeLists.txt
===================================================================
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -274,7 +274,6 @@
         endif ()
       endforeach ()
 
-      set_source_files_properties(${${arch}_SOURCES} PROPERTIES LANGUAGE C)
       add_compiler_rt_runtime(clang_rt.builtins-${arch} ${arch} STATIC
                               SOURCES ${${arch}_SOURCES}
                               CFLAGS "-std=c99")

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10713.28406.patch
Type: text/x-patch
Size: 901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150624/e544a69e/attachment.bin>


More information about the llvm-commits mailing list