Enable more warnings for Clang 6
[alexxy/gromacs.git] / cmake / gmxCFlags.cmake
index bfe3146c56653e461113aad27ce97db590ab32b5..0b375b20d1a683d16b2545232827d8bdbe10680e 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -129,6 +129,9 @@ macro (gmx_c_flags)
         if(NOT GMX_OPENMP)
             GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
         endif()
+        if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.0.0")
+            GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
+        endif()
         if (GMX_COMPILER_WARNINGS)
             GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall" GMXC_CXXFLAGS)
             # Problematic with CUDA
@@ -194,6 +197,7 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3 /wd177 /wd411 /wd593 /wd981 /wd1418 /wd1419 /wd1
             if(NOT GMX_OPENMP)
                 GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-wd3180" GMXC_CXXFLAGS)
             endif()
+            GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
             if (GMX_COMPILER_WARNINGS)
                 if (GMX_GPU)
 # Suppress warnings from CUDA headers
@@ -290,11 +294,13 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3 /wd177 /wd411 /wd593 /wd981 /wd1418 /wd1419 /wd1
         #      unreferenced local variable (only C)
         #      conversion from 'size_t' to 'int', possible loss of data
         #      conversion from 'const char*' to 'void*', different 'const' qualifiers (only C)
+        #      attributes are ignored in this context
+        #      attribute '' is not recognized
         if(NOT CMAKE_CONFIGURATION_TYPES)
             GMX_TEST_CFLAG(CFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CFLAGS)
-            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4267" GMXC_CXXFLAGS)
+            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4267 /wd5030 /wd4649" GMXC_CXXFLAGS)
         else() #Projects only use the C++ flags
-            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CXXFLAGS)
+            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090 /wd5030 /wd4649" GMXC_CXXFLAGS)
         endif()
     endif()
 
@@ -309,6 +315,9 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3 /wd177 /wd411 /wd593 /wd981 /wd1418 /wd1419 /wd1
     endif()
 
     if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+        if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.9.0")
+            GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
+        endif()
         if(NOT GMX_OPENMP)
             GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
         endif()