From: Bruno Haible Date: Wed, 7 May 2025 08:52:49 +0000 (+0200) Subject: Add syntax-check rule against compiler predef misspellings. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1239883b1aad0ac384875a96d117b6079f52b608;p=thirdparty%2Fgnulib.git Add syntax-check rule against compiler predef misspellings. * Makefile (sc_prohibit_misspelled_compiler_predefs): New target. --- diff --git a/ChangeLog b/ChangeLog index 738dce26d2..6d1e5f8e3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-05-07 Bruno Haible + + Add syntax-check rule against compiler predef misspellings. + * Makefile (sc_prohibit_misspelled_compiler_predefs): New target. + 2025-05-07 Bruno Haible Remove obsolete syntax-check rules. diff --git a/Makefile b/Makefile index b2d0cec897..767c6eeb6f 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,23 @@ sc_prohibit_leading_TABs: exclude_file_name_regexp--sc_prohibit_leading_TABs = \ ^(lib/(cdefs\.h|getopt|ieee754|malloc/|mini-|mktime\.c|qsort\.c|reg|strverscmp\.c)|m4/(largefile|std-gnu)|m4/libgcrypt|tests/from-glibc/|tests/test-update-copyright|Makefile|.*/Makefile) +# Cf. +sc_prohibit_misspelled_compiler_predefs: + if test -d .git; then \ + git ls-files m4 lib tests \ + | xargs grep -Ew '($(misspelled_compiler_predefs_or))' \ + && { printf '*** %s\n' 'misspelled predefs' 1>&2; exit 1; } \ + || : \ + else :; fi +misspelled_compiler_predefs_or = $(shell echo $(misspelled_compiler_predefs) | tr -s ' ' '|') +misspelled_compiler_predefs =\ + __clang_major \ + __clang_minor \ + __GNUC \ + __GNUC_MAJOR \ + __GNUC_MAJOR__ \ + __GNUC_MINOR \ + sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT: if test -d .git; then \ url=https://lists.gnu.org/r/bug-gnulib/2010-09/msg00064.html; \