You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add_compile_options(
# General
-Wall # Enable warnings for common coding mistakes or potential errors.
-Wextra # Extensions for -Wall.
$<$<BOOL:${WARNING_AS_ERROR}>:-Werror> # Treat warnings as errors to fail the build in case of warnings.
-Wpedantic # Warn for now standard C++.
$<$<COMPILE_LANGUAGE:C>:-Werror=implicit-function-declaration> # Calling functions that don't exist are errors
$<$<COMPILE_LANGUAGE:C>:-Werror=incompatible-pointer-types>
$<$<COMPILE_LANGUAGE:C>:-Werror=int-conversion>
# Type conversion
-Wconversion # Warn about implicit type conversions which (may) change the value.
-Wsign-conversion # Warn about implicit sign conversions.
-Wdouble-promotion # Warn about floats being implictly converted to doubles.
-Wfloat-equal # Warn about floatint point values used in equality tests.
-Wpointer-arith # Warn when sizeof(void) is used (directly or indirectly).
# -Wcast-qual # Warn when casting removes a type qualifier from a pointer.
-Wcast-align # Warn when casting a pointers changes the alignment of the pointee.
$<$<COMPILE_LANGUAGE:C>:-Wbad-function-cast> # Warn about casts to function pointers.
-Wstrict-overflow=2 # Warn about optimizations where signed overflow is assumed not to occour.
# Misc
-Wshadow # Warn about duplicated variable names.
# -Wswitch-enum # Warn about switch statements not using all possible enum values.
-Wimplicit-fallthrough # Warn about implicit, un-annotated, fallthroughs.
-Wnull-dereference # Warn about possible null pointer dereference code paths.
-Wundef # Warn when undefined macros are used (implicit conversion to 0.)
$<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes> # Warn when a function declaration misses argument types.
-Wunused # Warn about any unused parameter/function/variable/etc...
-Wmisleading-indentation # Warn about indentation giving the impression of scope.
-Winline # Warn when desired inlining is not possible.
# Strings related
-Wvla # Warn about variable-length arrays being used.
-Wwrite-strings # Warn when attempting to write to a string constant.
-Wformat=2 # Verify printf/scanf/.. arguments and format strings match.
# Code generation
-fno-common # Warn when global variables are not unique (and unintentionaly merged.)
-fstack-usage # Generate stack depth information.
-fvisibility=hidden # Sets the default symbol visibility to hidden.
-fwrapv # Assume signed arithmatic may wrap around.
-ftrivial-auto-var-init=zero # Ensure automatic variables are always initialized.
)
Would be nice to solve some of the issues pointed out when compiling with these extra warnings enabled 😄
The text was updated successfully, but these errors were encountered:
Would be nice to solve some of the issues pointed out when compiling with these extra warnings enabled 😄
The text was updated successfully, but these errors were encountered: