Fix warnings with Intel 2021.4
[alexxy/gromacs.git] / cmake / gmxCFlags.cmake
index c4e3fd0b913611c84da51df92423868bb376f19b..dbc379619091467b2c872326664ca829ad135088 100644 (file)
@@ -62,11 +62,23 @@ ENDMACRO(GMX_TEST_CXXFLAG VARIABLE FLAGS CXXFLAGSVAR)
 # Prepare some local variables so CUDA and non-CUDA code in targets
 # works the same way.
 function(gmx_target_compile_options_inner)
-    set (CFLAGS "${SIMD_C_FLAGS};${MPI_COMPILE_FLAGS};${EXTRA_C_FLAGS};${GMXC_CFLAGS}" PARENT_SCOPE)
+    set(CFLAGS
+            ${SIMD_C_FLAGS}
+            ${MPI_C_COMPILE_OPTIONS}
+            ${EXTRA_C_FLAGS}
+            ${GMXC_CFLAGS}
+         PARENT_SCOPE)
+
     # When SYCL support has been enabled (so the flag is non-empty), we still *disable* things
     # by default to avoid running each file three passes through the compiler. Then we'll explicitly
     # enable SYCL for the few files using it, as well as the linker.
-    set (CXXFLAGS "${SIMD_CXX_FLAGS};${MPI_COMPILE_FLAGS};${DISABLE_SYCL_CXX_FLAGS};${EXTRA_CXX_FLAGS};${GMXC_CXXFLAGS}" PARENT_SCOPE)
+    set(CXXFLAGS
+            ${SIMD_CXX_FLAGS}
+            ${MPI_CXX_COMPILE_OPTIONS}
+            ${DISABLE_SYCL_CXX_FLAGS}
+            ${EXTRA_CXX_FLAGS}
+            ${GMXC_CXXFLAGS}
+        PARENT_SCOPE)
 endfunction()
 
 # Implementation function to add compiler flags expected for all
@@ -364,12 +376,9 @@ macro (gmx_c_flags)
         if(NOT GMX_OPENMP)
             GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
         endif()
+        GMX_TEST_CXXFLAG(CXXFLAGS_WARN_NO_RESERVED_IDENTIFIER "-Wno-reserved-identifier" GMXC_CXXFLAGS) # LLVM BUG #50644
         GMX_TEST_CXXFLAG(CXXFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS "-Wno-missing-field-initializers" GMXC_CXXFLAGS)
-        # Intel LLVM 2021.2 defaults to no-finite-math which isn't OK for GROMACS
-        if(GMX_INTEL_LLVM AND GMX_INTEL_LLVM_VERSION GREATER_EQUAL 2021020)
-            GMX_TEST_CXXFLAG(CXXFLAGS_FINITE_MATH "-fno-finite-math-only" GMXC_CXXFLAGS)
-        endif()
-        # Some versions of Intel ICPX compiler (at least 2021.1.1 to 2021.2.0) fail to unroll a loop
+        # Some versions of Intel ICPX compiler (at least 2021.1.1 to 2021.3.0) fail to unroll a loop
         # in sycl::accessor::__init, and emit -Wpass-failed=transform-warning. This is a useful
         # warning, but mostly noise right now. Probably related to using shared memory accessors.
         # Note: not a typo: ICPX 2021.1.1 has GMX_INTEL_LLVM_VERSION 202110; 2021.2.0 has 20210200.