3 ms·
I'm tracking all G++ 14+ flags and warnings that reduce the likelihood of writing unsafe or incorrect C++ code. What am I missing? # Primary Warning Set
by greenavocado 2y ago
I'm tracking all G++ 14+ flags and warnings that reduce the likelihood of writing unsafe or incorrect C++ code. What am I missing?
# Primary Warning Set
-Wall -Wextra
# Enhanced Warning Sets
-Wpedantic -Weffc++
# Type Safety
-Wshadow -Wold-style-cast -Wcast-align -Wconversion -Wsign-conversion
-Wdouble-promotion -Wimplicit-fallthrough=5 -Wlogical-op -Wuseless-cast
-Wlifetime -Wsuggest-final-types -Wsuggest-final-methods -Wzero-as-null-pointer-constant
# C++ Features
-Wcatch-value=3 -Wctad-maybe-unsupported -Wdeprecated-copy-dtor
# Memory and Object Safety
-Wdangling-reference -Wpessimizing-move -Wredundant-move -Wclass-conversion
-Wuse-after-free=3 -Wmismatched-new-delete
# Declaration Consistency
-Wmismatched-tags -Wredundant-tags -Wredundant-decls -Wnon-template-friend
-Wattribute-alias=2
# Advanced Analysis
-Wstrict-aliasing=3 -Wstrict-overflow=5 -Warray-bounds=2 -Wzero-length-bounds
-Wnrvo -Winterference-size
# Attribute Suggestions
-Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn
-Wmissing-noreturn
# Miscellaneous
-Warith-conversion -Wundef -faligned-new
# Static Analysis
-fanalyzer -Wanalyzer-too-complex