From: Collin Funk Date: Wed, 19 Mar 2025 01:37:48 +0000 (-0700) Subject: Prefer the __gnu_hurd__ macro over __GNU__. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=43fccde48cbd878ea7b155fc764c1e99a23458d6;p=gnulib.git 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__. --- diff --git a/ChangeLog b/ChangeLog index 7a5c6632d1..93ea8a097f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2025-03-18 Collin Funk + 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 . diff --git a/lib/get_ppid_of.c b/lib/get_ppid_of.c index 3eb0e12d16..7bf4fcd29c 100644 --- a/lib/get_ppid_of.c +++ b/lib/get_ppid_of.c @@ -23,7 +23,7 @@ #include #include -#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 # include #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. */ diff --git a/lib/get_progname_of.c b/lib/get_progname_of.c index 9b030e2752..5e940bb6c2 100644 --- a/lib/get_progname_of.c +++ b/lib/get_progname_of.c @@ -24,7 +24,7 @@ #include #include -#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 # if defined __ANDROID__ # include @@ -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. */ diff --git a/lib/getloadavg.c b/lib/getloadavg.c index a7966462c7..cdf4514be8 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -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 diff --git a/lib/sigsegv.c b/lib/sigsegv.c index e937a03775..d0519814eb 100644 --- a/lib/sigsegv.c +++ b/lib/sigsegv.c @@ -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__ diff --git a/lib/sigsegv.in.h b/lib/sigsegv.in.h index 64167f89ad..2a94565c1b 100644 --- a/lib/sigsegv.in.h +++ b/lib/sigsegv.in.h @@ -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; diff --git a/lib/vma-iter.c b/lib/vma-iter.c index 125606af06..4f3cd40493 100644 --- a/lib/vma-iter.c +++ b/lib/vma-iter.c @@ -101,7 +101,7 @@ # include #endif -#if defined __GNU__ /* GNU/Hurd */ +#if defined __gnu_hurd__ /* GNU/Hurd */ # include #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 diff --git a/lib/vma-iter.h b/lib/vma-iter.h index 1cc9614b0d..8d2d1db313 100644 --- a/lib/vma-iter.h +++ b/lib/vma-iter.h @@ -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 diff --git a/tests/test-ptsname.c b/tests/test-ptsname.c index 97353f1f2c..1d3e55ed2b 100644 --- a/tests/test-ptsname.c +++ b/tests/test-ptsname.c @@ -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] */ { diff --git a/tests/test-ptsname_r.c b/tests/test-ptsname_r.c index d57f18ab8f..270ff86a9d 100644 --- a/tests/test-ptsname_r.c +++ b/tests/test-ptsname_r.c @@ -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] */ { diff --git a/tests/test-sigsegv-catch-stackoverflow1.c b/tests/test-sigsegv-catch-stackoverflow1.c index cb20bceb8e..59a3163059 100644 --- a/tests/test-sigsegv-catch-stackoverflow1.c +++ b/tests/test-sigsegv-catch-stackoverflow1.c @@ -21,7 +21,7 @@ /* On GNU/Hurd, when compiling with -D_FORTIFY_SOURCE=2, avoid an error "*** longjmp causes uninitialized stack frame ***: terminated". Cf. */ -#ifdef __GNU__ +#ifdef __gnu_hurd__ # undef _FORTIFY_SOURCE # undef __USE_FORTIFY_LEVEL #endif diff --git a/tests/test-sigsegv-catch-stackoverflow2.c b/tests/test-sigsegv-catch-stackoverflow2.c index 34ea491740..3bace66df5 100644 --- a/tests/test-sigsegv-catch-stackoverflow2.c +++ b/tests/test-sigsegv-catch-stackoverflow2.c @@ -21,7 +21,7 @@ /* On GNU/Hurd, when compiling with -D_FORTIFY_SOURCE=2, avoid an error "*** longjmp causes uninitialized stack frame ***: terminated". Cf. */ -#ifdef __GNU__ +#ifdef __gnu_hurd__ # undef _FORTIFY_SOURCE # undef __USE_FORTIFY_LEVEL #endif