If CONFIG_WERROR=y, stop the build if one of the generated atomics
header in include/linux/atomic/* is modified by returning an error
instead of a warning.
If CONFIG_WERROR is not set, behavior is unchanged (let the build
continue).
Signed-off-by: Vincent Mailhol <[email protected]>
---
scripts/atomic/check-atomics.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/atomic/check-atomics.sh b/scripts/atomic/check-atomics.sh
index 0e7bab3eb0d1..56f9e753bc74 100755
--- a/scripts/atomic/check-atomics.sh
+++ b/scripts/atomic/check-atomics.sh
@@ -26,8 +26,13 @@ while read header; do
NEWSUM="${NEWSUM%% *}"
if [ "${OLDSUM}" != "${NEWSUM}" ]; then
- printf "warning: generated include/${header} has been modified.\n"
+ if grep -q CONFIG_WERROR=y .config; then
+ printf "error: generated include/${header} has been modified.\n"
+ exit 1
+ else
+ printf "warning: generated include/${header} has been modified.\n"
+ fi
fi
done
-exit 0
+exit $?
--
2.35.1