diff options
author | Julius Werner <jwerner@chromium.org> | 2019-05-01 16:48:44 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-05-06 10:32:24 +0000 |
commit | c4ab50cdde4bfd01ec7509012b105c88bcf4c953 (patch) | |
tree | 93263fbb786985ba8133ebfe22eeea0342688036 | |
parent | 7c712bbb6c969ae7014707bfddedd821035a2171 (diff) |
Makefile.inc: Enable -Wtype-limits
This patch enables -Wtype-limits for the whole repository, which
disallows checking for a condition that must be always true or always
false based on type width (e.g. checking whether an unsigned variable is
negative or whether a 32-bit integer is larger than 4G). This helps
avoid easy to make and hard to find (because they often only affect
error paths) mistakes like
size_t size = fmap_read_area(...);
if (size < 0)
die("If only the compiler could've told me to use ssize_t instead");
Change-Id: I19edabfd092d09dad720e3fc47b44838163bfe25
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32536
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | Makefile.inc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile.inc b/Makefile.inc index a9aaaed783..9860da1b68 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -401,7 +401,7 @@ endif CFLAGS_common += -pipe -g -nostdinc -std=gnu11 CFLAGS_common += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes CFLAGS_common += -Wwrite-strings -Wredundant-decls -Wno-trigraphs -CFLAGS_common += -Wstrict-aliasing -Wshadow -Wdate-time +CFLAGS_common += -Wstrict-aliasing -Wshadow -Wdate-time -Wtype-limits CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie ifeq ($(CONFIG_COMPILER_GCC),y) |