mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: bst@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/4] kbuild: add -Wtype-limits to compile flags
Date: Wed, 24 Mar 2021 13:22:46 +0100	[thread overview]
Message-ID: <20210324122247.10683-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20210324122247.10683-1-a.fatoum@pengutronix.de>

Not warning about e.g. comparisons of unsigned integers with 0 can
introduce nasty bugs around error handling especially.

Enable the warning to be able to identify these issues in future.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index 6d78d1f58eca..81ceedafeb0c 100644
--- a/Makefile
+++ b/Makefile
@@ -650,6 +650,9 @@ CHECKFLAGS     += $(NOSTDINC_FLAGS)
 # warn about C99 declaration after statement
 KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 
+# warn about e.g. (unsigned)x < 0
+KBUILD_CFLAGS += $(call cc-option,-Wtype-limits)
+
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-03-24 12:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 12:22 [PATCH 1/4] net: phy: at803x: fix incorrect use of FIELD_PREP Ahmad Fatoum
2021-03-24 12:22 ` [PATCH 2/4] clk: imx: clk-pllv1: fix wrong PLL recalc on i.MX1/i.MX21 Ahmad Fatoum
2021-03-24 12:22 ` Ahmad Fatoum [this message]
2021-03-24 12:22 ` [PATCH 4/4] mtd: fix possible overflow during mtd size multiplication Ahmad Fatoum
2021-03-25 12:46 ` [PATCH 1/4] net: phy: at803x: fix incorrect use of FIELD_PREP Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210324122247.10683-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=bst@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox