+2025-10-31 Bruno Haible <bruno@clisp.org>
+
+ Fix support for Mac OS X/PowerPC G5.
+ Reported by Sergey Fedorov <vital.had@gmail.com> in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2025-10/msg00149.html>.
+ * lib/fenv.in.h: Test _ARCH_PPC instead of __powerpc__ or __ppc__.
+ * lib/fenv-private.h: Likewise.
+ * lib/fenv-env.c: Likewise.
+ * lib/fenv-except-state-get.c: Likewise.
+ * lib/fenv-except-state-set.c: Likewise.
+ * lib/fenv-except-state-test.c: Likewise.
+ * lib/fenv-except-tracking-clear.c: Likewise.
+ * lib/fenv-except-tracking-raise.c: Likewise.
+ * lib/fenv-except-tracking-set.c: Likewise.
+ * lib/fenv-except-tracking-test.c: Likewise.
+ * lib/fenv-except-trapping.c: Likewise.
+ * lib/fenv-round.c: Likewise.
+ * lib/float.in.h: Likewise.
+ * lib/immutable.c: Likewise.
+ * lib/jit/cache.h: Likewise.
+ * lib/snan.h: Likewise.
+ * m4/isfinite.m4 (gl_ISFINITEL_WORKS): Likewise.
+ * tests/qemu.h: Likewise.
+ * tests/test-exp2.h: Likewise.
+ * tests/test-fenv-except-state-3.c: Likewise.
+ * tests/test-fenv-except-tracking-5.c: Likewise.
+ * tests/test-fenv-except-trapping-2.c: Likewise.
+ * tests/test-frexpl.c: Likewise.
+ * tests/test-getpayloadl.c: Likewise.
+ * tests/test-ilogbl.c: Likewise.
+ * tests/test-logbl.c: Likewise.
+ * tests/test-nonblocking-pipe.h: Likewise.
+ * tests/test-printf-frexpl.c: Likewise.
+ * tests/test-setpayloadl.c: Likewise.
+ * tests/test-setpayloadsigl.c: Likewise.
+ * tests/test-ssfmalloc.c: Likewise.
+
2025-10-30 Paul Eggert <eggert@cs.ucla.edu>
fprintftime: check for overflow due to padding
previously saved environment, but not during an fesetenv (FE_DFL_ENV)
invocation. */
-#if defined _AIX && defined __powerpc__ /* AIX */
+#if defined _AIX && defined _ARCH_PPC /* AIX */
/* On AIX, fenv_t is a struct { unsigned short rmode; unsigned int fpstat, trapstate; }. */
return 0;
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
/* On all OSes except *BSD and AIX, fenv_t is a 'double'.
On *BSD, it's an 'unsigned int'.
return 0;
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
/* On all OSes, fexcept_t is binary-equivalent to an 'unsigned int'. */
return 0;
}
-# elif defined _AIX && defined __powerpc__ /* AIX */
+# elif defined _AIX && defined _ARCH_PPC /* AIX */
# include <float.h>
# include <fpxcp.h>
return 0;
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
/* On all OSes, fexcept_t is binary-equivalent to an 'unsigned int'. */
return 0;
}
-# elif defined _AIX && defined __powerpc__ /* AIX */
+# elif defined _AIX && defined _ARCH_PPC /* AIX */
# include <float.h>
# include <fpxcp.h>
return flags & FE_ALL_EXCEPT & exceptions;
}
-#elif (defined __ppc__ || defined __powerpc__)
+#elif defined _ARCH_PPC
int
fetestexceptflag (fexcept_t const *saved_flags, int exceptions)
return 0;
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
int
feclearexcept (int exceptions)
return 0;
}
-# elif defined _AIX && defined __powerpc__ /* AIX */
+# elif defined _AIX && defined _ARCH_PPC /* AIX */
# include <float.h>
# include <fpxcp.h>
return 0;
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
int
feraiseexcept (int exceptions)
return 0;
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
int
fesetexcept (int exceptions)
return 0;
}
-# elif defined _AIX && defined __powerpc__ /* AIX */
+# elif defined _AIX && defined _ARCH_PPC /* AIX */
# include <float.h>
# include <fpxcp.h>
#include "fenv-private.h"
-#if defined _AIX && defined __powerpc__ /* AIX */
+#if defined _AIX && defined _ARCH_PPC /* AIX */
/* On AIX, the register fpscr is augmented with a 32-bit word named fpscrx
in thread-local storage. Instead of accessing fpscr, we must access the
return fcsr & FE_ALL_EXCEPT & exceptions;
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
int
fetestexcept (int exceptions)
return FE_ALL_EXCEPT & (fcsr << 16);
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
# if defined __linux__
# include <sys/prctl.h>
return mask_to_exceptions (trapbits);
}
-# elif defined _AIX && defined __powerpc__ /* AIX */
+# elif defined _AIX && defined _ARCH_PPC /* AIX */
# include <fptrap.h>
/* Documentation:
# define _FPU_GETCW(cw) __asm__ __volatile__ ("movfcsr2gr %0,$r0" : "=r" (cw))
# define _FPU_SETCW(cw) __asm__ __volatile__ ("movgr2fcsr $r0,%0" : : "r" (cw))
-#elif (defined __ppc__ || defined __powerpc__)
+#elif defined _ARCH_PPC
/* fpscr bits 28..25 indicate which floating-point exceptions, other than
FE_INVALID, have occurred since the respective bit was last set to zero.
#endif
-#if defined _AIX && defined __powerpc__ /* AIX */
+#if defined _AIX && defined _ARCH_PPC /* AIX */
/* <fpxcp.h> defines a type fpflag_t and macros FP_*. */
return 0;
}
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
/* The AIX header files have different values for the rounding directions
than all the other platforms: The values 0 and 1 are swapped.
}
fenv_t;
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
typedef double /* yuck! */ fenv_t; /* fpscr register */
# define FE_UPWARD (2 << 8)
# define FE_DOWNWARD (3 << 8)
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
/* Attention: AIX has different values for these macros! */
# define FE_TONEAREST 0
# define FE_DIVBYZERO (1U << 19)
# define FE_INVALID (1U << 20)
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
# define FE_INEXACT (1U << 25)
# define FE_DIVBYZERO (1U << 26)
typedef unsigned int fexcept_t;
-# elif (defined __ppc__ || defined __powerpc__)
+# elif defined _ARCH_PPC
typedef unsigned int fexcept_t;
wrong.
Assume these bugs are fixed in any GCC new enough
to define __LDBL_NORM_MAX__. */
-#if ((defined __ppc__ || defined __powerpc__) && LDBL_MANT_DIG == 106 \
+#if (defined _ARCH_PPC && LDBL_MANT_DIG == 106 \
&& defined __GNUC__ && !defined __LDBL_NORM_MAX__)
# undef LDBL_MIN_EXP
# define LDBL_MIN_EXP (-968)
# define PAGESIZE pagesize
/* On Cygwin and Linux/PowerPC, PAGESIZE is 65536. On macOS 11, it is 16384.
On all other platforms, it is either 4096 or 8192. */
-# if defined __CYGWIN__ || (defined __linux__ && defined __powerpc__)
+# if defined __CYGWIN__ || (defined __linux__ && defined _ARCH_PPC)
# define PAGESIZE_MAX 65536
# else
# define PAGESIZE_MAX 16384
sync_instruction_memory (start, (char *) end - (char *) start);
/* No operating system provided function. Dispatch according to the CPU. */
-#elif (defined __GNUC__ || defined __clang__) && defined __powerpc__
+#elif (defined __GNUC__ || defined __clang__) && defined _ARCH_PPC
/* XXX Is this enough, or do we also need the 'clf' instruction? */
uintptr_t addr = (uintptr_t) start & ~(intptr_t)3;
uintptr_t end_addr = (uintptr_t) end;
{
memory_long_double m;
m.value = quiet_value;
- #if (defined __ppc__ || defined __powerpc__) && LDBL_MANT_DIG == 106
+ #if defined _ARCH_PPC && LDBL_MANT_DIG == 106
/* This is PowerPC "double double", a pair of two doubles. Inf and NaN are
represented as the corresponding 64-bit IEEE values in the first double;
the second is ignored. Manipulate only the first double. */
# isfinite.m4
-# serial 22
+# serial 23
dnl Copyright (C) 2007-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,
#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
/* Another NaN, more precisely crafted. */
m.value = NaNl ();
- #if (defined __ppc__ || defined __powerpc__) && LDBL_MANT_DIG == 106
+ #if defined _ARCH_PPC && LDBL_MANT_DIG == 106
/* This is PowerPC "double double", a pair of two doubles. Inf and NaN are
represented as the corresponding 64-bit IEEE values in the first double;
the second is ignored. Manipulate only the first double. */
if (strcasestr (buf, "SPARC") != NULL)
return true;
# endif
-# if !(defined __ppc__ || defined __powerpc__)
+# if !defined _ARCH_PPC
if (strstr (buf, "POWER") != NULL)
return true;
# endif
ASSERT (y == L_(1.0));
}
/* <https://sourceware.org/PR13824> */
-#if !(__GLIBC__ == 2 && __GLIBC_MINOR__ < 16 && (defined __sparc || defined __powerpc__))
+#if !(__GLIBC__ == 2 && __GLIBC_MINOR__ < 16 && (defined __sparc || defined _ARCH_PPC))
{
int e;
DOUBLE x;
/* On older i386 and on PowerPC, there is no way to implement
fesetexceptflag() such that it does not trigger a trap. fesetexceptflag()
is expected to fail in this case. */
-# if !((defined __i386 || defined _M_IX86) || (defined __ppc__ || defined __powerpc__))
+# if !((defined __i386 || defined _M_IX86) || defined _ARCH_PPC)
ASSERT (rc == 0);
# endif
/* On older i386 and on PowerPC, there is no way to implement
fesetexcept() such that it does not trigger a trap. fesetexcept()
is expected to fail in this case. */
-# if !((defined __i386 || defined _M_IX86) || (defined __ppc__ || defined __powerpc__))
+# if !((defined __i386 || defined _M_IX86) || defined _ARCH_PPC)
ASSERT (rc == 0);
# endif
- gcc >= 8 generates 'com*' or 'fcom*' instructions and thus passes
the test. */
#if (__GLIBC__ >= 2 && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86)) && (__GNUC__ < 8 || defined __clang__)) \
- || (__GLIBC__ >= 2 && (defined __powerpc__ || (defined __s390__ || defined __s390x__))) \
+ || (__GLIBC__ >= 2 && (defined _ARCH_PPC || (defined __s390__ || defined __s390x__))) \
|| (__GLIBC__ >= 2 && __FreeBSD_kernel__ && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86))) \
- || (defined MUSL_LIBC && ((defined __i386 || defined _M_IX86) || defined __powerpc__)) \
+ || (defined MUSL_LIBC && ((defined __i386 || defined _M_IX86) || defined _ARCH_PPC)) \
|| ((defined __APPLE__ && defined __MACH__) && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86) || defined __aarch64__)) \
|| ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86))) \
- || ((defined __FreeBSD__ || defined __NetBSD__) && defined __powerpc__) \
+ || ((defined __FreeBSD__ || defined __NetBSD__) && defined _ARCH_PPC) \
|| (defined __OpenBSD__ && defined __mips64) \
|| (defined __minix && (defined __i386 || defined _M_IX86)) \
- || (defined _AIX && defined __powerpc__) \
+ || (defined _AIX && defined _ARCH_PPC) \
|| (defined __sun && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86))) \
|| (defined __CYGWIN__ && (defined __x86_64__ || defined _M_X64)) \
|| (defined _WIN32 && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86))) \
/* On PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable
exponent for 'long double' is -968. For exponents below that, the precision
may be truncated to the precision used for 'double'. */
-#if defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
+#if defined _ARCH_PPC
# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
#else
# define MIN_NORMAL_EXP LDBL_MIN_EXP
#include "signed-snan.h"
#include "macros.h"
-#if (defined __ppc__ || defined __powerpc__) && LDBL_MANT_DIG == 106
+#if defined _ARCH_PPC && LDBL_MANT_DIG == 106
/* This is PowerPC "double double", a pair of two doubles. NaN is represented
as the corresponding 64-bit IEEE value in the first double; the second is
irrelevant and therefore does not contain a payload. */
/* On PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable
exponent for 'long double' is -968. For exponents below that, the precision
may be truncated to the precision used for 'double'. */
-#if defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
+#if defined _ARCH_PPC
# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
#else
# define MIN_NORMAL_EXP LDBL_MIN_EXP
/* On PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable
exponent for 'long double' is -968. For exponents below that, the precision
may be truncated to the precision used for 'double'. */
-#if defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
+#if defined _ARCH_PPC
# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
#else
# define MIN_NORMAL_EXP LDBL_MIN_EXP
# define PIPE_DATA_BLOCK_SIZE 270000
#elif defined __linux__ && defined __sparc
# define PIPE_DATA_BLOCK_SIZE 140000
-#elif defined __linux__ && defined __powerpc__
+#elif defined __linux__ && defined _ARCH_PPC
# define PIPE_DATA_BLOCK_SIZE 1100000
#elif defined _WIN32 && !defined __CYGWIN__
# define PIPE_DATA_BLOCK_SIZE 10000
/* On PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable
exponent for 'long double' is -968. For exponents below that, the precision
may be truncated to the precision used for 'double'. */
-#if defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__
+#if defined _ARCH_PPC
# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53)
# define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP
#else
#include "isnanl-nolibm.h"
#include "macros.h"
-#if (defined __ppc__ || defined __powerpc__) && LDBL_MANT_DIG == 106
+#if defined _ARCH_PPC && LDBL_MANT_DIG == 106
/* This is PowerPC "double double", a pair of two doubles. NaN is represented
as the corresponding 64-bit IEEE value in the first double; the second is
irrelevant and therefore does not contain a payload. */
#include "isnanl-nolibm.h"
#include "macros.h"
-#if (defined __ppc__ || defined __powerpc__) && LDBL_MANT_DIG == 106
+#if defined _ARCH_PPC && LDBL_MANT_DIG == 106
/* This is PowerPC "double double", a pair of two doubles. NaN is represented
as the corresponding 64-bit IEEE value in the first double; the second is
irrelevant and therefore does not contain a payload. */
#define PAGESIZE pagesize
/* On Cygwin and Linux/PowerPC, PAGESIZE is 65536. On macOS 11, it is 16384.
On all other platforms, it is either 4096 or 8192. */
-#if defined __CYGWIN__ || (defined __linux__ && defined __powerpc__)
+#if defined __CYGWIN__ || (defined __linux__ && defined _ARCH_PPC)
# define PAGESIZE_MAX 65536
#else
# define PAGESIZE_MAX 16384