mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] kbuild: make implicit int to pointer conversion warning an error
@ 2024-04-30 13:15 Ahmad Fatoum
  2024-05-03  7:04 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-04-30 13:15 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We are guilty of using ints as pointers in readl/writel, but the old
definition of these uses a cast to silence the warning.

Everywhere else there's no reason to allow this, so make this a hard
error always to weed out any instances we may still have.

Disallowing this has the added benefit of making it easier to change API
in barebox: We do not guarantee out-of-tree board code API stability,
but we want changes in API to result in build errors, not in warnings
that may be eaten up by a build system sitting in-between Kbuild and the
user.

While at it, we fix the whitespace for the surrounding lines.

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

diff --git a/Makefile b/Makefile
index 8e262c17fd50..517b54bd9e6d 100644
--- a/Makefile
+++ b/Makefile
@@ -451,8 +451,9 @@ KBUILD_CPPFLAGS        := -D__KERNEL__ -D__BAREBOX__ $(LINUXINCLUDE) -fno-builti
 
 KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
 		   -fno-strict-aliasing -fno-common -fshort-wchar \
-                   -Werror=implicit-function-declaration -Werror=implicit-int \
-                   -Os -pipe -Wmissing-prototypes -std=gnu11
+		   -Werror=implicit-function-declaration -Werror=implicit-int \
+		   -Werror=int-conversion \
+		   -Os -pipe -Wmissing-prototypes -std=gnu11
 KBUILD_AFLAGS          := -D__ASSEMBLY__
 KBUILD_AFLAGS_KERNEL :=
 KBUILD_CFLAGS_KERNEL :=
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kbuild: make implicit int to pointer conversion warning an error
  2024-04-30 13:15 [PATCH] kbuild: make implicit int to pointer conversion warning an error Ahmad Fatoum
@ 2024-05-03  7:04 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-05-03  7:04 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Tue, 30 Apr 2024 15:15:40 +0200, Ahmad Fatoum wrote:
> We are guilty of using ints as pointers in readl/writel, but the old
> definition of these uses a cast to silence the warning.
> 
> Everywhere else there's no reason to allow this, so make this a hard
> error always to weed out any instances we may still have.
> 
> Disallowing this has the added benefit of making it easier to change API
> in barebox: We do not guarantee out-of-tree board code API stability,
> but we want changes in API to result in build errors, not in warnings
> that may be eaten up by a build system sitting in-between Kbuild and the
> user.
> 
> [...]

Applied, thanks!

[1/1] kbuild: make implicit int to pointer conversion warning an error
      https://git.pengutronix.de/cgit/barebox/commit/?id=bcb16b721fb8 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-03  7:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30 13:15 [PATCH] kbuild: make implicit int to pointer conversion warning an error Ahmad Fatoum
2024-05-03  7:04 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox