* Makefile (sc_prohibit_misspelled_os_predefs): New target.
* lib/stat-size.h: Simplify detection of HP-UX.
* lib/mountlist.c: Fix typo in comment.
2025-05-07 Bruno Haible <bruno@clisp.org>
+ Add syntax-check rule against OS predef misspellings.
+ * Makefile (sc_prohibit_misspelled_os_predefs): New target.
+ * lib/stat-size.h: Simplify detection of HP-UX.
+ * lib/mountlist.c: Fix typo in comment.
+
Add syntax-check rule against compiler predef misspellings.
* Makefile (sc_prohibit_misspelled_compiler_predefs): New target.
__GNUC_MAJOR__ \
__GNUC_MINOR \
+# Cf. <https://github.com/cpredef/predef/blob/master/OperatingSystems.md>
+sc_prohibit_misspelled_os_predefs:
+ if test -d .git; then \
+ git ls-files m4 lib tests \
+ | xargs grep -Ew '($(misspelled_os_predefs_or))' \
+ && { printf '*** %s\n' 'misspelled predefs' 1>&2; exit 1; } \
+ || : \
+ else :; fi
+misspelled_os_predefs_or = $(shell echo $(misspelled_os_predefs) | tr -s ' ' '|')
+misspelled_os_predefs = \
+ __AIX__ \
+ __FreeBSD \
+ __NetBSD \
+ __OpenBSD \
+ __CYGWIN \
+ __CYGWIN32__ \
+ __MINGW__ \
+ __WIN32__ \
+ __WIN64__ \
+ __GNU__ \
+ __HAIKU \
+ __hpux__ \
+ __IRIX__ \
+ __sgi__ \
+ __linux \
+ __minix__ \
+ __sun__ \
+ __unix \
+ __unix__ \
+ __ZOS__ \
+ __zOS__ \
+
sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT:
if test -d .git; then \
url=https://lists.gnu.org/r/bug-gnulib/2010-09/msg00064.html; \
goto free_then_fail;
}
else /* fallback to /proc/self/mounts (/etc/mtab). */
-# endif /* __linux __ || __ANDROID__ */
+# endif /* __linux__ || __ANDROID__ */
{
struct mntent *mnt;
char const *table = MOUNTED;
# define STP_BLKSIZE(st) ((0 < (st)->st_blksize \
&& (st)->st_blksize <= (size_t) -1 / 8 + 1) \
? (st)->st_blksize : DEV_BSIZE)
-# if defined hpux || defined __hpux__ || defined __hpux
+# if defined __hpux
/* HP-UX counts st_blocks in 1024-byte units.
This loses when mixing HP-UX and BSD file systems with NFS. */
# define ST_NBLOCKSIZE 1024