* lib/getloadavg.c: Test __alpha, not __alpha__.
* tests/test-snan-2.c: Likewise.
* m4/exponentd.m4: Test __arm__, not __arm.
* lib/utimensat.c: Test __hppa, not __hppa__.
* tests/qemu.h: Likewise.
* lib/fma.c: Test __sparc, not __sparc__.
* tests/qemu.h: Likewise.
* tests/test-exp2.h: Likewise.
* tests/test-nonblocking-pipe.h: Likewise.
* tests/test-snan-1.c: Likewise.
* tests/test-snan-2.c: Likewise.
2025-05-07 Bruno Haible <bruno@clisp.org>
+ Add syntax-check rule against CPU predef misspellings.
+ * lib/getloadavg.c: Test __alpha, not __alpha__.
+ * tests/test-snan-2.c: Likewise.
+ * m4/exponentd.m4: Test __arm__, not __arm.
+ * lib/utimensat.c: Test __hppa, not __hppa__.
+ * tests/qemu.h: Likewise.
+ * lib/fma.c: Test __sparc, not __sparc__.
+ * tests/qemu.h: Likewise.
+ * tests/test-exp2.h: Likewise.
+ * tests/test-nonblocking-pipe.h: Likewise.
+ * tests/test-snan-1.c: Likewise.
+ * tests/test-snan-2.c: Likewise.
+
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.
__GNUC_MAJOR__ \
__GNUC_MINOR \
+# Cf. <https://github.com/cpredef/predef/blob/master/Architectures.md>
+# Only the users of module 'host-cpu-c-abi' are allowed to use __${arch}__
+# for all architectures.
+sc_prohibit_misspelled_cpu_predefs:
+ if test -d .git; then \
+ git ls-files m4 lib tests \
+ | grep -Ev '^(m4/host-cpu-c-abi\.m4|lib/sigsegv\.(in\.h|c)|tests/test-sigsegv.*|tests/jit/test-cache\.c)$$' \
+ | xargs grep -Ew '($(misspelled_cpu_predefs_or))' \
+ && { printf '*** %s\n' 'misspelled predefs' 1>&2; exit 1; } \
+ || : \
+ else :; fi
+misspelled_cpu_predefs_or = $(shell echo $(misspelled_cpu_predefs) | tr -s ' ' '|')
+misspelled_cpu_predefs =\
+ __alpha__ \
+ __amd64 \
+ __x86_64 \
+ __arm \
+ __arm64 \
+ __arm64__ \
+ __aarch64 \
+ __hppa__ \
+ __loongarch64__ \
+ __m68k \
+ __riscv__ \
+ __riscv64 \
+ __riscv64__ \
+ __sparc__ \
+ __sparc64 \
+ __sparc64__ \
+
# Cf. <https://github.com/cpredef/predef/blob/master/OperatingSystems.md>
sc_prohibit_misspelled_os_predefs:
if test -d .git; then \
#endif
/* Work around GCC 4.2.1 bug on OpenBSD 5.1/SPARC64. */
-#if defined __GNUC__ && defined __sparc__
+#if defined __GNUC__ && defined __sparc
# define VOLATILE volatile
#else
# define VOLATILE
# define SUNOS_5
# endif
-# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
+# if defined (__osf__) && defined (__alpha)
# define OSF_ALPHA
# include <sys/mbuf.h>
# include <sys/socket.h>
ts[1] = times[1];
times = ts;
}
-# if defined __hppa__ || defined __NetBSD__
+# if defined __hppa || defined __NetBSD__
/* Linux kernel 2.6.22.19 on hppa does not reject invalid tv_nsec
values.
# exponentd.m4
-# serial 4
+# serial 5
dnl Copyright (C) 2007-2008, 2010-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl The newer VFP instructions assume little-endian order
dnl consistently.
AC_EGREP_CPP([mixed_endianness], [
-#if defined arm || defined __arm || defined __arm__
+#if defined __arm__
mixed_endianness
#endif
],
if (n > 0)
{
buf[n] = '\0';
-# if defined __hppa__
+# if defined __hppa
if (strstr (buf, "QEMU") != NULL)
return true;
# endif
|| strcasestr (buf, "aarch64") != NULL)
return true;
# endif
-# if !defined __sparc__
+# if !defined __sparc
if (strcasestr (buf, "SPARC") != NULL)
return true;
# endif
ASSERT (y == L_(1.0));
}
/* <https://sourceware.org/bugzilla/show_bug.cgi?id=13824> */
-#if !(__GLIBC__ == 2 && __GLIBC_MINOR__ < 16 && (defined __sparc__ || defined __powerpc__))
+#if !(__GLIBC__ == 2 && __GLIBC_MINOR__ < 16 && (defined __sparc || defined __powerpc__))
{
int e;
DOUBLE x;
*/
#if defined __MVS__ || defined __osf__ || (defined __linux__ && (defined __ia64__ || defined __mips__))
# define PIPE_DATA_BLOCK_SIZE 270000
-#elif defined __linux__ && defined __sparc__
+#elif defined __linux__ && defined __sparc
# define PIPE_DATA_BLOCK_SIZE 140000
#elif defined __linux__ && defined __powerpc__
# define PIPE_DATA_BLOCK_SIZE 1100000
This test does not work on MSVC/i386, because of the general IA-32
problem (see above) and 'long double' == 'double'. */
#if !((((__GLIBC__ == 2 && __GLIBC_MINOR__ < 19 && defined __mips64) \
- || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __mips64__ || defined __sparc__))) \
+ || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __mips64__ || defined __sparc))) \
&& !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE) \
|| ((defined __i386 || defined _M_IX86) && HAVE_SAME_LONG_DOUBLE_AS_DOUBLE))
{
This test does not work on Cygwin 2.9.0/i386. Cause unknown.
This test does not work on MSVC/i386, because of the general IA-32
problem (see above) and 'long double' == 'double'. */
- #if !((__GLIBC__ == 2 && __GLIBC_MINOR__ < 36 && defined __alpha__) \
+ #if !((__GLIBC__ == 2 && __GLIBC_MINOR__ < 36 && defined __alpha) \
|| (__GLIBC__ >= 2 && defined __loongarch__) \
|| (((__GLIBC__ == 2 && __GLIBC_MINOR__ < 19 && defined __mips64) \
- || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __mips64__ || defined __sparc__))) \
+ || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __mips64__ || defined __sparc))) \
&& !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE) \
|| (defined __CYGWIN__ && defined __i386) \
|| (((defined __i386 || defined _M_IX86) \