[polly] r240322 - Use C99 to compile ISL

Tobias Grosser tobias at grosser.es
Thu Jun 25 23:59:09 PDT 2015


On 06/22/2015 10:31 PM, Michael Kruse wrote:
> 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)

I now get the following warnings in my cmake build

[788/1401] Building CXX object 
tools/polly/lib/CMakeFiles/Polly.dir/Transform/IndependentBlocks.cpp.o
cc1plus: warning: command line option ‘-std=gnu99’ is valid for C/ObjC 
but not for C++

Maybe we can add this flag only to C programs?

Best,
Tobias





More information about the llvm-commits mailing list