[PATCH 4/5] rpdfs-progs: use per-invocation temp file for sparse defines
Auke Kok <[email protected]> Tue, 5 May 2026 10:53:04 -0700
| Newsgroups | dev.linux.lists.rpdfs-devel |
|---|---|
| Message-ID | <[email protected]> |
scripts/sparse.sh wrote .sparse.gcc-defines.h on every invocation. Under make -j, parallel sparse runs clobbered each other's file mid-read. Use mktemp with a trap-based cleanup. Signed-off-by: Auke Kok <[email protected]> --- scripts/sparse.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/sparse.sh b/scripts/sparse.sh index 16d11ac..a11b30e 100755 --- a/scripts/sparse.sh +++ b/scripts/sparse.sh @@ -48,7 +48,8 @@ search=$(gcc -print-search-dirs | awk '($1 == "install:"){print "-I" $2}') # use internal compiler macros to test features. We copy gcc's and give # them to sparse. But not __SIZE_TYPE__ 'cause sparse defines that one. # -defines=".sparse.gcc-defines.h" +defines=$(mktemp .sparse.gcc-defines.XXXXXX.h) +trap "rm -f $defines" EXIT gcc -dM -E -x c - < /dev/null | grep -v __SIZE_TYPE__ > $defines include="-include $defines" @@ -78,7 +79,7 @@ echo "#define __PRETTY_FUNCTION__ __FILE__ " >> $defines . <(awk ' ($2 == "__STDC_VERSION__") { print $2 "=" substr($3, 1, length($3) - 1) -}' < .sparse.gcc-defines.h ) +}' < $defines ) if [ $__STDC_VERSION__ -gt 201710 ]; then cat >> $defines <<EOF // stdbool.h -- 2.54.0