[PATCH] [Polly] Use C99 to compile ISL

Michael Kruse llvm at meinersbur.de
Mon Jun 22 12:25:20 PDT 2015


Hi grosser,

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.

The actual activation of small integer optimization will follow after this commit.

http://reviews.llvm.org/D10610

Files:
  Makefile.config.in
  cmake/polly_macros.cmake
  lib/CMakeLists.txt

Index: Makefile.config.in
===================================================================
--- Makefile.config.in
+++ Makefile.config.in
@@ -39,8 +39,13 @@
 #
 # 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@
 
Index: cmake/polly_macros.cmake
===================================================================
--- cmake/polly_macros.cmake
+++ cmake/polly_macros.cmake
@@ -71,3 +71,13 @@
       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()
Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -189,6 +189,9 @@
   ${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

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10610.28145.patch
Type: text/x-patch
Size: 1645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150622/add2ecc8/attachment.bin>


More information about the llvm-commits mailing list