]> Savannah Git Hosting - gnulib.git/commitdiff
Prefer the __gnu_hurd__ macro over __GNU__.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 19 Mar 2025 01:37:48 +0000 (18:37 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 19 Mar 2025 01:37:48 +0000 (18:37 -0700)
* 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__.

12 files changed:
ChangeLog
lib/get_ppid_of.c
lib/get_progname_of.c
lib/getloadavg.c
lib/sigsegv.c
lib/sigsegv.in.h
lib/vma-iter.c
lib/vma-iter.h
tests/test-ptsname.c
tests/test-ptsname_r.c
tests/test-sigsegv-catch-stackoverflow1.c
tests/test-sigsegv-catch-stackoverflow2.c

index 7a5c6632d167e0bdd8cc445efd45d8ca64ffc67d..93ea8a097fdfad88ab89336e084676a2e56b2a10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>.
index 3eb0e12d16bc6aba210368cdddb409ca890afad2..7bf4fcd29cb7d80a64d3a816d1bf2a88ba342690 100644 (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.  */
 
index 9b030e27523e34d1077a8c7e9dec01fe74c186ec..5e940bb6c2e419f031a9c7bba23dbd1ef5e35596 100644 (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.  */
 
index a7966462c73a3834870e5f02585c7a1a98ba50c5..cdf4514be82991735b89d421b5c371aff15fd9dc 100644 (file)
 # 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.  */
 #  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
index e937a037756ffd06d0fc98a034f2fb57f684a3fd..d0519814ebf228b0cc1f306b45e8c7c8f3469d7c 100644 (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__
 
index 64167f89adb43d34fd1e820c10bc025578e35a1a..2a94565c1b9428652e53c8e3995e6d18fe833cc0 100644 (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;
index 125606af06ca2f9029f693a4eb3d92e1ae121984..4f3cd40493654ff202b6a634991fbb352716143b 100644 (file)
 # 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
index 1cc9614b0d8b51413a1efdb445593b714234c878..8d2d1db31342fba668a51e8f96e72db245cc487f 100644 (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
 
index 97353f1f2c6fb98eaa5a8bae225c6546a34dc361..1d3e55ed2b9487fa65f97faa433188474d4a58da 100644 (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]  */
   {
index d57f18ab8f0d5879353247d2a3d7a7c5492fae51..270ff86a9d29434f78d685291f7d0da884d8c49f 100644 (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]  */
   {
index cb20bceb8e66c7f2228a34270ac60103d919d545..59a31630596b380147f6da2e15aa8d6af9a41ec3 100644 (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
index 34ea491740ded9ccd004f82aac7a4e0569a6fb1f..3bace66df518d674abb1da1606fa9d1a54db1b8d 100644 (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