aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2022-07-02 23:47:22 +0200
committerGitHub <noreply@github.com>2022-07-02 14:47:22 -0700
commit2b04aaad945a5bf1d5feb419d0b53c421d83f394 (patch)
tree543aecf038ded6b44bc55653525e8f43c17eef58
parentc6c89391b76d75f6797f81eb403549f0b6f5de68 (diff)
downloadrneovim-2b04aaad945a5bf1d5feb419d0b53c421d83f394.tar.gz
rneovim-2b04aaad945a5bf1d5feb419d0b53c421d83f394.tar.bz2
rneovim-2b04aaad945a5bf1d5feb419d0b53c421d83f394.zip
build: drop -Wsuggest #19177
Disable -Wsuggest compile flags by default. Although the flags are useful to see what the compiler thinks we can improve on, it adds a lot of noise to the build output. That makes it harder to spot actual issues that may be flagged. Closes https://github.com/neovim/neovim/issues/19160
-rw-r--r--CMakeLists.txt35
1 files changed, 19 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5175ba20dd..b996a8fb0c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -274,6 +274,7 @@ int main(void)
}
" HAVE_BUILTIN_ADD_OVERFLOW)
+option(ENABLE_COMPILER_SUGGESTIONS "Enable -Wsuggest compiler warnings" OFF)
if(MSVC)
# XXX: /W4 gives too many warnings. #3241
add_compile_options(/W3)
@@ -292,25 +293,27 @@ else()
add_compile_options(-Wimplicit-fallthrough)
endif()
- # Clang doesn't have -Wsuggest-attribute so check for each one.
- check_c_compiler_flag(-Wsuggest-attribute=pure HAVE_WSUGGEST_ATTRIBUTE_PURE)
- if(HAVE_WSUGGEST_ATTRIBUTE_PURE)
- add_compile_options(-Wsuggest-attribute=pure)
- endif()
+ if(ENABLE_COMPILER_SUGGESTIONS)
+ # Clang doesn't have -Wsuggest-attribute so check for each one.
+ check_c_compiler_flag(-Wsuggest-attribute=pure HAVE_WSUGGEST_ATTRIBUTE_PURE)
+ if(HAVE_WSUGGEST_ATTRIBUTE_PURE)
+ add_compile_options(-Wsuggest-attribute=pure)
+ endif()
- check_c_compiler_flag(-Wsuggest-attribute=const HAVE_WSUGGEST_ATTRIBUTE_CONST)
- if(HAVE_WSUGGEST_ATTRIBUTE_CONST)
- add_compile_options(-Wsuggest-attribute=const)
- endif()
+ check_c_compiler_flag(-Wsuggest-attribute=const HAVE_WSUGGEST_ATTRIBUTE_CONST)
+ if(HAVE_WSUGGEST_ATTRIBUTE_CONST)
+ add_compile_options(-Wsuggest-attribute=const)
+ endif()
- check_c_compiler_flag(-Wsuggest-attribute=malloc HAVE_WSUGGEST_ATTRIBUTE_MALLOC)
- if(HAVE_WSUGGEST_ATTRIBUTE_MALLOC)
- add_compile_options(-Wsuggest-attribute=malloc)
- endif()
+ check_c_compiler_flag(-Wsuggest-attribute=malloc HAVE_WSUGGEST_ATTRIBUTE_MALLOC)
+ if(HAVE_WSUGGEST_ATTRIBUTE_MALLOC)
+ add_compile_options(-Wsuggest-attribute=malloc)
+ endif()
- check_c_compiler_flag(-Wsuggest-attribute=cold HAVE_WSUGGEST_ATTRIBUTE_COLD)
- if(HAVE_WSUGGEST_ATTRIBUTE_COLD)
- add_compile_options(-Wsuggest-attribute=cold)
+ check_c_compiler_flag(-Wsuggest-attribute=cold HAVE_WSUGGEST_ATTRIBUTE_COLD)
+ if(HAVE_WSUGGEST_ATTRIBUTE_COLD)
+ add_compile_options(-Wsuggest-attribute=cold)
+ endif()
endif()
# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang