Fix clang unused-function warnings
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 24 Sep 2019 10:01:29 +0000 (12:01 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 24 Sep 2019 12:07:27 +0000 (14:07 +0200)
There are many places inline functions in headers are declared that
won't be used so we should suppress the clang warning about that.

Change-Id: I01c26f68473543007427e5baafc74eee966c0e68

cmake/gmxCFlags.cmake

index 3b025a32b797b6697cb6e4041dbf5a281ec535ce..b0dee1dcd160d282fdb07b1b0c4ccb18782fca1c 100644 (file)
@@ -404,6 +404,11 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3;/wd161;/wd177;/wd411;/wd593;/wd981;/wd1418;/wd14
             endif()
             GMX_TEST_CXXFLAG(CXXFLAGS_WARN_EXTRA "-Wextra;-Wno-missing-field-initializers;-Wpointer-arith;-Wmissing-prototypes" GMXC_CXXFLAGS)
             GMX_TEST_CXXFLAG(CXXFLAGS_DEPRECATED "-Wdeprecated" GMXC_CXXFLAGS)
+            # Functions placed in headers for inlining are not always
+            # used in every translation unit that includes the files,
+            # so we must disable the warning that there are such
+            # functions that are unused.
+            GMX_TEST_CXXFLAG(CXXFLAGS_NO_UNUSED_FUNCTION "-Wno-unused-function" GMXC_CXXFLAGS)
         endif()
         if(NOT GMX_OPENMP)
             GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)