Changeset: d0112b8fb3d2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d0112b8fb3d2
Modified Files:
        CMakeLists.txt
        monetdb_config.h.in
Branch: cmake-fun
Log Message:

Compilation fixes for Intel compiler.


diffs (59 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,7 +163,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux"
 endif()
 if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
        if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-               MT_addCompilerFlag("-no-gcc" "-no-gcc" "${CMAKE_C_FLAGS}" "all" 
CMAKE_C_FLAGS)
+               MT_addCompilerFlag("-no-gcc([ ]|$)" "-no-gcc" 
"${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS)
                MT_addCompilerFlag("-no-gcc-include-dir" "-no-gcc-include-dir" 
"${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS)
        endif()
        if(EXISTS "${ROOT}/usr/include/math.h") # see 
https://software.intel.com/en-us/forums/intel-c-compiler/topic/760979
@@ -174,7 +174,6 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "Inte
                endif()
        endif()
        set(__attribute__(a) ON)
-       set(_Pragma(a) ON)
        set(NAN_CANNOT_BE_USED_AS_INITIALIZER ON CACHE INTERNAL "NaN cannot be 
used as an initializer") # This hack is only required by the Intel compiler
 elseif(MSVC)
        set(_Noreturn "__declspec(noreturn)")
@@ -622,16 +621,10 @@ else() #GCC, clang and Apple clang
 
        # Replace -g flag with -g3
        if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
-               MT_removeCompilerFlag("-g[ ]" "-g" "${CMAKE_C_FLAGS_DEBUG}" 
"Debug" CMAKE_C_FLAGS_DEBUG)
-               MT_removeCompilerFlag("-g[ ]" "-g" 
"${CMAKE_C_FLAGS_RELWITHDEBINFO}" "RelWithDebugInfo" 
CMAKE_C_FLAGS_RELWITHDEBINFO)
-               if("${CMAKE_C_FLAGS_DEBUG}" STREQUAL "") # hack
-                       set(CMAKE_C_FLAGS_DEBUG "-g3")
-                       set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g3")
-                       message(STATUS "Added -g3 flag for Debug and 
RelWithDebugInfo builds")
-               else()
-                       MT_addCompilerFlag("-g3" "-g3" "${CMAKE_C_FLAGS_DEBUG}" 
"Debug" CMAKE_C_FLAGS_DEBUG)
-                       MT_addCompilerFlag("-g3" "-g3" 
"${CMAKE_C_FLAGS_RELWITHDEBINFO}" "RelWithDebugInfo" 
CMAKE_C_FLAGS_RELWITHDEBINFO)
-               endif()
+               MT_removeCompilerFlag("-g([ ]|$)" "-g" "${CMAKE_C_FLAGS_DEBUG}" 
"Debug" CMAKE_C_FLAGS_DEBUG)
+               MT_removeCompilerFlag("-g([ ]|$)" "-g" 
"${CMAKE_C_FLAGS_RELWITHDEBINFO}" "RelWithDebugInfo" 
CMAKE_C_FLAGS_RELWITHDEBINFO)
+               MT_addCompilerFlag("-g3" "-g3" "${CMAKE_C_FLAGS_DEBUG}" "Debug" 
CMAKE_C_FLAGS_DEBUG)
+               MT_addCompilerFlag("-g3" "-g3" 
"${CMAKE_C_FLAGS_RELWITHDEBINFO}" "RelWithDebugInfo" 
CMAKE_C_FLAGS_RELWITHDEBINFO)
        endif()
 
        if(NOT ${CMAKE_C_FLAGS_RELEASE} MATCHES "D_FORTIFY_SOURCE")
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -441,8 +441,12 @@
 #cmakedefine __attribute__(a)
 #endif
 
-#ifndef _Pragma
-#cmakedefine _Pragma(a)
+/* Intel compiler doesn't support _Pragma from GCC well */
+#ifdef _INTEL_COMPILER
+#ifdef _Pragma
+#undef _Pragma
+#endif
+#define _Pragma(a)
 #endif
 
 /* Does your compiler support the `_Noreturn' specifier? (C11 feature) */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to