linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] kbuild: uapi: various fixes
@ 2025-08-13  6:16 Thomas Weißschuh
  2025-08-13  6:16 ` [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes Thomas Weißschuh
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2025-08-13  6:16 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh

Various fixes and promotion of warnings to real errors.

I didn't add Fixes: tags as digging up the original changes would be
cumbersome as the code moved a lot over the years.
Backporting this doesn't make sense anyways.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v2:
- Drop patch "kbuild: uapi: only update hdrtest output on success"
- Pick up review tags from Nicolas
- Link to v1: https://lore.kernel.org/r/20250812-kbuild-hdrtest-fixes-v1-0-7ad2af66cd58@linutronix.de

---
Thomas Weißschuh (5):
      kbuild: uapi: rerun header tests when headers_check.pl changes
      kbuild: uapi: fail header test on compiler warnings
      kbuild: uapi: upgrade warning on asm/types.h inclusion to error
      kbuild: uapi: upgrade check_sizetypes() warning to error
      kbuild: uapi: upgrade check_declarations() warning to error

 usr/include/Makefile         | 4 ++--
 usr/include/headers_check.pl | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250811-kbuild-hdrtest-fixes-1bf147b3ddd3

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@linutronix.de>


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

* [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes
  2025-08-13  6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
@ 2025-08-13  6:16 ` Thomas Weißschuh
  2025-08-13  6:16 ` [PATCH v2 2/5] kbuild: uapi: fail header test on compiler warnings Thomas Weißschuh
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2025-08-13  6:16 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh

If the checks change they need to be rerun.

Add a Makefile dependency so this happens.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
 usr/include/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/include/Makefile b/usr/include/Makefile
index f02f41941b60c88d921da2b955076bbff7884c1c..c7f164952b33acf6c7b8eb7ce91cd192bfc39ad2 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -85,7 +85,7 @@ quiet_cmd_hdrtest = HDRTEST $<
 		$(PERL) $(src)/headers_check.pl $(obj) $<; \
 		touch $@
 
-$(obj)/%.hdrtest: $(obj)/%.h FORCE
+$(obj)/%.hdrtest: $(obj)/%.h $(src)/headers_check.pl FORCE
 	$(call if_changed_dep,hdrtest)
 
 # Since GNU Make 4.3, $(patsubst $(obj)/%/,%,$(wildcard $(obj)/*/)) works.

-- 
2.50.1


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

* [PATCH v2 2/5] kbuild: uapi: fail header test on compiler warnings
  2025-08-13  6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
  2025-08-13  6:16 ` [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes Thomas Weißschuh
@ 2025-08-13  6:16 ` Thomas Weißschuh
  2025-08-13  6:16 ` [PATCH v2 3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error Thomas Weißschuh
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2025-08-13  6:16 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh

Compiler warnings also indicate issues with the headers.

Make sure they don't go unnoticed.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
 usr/include/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/include/Makefile b/usr/include/Makefile
index c7f164952b33acf6c7b8eb7ce91cd192bfc39ad2..61a7dd4fc05f004d785c64c0019ad846c84719d5 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -80,7 +80,7 @@ always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/
 # Include the header twice to detect missing include guard.
 quiet_cmd_hdrtest = HDRTEST $<
       cmd_hdrtest = \
-		$(CC) $(c_flags) -fsyntax-only -x c /dev/null \
+		$(CC) $(c_flags) -fsyntax-only -Werror -x c /dev/null \
 			$(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \
 		$(PERL) $(src)/headers_check.pl $(obj) $<; \
 		touch $@

-- 
2.50.1


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

* [PATCH v2 3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error
  2025-08-13  6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
  2025-08-13  6:16 ` [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes Thomas Weißschuh
  2025-08-13  6:16 ` [PATCH v2 2/5] kbuild: uapi: fail header test on compiler warnings Thomas Weißschuh
@ 2025-08-13  6:16 ` Thomas Weißschuh
  2025-08-13  6:16 ` [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning " Thomas Weißschuh
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2025-08-13  6:16 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh

No usages of '#include <asm/types.h> in the UAPI headers exist anymore.

Make sure it stays this way.

Add a semicolon to the end of the previous printf call to keep the
syntax valid.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
 usr/include/headers_check.pl | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
index 2b70bfa5558e64518808a22f2f926291da6e47a9..36307a137cc1e109e3e1c253f66f3e5935499fc8 100755
--- a/usr/include/headers_check.pl
+++ b/usr/include/headers_check.pl
@@ -98,9 +98,8 @@ sub check_asm_types
 	if ($line =~ m/^\s*#\s*include\s+<asm\/types.h>/) {
 		$linux_asm_types = 1;
 		printf STDERR "$filename:$lineno: " .
-		"include of <linux/types.h> is preferred over <asm/types.h>\n"
-		# Warn until headers are all fixed
-		#$ret = 1;
+		"include of <linux/types.h> is preferred over <asm/types.h>\n";
+		$ret = 1;
 	}
 }
 

-- 
2.50.1


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

* [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning to error
  2025-08-13  6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2025-08-13  6:16 ` [PATCH v2 3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error Thomas Weißschuh
@ 2025-08-13  6:16 ` Thomas Weißschuh
  2025-08-13  6:17 ` [PATCH v2 5/5] kbuild: uapi: upgrade check_declarations() " Thomas Weißschuh
  2025-08-14 19:11 ` [PATCH v2 0/5] kbuild: uapi: various fixes Nathan Chancellor
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2025-08-13  6:16 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh

No problematic type usages exist anymore.

Make sure it stays this way.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
 usr/include/headers_check.pl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
index 36307a137cc1e109e3e1c253f66f3e5935499fc8..36349b21cef5d55241b68ca24dabe6a321b7ce27 100755
--- a/usr/include/headers_check.pl
+++ b/usr/include/headers_check.pl
@@ -159,7 +159,6 @@ sub check_sizetypes
 		              "found __[us]{8,16,32,64} type " .
 		              "without #include <linux/types.h>\n";
 		$linux_types = 2;
-		# Warn until headers are all fixed
-		#$ret = 1;
+		$ret = 1;
 	}
 }

-- 
2.50.1


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

* [PATCH v2 5/5] kbuild: uapi: upgrade check_declarations() warning to error
  2025-08-13  6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
                   ` (3 preceding siblings ...)
  2025-08-13  6:16 ` [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning " Thomas Weißschuh
@ 2025-08-13  6:17 ` Thomas Weißschuh
  2025-08-14 19:11 ` [PATCH v2 0/5] kbuild: uapi: various fixes Nathan Chancellor
  5 siblings, 0 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2025-08-13  6:17 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Nicolas Schier, Thomas Weißschuh

No problematic declarations exist anymore.

Make sure it stays this way.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
 usr/include/headers_check.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
index 36349b21cef5d55241b68ca24dabe6a321b7ce27..21c2fb9520e6af2d6ebf2decce69f6eea64efd88 100755
--- a/usr/include/headers_check.pl
+++ b/usr/include/headers_check.pl
@@ -74,6 +74,7 @@ sub check_declarations
 		printf STDERR "$filename:$lineno: " .
 			      "userspace cannot reference function or " .
 			      "variable defined in the kernel\n";
+		$ret = 1;
 	}
 }
 

-- 
2.50.1


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

* Re: [PATCH v2 0/5] kbuild: uapi: various fixes
  2025-08-13  6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
                   ` (4 preceding siblings ...)
  2025-08-13  6:17 ` [PATCH v2 5/5] kbuild: uapi: upgrade check_declarations() " Thomas Weißschuh
@ 2025-08-14 19:11 ` Nathan Chancellor
  5 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2025-08-14 19:11 UTC (permalink / raw)
  To: Nicolas Schier, Thomas Weißschuh
  Cc: linux-kbuild, linux-kernel, Nicolas Schier


On Wed, 13 Aug 2025 08:16:55 +0200, Thomas Weißschuh wrote:
> Various fixes and promotion of warnings to real errors.
> 
> I didn't add Fixes: tags as digging up the original changes would be
> cumbersome as the code moved a lot over the years.
> Backporting this doesn't make sense anyways.
> 
> 
> [...]

Applied, thanks!

[1/5] kbuild: uapi: rerun header tests when headers_check.pl changes
      https://git.kernel.org/kbuild/c/d4b7080be277c
[2/5] kbuild: uapi: fail header test on compiler warnings
      https://git.kernel.org/kbuild/c/3788d69db18d3
[3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error
      https://git.kernel.org/kbuild/c/24b1bd64ee403
[4/5] kbuild: uapi: upgrade check_sizetypes() warning to error
      https://git.kernel.org/kbuild/c/c3a9d74ee413b
[5/5] kbuild: uapi: upgrade check_declarations() warning to error
      https://git.kernel.org/kbuild/c/b8d762c983053

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


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

end of thread, other threads:[~2025-08-14 19:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13  6:16 [PATCH v2 0/5] kbuild: uapi: various fixes Thomas Weißschuh
2025-08-13  6:16 ` [PATCH v2 1/5] kbuild: uapi: rerun header tests when headers_check.pl changes Thomas Weißschuh
2025-08-13  6:16 ` [PATCH v2 2/5] kbuild: uapi: fail header test on compiler warnings Thomas Weißschuh
2025-08-13  6:16 ` [PATCH v2 3/5] kbuild: uapi: upgrade warning on asm/types.h inclusion to error Thomas Weißschuh
2025-08-13  6:16 ` [PATCH v2 4/5] kbuild: uapi: upgrade check_sizetypes() warning " Thomas Weißschuh
2025-08-13  6:17 ` [PATCH v2 5/5] kbuild: uapi: upgrade check_declarations() " Thomas Weißschuh
2025-08-14 19:11 ` [PATCH v2 0/5] kbuild: uapi: various fixes Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).