1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-05-13 15:13:36 +00:00

Prefer the __gnu_hurd__ macro over __GNU__.

* lib/get_ppid_of.c: Replace use of __GNU__ with __gnu_hurd__.
* lib/get_progname_of.c: Likewise.
* lib/sigsegv.c: Likewise.
* lib/sigsegv.in.h: Likewise.
* lib/vma-iter.c: Likewise.
* lib/vma-iter.h: Likewise.
* tests/test-ptsname.c: Likewise.
* tests/test-ptsname_r.c: Likewise.
* tests/test-sigsegv-catch-stackoverflow1.c: Likewise.
* tests/test-sigsegv-catch-stackoverflow2.c: Likewise.
* lib/getloadavg.c: Likewise. Adjust conditions and comments to account
for the fact that NeXT defines __GNU__ and not __gnu_hurd__.
This commit is contained in:
Collin Funk
2025-03-18 18:37:48 -07:00
parent 579debda82
commit 43fccde48c
12 changed files with 34 additions and 21 deletions

View File

@@ -1,5 +1,19 @@
2025-03-18 Collin Funk <collin.funk1@gmail.com>
Prefer the __gnu_hurd__ macro over __GNU__.
* lib/get_ppid_of.c: Replace use of __GNU__ with __gnu_hurd__.
* lib/get_progname_of.c: Likewise.
* lib/sigsegv.c: Likewise.
* lib/sigsegv.in.h: Likewise.
* lib/vma-iter.c: Likewise.
* lib/vma-iter.h: Likewise.
* tests/test-ptsname.c: Likewise.
* tests/test-ptsname_r.c: Likewise.
* tests/test-sigsegv-catch-stackoverflow1.c: Likewise.
* tests/test-sigsegv-catch-stackoverflow2.c: Likewise.
* lib/getloadavg.c: Likewise. Adjust conditions and comments to account
for the fact that NeXT defines __GNU__ and not __gnu_hurd__.
utimensat: Make sure exit status in configure check doesn't exceed 127.
Reported by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-03/msg00061.html>.

View File

@@ -23,7 +23,7 @@
#include <stdio.h>
#include <string.h>
#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __GNU__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix || defined __sun /* Linux, GNU/kFreeBSD, GNU/Hurd, FreeBSD, NetBSD, Minix, Solaris */
#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __gnu_hurd__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __minix || defined __sun /* Linux, GNU/kFreeBSD, GNU/Hurd, FreeBSD, NetBSD, Minix, Solaris */
# include <fcntl.h>
# include <unistd.h>
#endif
@@ -77,7 +77,7 @@ extern int proc_pidinfo (int, int, uint64_t, void *, int) WEAK_IMPORT_ATTRIBUTE;
pid_t
get_ppid_of (pid_t pid)
{
#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __GNU__ /* Linux, GNU/kFreeBSD, GNU/Hurd */
#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __gnu_hurd__ /* Linux, GNU/kFreeBSD, GNU/Hurd */
/* GNU/kFreeBSD mounts /proc as linprocfs, which looks like a Linux /proc
file system. */

View File

@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __GNU__ || defined __NetBSD__ || defined __FreeBSD__ /* Linux, GNU/kFreeBSD, GNU/Hurd, NetBSD, FreeBSD */
#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __gnu_hurd__ || defined __NetBSD__ || defined __FreeBSD__ /* Linux, GNU/kFreeBSD, GNU/Hurd, NetBSD, FreeBSD */
# include <unistd.h>
# if defined __ANDROID__
# include <fcntl.h>
@@ -85,7 +85,7 @@ extern int proc_pidinfo (int, int, uint64_t, void *, int) WEAK_IMPORT_ATTRIBUTE;
char *
get_progname_of (pid_t pid)
{
#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __GNU__ || defined __NetBSD__ /* Linux, GNU/kFreeBSD, GNU/Hurd, NetBSD */
#if defined __linux__ || defined __ANDROID__ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) || defined __gnu_hurd__ || defined __NetBSD__ /* Linux, GNU/kFreeBSD, GNU/Hurd, NetBSD */
/* GNU/kFreeBSD mounts /proc as linprocfs, which looks like a Linux /proc
file system. */

View File

@@ -108,10 +108,10 @@
# endif
/* Same issues as for NeXT apply to the HURD-based GNU system. */
# ifdef __GNU__
# if defined __gnu_hurd__ || defined NeXT
# undef BSD
# undef FSCALE
# endif /* __GNU__ */
# endif /* __gnu_hurd__ || NeXT */
/* Set values that are different from the defaults, which are
set a little farther down with #ifndef. */
@@ -312,8 +312,7 @@
# endif
# endif
# if defined (__GNU__) && !defined (NeXT)
/* Note that NeXT Openstep defines __GNU__ even though it should not. */
# if defined __gnu_hurd__ && !defined NeXT
/* GNU system acts much like NeXT, for load average purposes,
but not exactly. */
# define NeXT

View File

@@ -359,7 +359,7 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
#endif
#if defined __GNU__ /* Hurd */
#if defined __gnu_hurd__ /* Hurd */
# define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, long code, struct sigcontext *scp
# define SIGSEGV_FAULT_ADDRESS (unsigned long) code
@@ -825,7 +825,7 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
/* List of signals that are sent when an invalid virtual memory address
is accessed, or when the stack overflows. */
#if defined __GNU__ \
#if defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \
|| defined __NetBSD__ || defined __OpenBSD__ \
|| (defined __APPLE__ && defined __MACH__)
@@ -930,7 +930,7 @@ static void sigsegv_reset_onstack_flag (void);
/* -------------------------- leave-sigaltstack.c -------------------------- */
# if defined __GNU__ \
# if defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ \
|| defined __NetBSD__ || defined __OpenBSD__

View File

@@ -64,7 +64,7 @@
/* HAVE_SIGSEGV_RECOVERY
is defined if the system supports catching SIGSEGV. */
#if defined __linux__ || defined __ANDROID__ || defined __GNU__ \
#if defined __linux__ || defined __ANDROID__ || defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \
|| defined __NetBSD__ \
|| defined __OpenBSD__ \
@@ -77,7 +77,7 @@
/* HAVE_STACK_OVERFLOW_RECOVERY
is defined if stack overflow can be caught. */
#if defined __linux__ || defined __ANDROID__ || defined __GNU__ \
#if defined __linux__ || defined __ANDROID__ || defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \
|| (defined __NetBSD__ && !(defined __sparc__ || defined __sparc64__)) \
|| defined __OpenBSD__ \
@@ -187,7 +187,7 @@ extern int sigsegv_leave_handler (void (*continuation) (void*, void*, void*), vo
|| defined _AIX || defined __sun \
|| defined __CYGWIN__ || defined __HAIKU__
typedef ucontext_t *stackoverflow_context_t;
# elif defined __GNU__ \
# elif defined __gnu_hurd__ \
|| defined __FreeBSD_kernel__ || (defined __FreeBSD__ && !(defined __sparc__ || defined __sparc64__)) || defined __DragonFly__ \
|| defined __OpenBSD__ || defined __sgi
typedef struct sigcontext *stackoverflow_context_t;

View File

@@ -101,7 +101,7 @@
# include <mach/mach.h>
#endif
#if defined __GNU__ /* GNU/Hurd */
#if defined __gnu_hurd__ /* GNU/Hurd */
# include <mach/mach.h>
#endif
@@ -1585,7 +1585,7 @@ vma_iterate (vma_iterate_callback_fn callback, void *data)
}
return 0;
#elif defined __GNU__ /* GNU/Hurd */
#elif defined __gnu_hurd__ /* GNU/Hurd */
/* The Hurd has a /proc/self/maps that looks like the Linux one, but it
lacks the VMAs created through anonymous mmap. Therefore use the Mach

View File

@@ -57,7 +57,7 @@ extern int vma_iterate (vma_iterate_callback_fn callback, void *data);
this platform.
Note that even when this macro is defined, vma_iterate() may still fail to
find any virtual memory area, for example if /proc is not mounted. */
#if defined __linux__ || defined __ANDROID__ || defined __GNU__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sgi || defined __osf__ || defined __sun || HAVE_PSTAT_GETPROCVM || (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__ || defined __BEOS__ || defined __HAIKU__ || defined __minix || HAVE_MQUERY
#if defined __linux__ || defined __ANDROID__ || defined __gnu_hurd__ || defined __FreeBSD_kernel__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined _AIX || defined __sgi || defined __osf__ || defined __sun || HAVE_PSTAT_GETPROCVM || (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__ || defined __BEOS__ || defined __HAIKU__ || defined __minix || HAVE_MQUERY
# define VMA_ITERATE_SUPPORTED 1
#endif

View File

@@ -161,7 +161,7 @@ main (void)
close (fd);
}
#elif defined __GNU__ /* Hurd */
#elif defined __gnu_hurd__ /* Hurd */
/* Try various master names of Hurd: /dev/pty[p-q][0-9a-v] */
{

View File

@@ -216,7 +216,7 @@ main (void)
close (fd);
}
#elif defined __GNU__ /* Hurd */
#elif defined __gnu_hurd__ /* Hurd */
/* Try various master names of Hurd: /dev/pty[p-q][0-9a-v] */
{

View File

@@ -21,7 +21,7 @@
/* On GNU/Hurd, when compiling with -D_FORTIFY_SOURCE=2, avoid an error
"*** longjmp causes uninitialized stack frame ***: terminated".
Cf. <https://sourceware.org/bugzilla/show_bug.cgi?id=32522> */
#ifdef __GNU__
#ifdef __gnu_hurd__
# undef _FORTIFY_SOURCE
# undef __USE_FORTIFY_LEVEL
#endif

View File

@@ -21,7 +21,7 @@
/* On GNU/Hurd, when compiling with -D_FORTIFY_SOURCE=2, avoid an error
"*** longjmp causes uninitialized stack frame ***: terminated".
Cf. <https://sourceware.org/bugzilla/show_bug.cgi?id=32522> */
#ifdef __GNU__
#ifdef __gnu_hurd__
# undef _FORTIFY_SOURCE
# undef __USE_FORTIFY_LEVEL
#endif