[polly] r240322 - Use C99 to compile ISL

Michael Kruse llvm at meinersbur.de
Mon Jun 22 13:31:16 PDT 2015


Author: meinersbur
Date: Mon Jun 22 15:31:16 2015
New Revision: 240322

URL: http://llvm.org/viewvc/llvm-project?rev=240322&view=rev
Log:
Use C99 to compile ISL

ISL with small integer optimization requires C99 to compile. gcc < 5.0
still uses C89 as default, so we need to enable the options to compile
in C99 mode.

This patch is preparing the actual activation of small integer
optimization.

Differential version: http://reviews.llvm.org/D10610

Reviewers: grosser

Modified:
    polly/trunk/Makefile.config.in
    polly/trunk/cmake/polly_macros.cmake
    polly/trunk/lib/CMakeLists.txt

Modified: polly/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/Makefile.config.in?rev=240322&r1=240321&r2=240322&view=diff
==============================================================================
--- polly/trunk/Makefile.config.in (original)
+++ polly/trunk/Makefile.config.in Mon Jun 22 15:31:16 2015
@@ -39,8 +39,13 @@ POLLY_CXXFLAGS += "-fno-rtti -fno-except
 #
 # We also disable all warnings, as these should be fixed upstream. There is
 # no value in reporting them here.
+#
+# ISL with activated small integer optimization use C99 extern inline
+# semantics. In order to work, we need to enable C99 mode (instead the default
+# -std=gnu89 in case of gcc)
 POLLY_CFLAGS := -fvisibility=hidden
 POLLY_CFLAGS += -w
+POLLY_CFLAGS += -std=gnu99
 
 CUDALIB_FOUND := @cuda_found@
 

Modified: polly/trunk/cmake/polly_macros.cmake
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/cmake/polly_macros.cmake?rev=240322&r1=240321&r2=240322&view=diff
==============================================================================
--- polly/trunk/cmake/polly_macros.cmake (original)
+++ polly/trunk/cmake/polly_macros.cmake Mon Jun 22 15:31:16 2015
@@ -71,3 +71,13 @@ macro(add_polly_loadable_module name)
       LINK_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
   endif()
 endmacro(add_polly_loadable_module)
+
+# # Use C99-compatible compile mode for all C source files of a target.
+function(target_enable_c99 _target)
+  if(CMAKE_VERSION VERSION_GREATER "3.1")
+    set_target_properties("${_target}" PROPERTIES C_STANDARD 99)
+  elseif(CMAKE_COMPILER_IS_GNUCC)
+    get_target_property(_sources "${_target}" SOURCES)
+    set_source_files_properties(${_sources} COMPILE_FLAGS "-std=gnu99")
+  endif()
+endfunction()

Modified: polly/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CMakeLists.txt?rev=240322&r1=240321&r2=240322&view=diff
==============================================================================
--- polly/trunk/lib/CMakeLists.txt (original)
+++ polly/trunk/lib/CMakeLists.txt Mon Jun 22 15:31:16 2015
@@ -189,6 +189,9 @@ add_polly_library(Polly
   ${ISL_FILES}
   )
 
+# ISL requires at least C99 to compile. gcc < 5.0 use -std=gnu89 as default.
+target_enable_c99(Polly)
+
 if (BUILD_SHARED_LIBS)
   target_link_libraries(Polly
     LLVMSupport





More information about the llvm-commits mailing list