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
llvm-svn: 240322
This commit is contained in:
Michael Kruse 2015-06-22 20:31:16 +00:00
parent de26a918c1
commit f22855079a
3 changed files with 18 additions and 0 deletions

View File

@ -39,8 +39,13 @@ POLLY_CXXFLAGS += "-fno-rtti -fno-exceptions"
#
# 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@

View File

@ -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()

View File

@ -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