Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-05-19 03:33:02 +0300
committerCampbell Barton <campbell@blender.org>2022-05-19 04:17:01 +0300
commit41feaa17f3b1db488027d9754c02eda8a375f980 (patch)
tree397841dffb37db5576fcd8d6ab9dd170cd87b5ba
parente9c3af3dd76641922b1b3e83095d72ce8968fd9b (diff)
Cleanup: suppress 'address' warnings for ./extern/glew
Also add comments noting why some warnings shouldn't be added to strict-flags.
-rw-r--r--CMakeLists.txt20
-rw-r--r--extern/glew/CMakeLists.txt5
2 files changed, 24 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 13f4e6b9cc4..c0ff56fb0f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -937,7 +937,10 @@ set(PLATFORM_CFLAGS)
set(C_WARNINGS)
set(CXX_WARNINGS)
-# for gcc -Wno-blah-blah
+# NOTE: These flags are intended for situations where where it's impractical to
+# suppress warnings by modifying the code or for code which is maintained externally.
+# For GCC this typically means adding `-Wno-*` arguments to negate warnings
+# that are useful in the general case.
set(C_REMOVE_STRICT_FLAGS)
set(CXX_REMOVE_STRICT_FLAGS)
@@ -1617,6 +1620,18 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
endif()
+
+ #----------------------
+ # Suppress Strict Flags
+ #
+ # Exclude the following warnings from this list:
+ # - `-Wno-address`:
+ # This can give useful hints that point to bugs/misleading logic.
+ # - `-Wno-strict-prototypes`:
+ # No need to support older C-style prototypes.
+ #
+ # If code in `./extern/` needs to suppress these flags that can be done on a case-by-case basis.
+
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
@@ -1672,6 +1687,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS -Wunused-macros)
# ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
+ #----------------------
+ # Suppress Strict Flags
+
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
diff --git a/extern/glew/CMakeLists.txt b/extern/glew/CMakeLists.txt
index bd35fa81538..ce51c8b2f7b 100644
--- a/extern/glew/CMakeLists.txt
+++ b/extern/glew/CMakeLists.txt
@@ -7,6 +7,11 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
"-Wno-strict-prototypes"
)
endif()
+if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "12.1"))
+ add_c_flag(
+ "-Wno-address"
+ )
+endif()
# MSVC's inliner is not having a happy time with glewIsSupported
# causing this to be one of the most expensive things to build