[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1544556407-19897-2-git-send-email-Dave.Martin@arm.com>
Date: Tue, 11 Dec 2018 19:26:45 +0000
From: Dave Martin <Dave.Martin@....com>
To: linux-arm-kernel@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org, Will Deacon <will.deacon@....com>,
Alan Hayward <alan.hayward@....com>,
Szabolcs Nagy <szabolcs.nagy@....com>
Subject: [PATCH 1/3] kbuild: install_headers.sh: Strip _UAPI from #if-defined() guards
install_headers.sh knows how to strip the _UAPI prefix from #ifdef/
ifndef and #define directives used to guard headers against multiple
or inappropriate inclusion. Currently this does not work for guards
in the "#if defined()" style, which may be needed for non-trivial
cases.
This patch adds similar logic so that the _UAPI prefix is also
stripped from guard directives written using "#if defined()" etc.
This is not completely foolproof, but will work for simple cases of
using #if defined() to guard against inappropriate header inclusion.
Signed-off-by: Dave Martin <Dave.Martin@....com>
---
scripts/headers_install.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 593f8879..fe1d3fc 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -38,6 +38,7 @@ do
-e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
-e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \
-e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \
+ -e ':1;s/(#(if|elif)(.*[^A-Za-z0-9_])defined\([[:space:]]*)_UAPI/\1/;t1' \
"$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
> "$OUTDIR/$FILE"
--
2.1.4
Powered by blists - more mailing lists