Skip to content
Commit 19659427 authored by Martin Kojtal's avatar Martin Kojtal
Browse files

cmake: Add warning options for the project



Only apply these to the sdk project files (not external components).

-Wall - this enables various useful warnings
-Wextra - enable additional warnings
-Wcast-align - Warn whenever a pointer is cast such that the required
alignment of the target is increased
-Wformat-security -  also warn about uses of format functions that
represent possible security problems (requires Wformat to be set)
-Wno-format-zero-length - C allows this, we should not warn about it
-Werror=format-security - error if warning is enabled (-Wformat)
-Wdouble-promotion - give a warning when a value of type float is
implicitly
promoted to double (using unintentionally double floating precision
increases the footprint and impacts performance)
-Wpointer-arith - warn if void pointer arith used, illegal in C
-Werror=implicit-function-declaration - not allowed anymore in C11,
we should not use implicit declarations in the new code
-Wnull-dereference - Warn if the compiler detects paths that trigger
erroneous or undefined behavior due to dereferencing a null pointer
-Wredundant-decls - Warn if anything is declared more than once
in the same scope
-Wshadow - Warn whenever a local variable or type declaration shadows
another variable
-Wswitch-default -Warn whenever a switch statement does not have
a default case

We enable two errors to stop the build as format-security and implicit
function declarations are important to be addressed.

Signed-off-by: Martin Kojtal's avatarMartin Kojtal <martin.kojtal@arm.com>
parent ae75a7b8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment