[PATCH v4 22/22] devtools: forbid use argument variadic pack extension

Tyler Retzlaff roretzla at linux.microsoft.com
Thu Feb 29 20:53:53 CET 2024


Prevent introduction of new use of args... and ##args compiler
extension.

Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index e379700..811655b 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -61,6 +61,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid use of variadic argument pack extension in macros
+	awk -v FOLDERS="lib drivers app examples" \
+		-v EXPRESSIONS='#[[:space:]]*define.*[^(,[:space:]]\\.\\.\\.[[:space:]]*)' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Do not use variadic argument pack in macros' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# no output on stdout or stderr
 	awk -v FOLDERS="lib drivers" \
 		-v EXPRESSIONS="\\\<printf\\\> \\\<fprintf\\\(stdout, \\\<fprintf\\\(stderr," \
-- 
1.8.3.1



More information about the dev mailing list