bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* sigabbrev_np, sigdescr_np: Fix compilation error on Linux/alpha
@ 2021-08-28 17:41 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2021-08-28 17:41 UTC (permalink / raw)
  To: bug-gnulib

On Linux/alpha, with a testdir of all of gnulib, I see this compilation error:

../../gllib/sigabbrev_np.c: In function 'sigabbrev_np':
../../gllib/sigabbrev_np.c:199:5: error: duplicate case value
  199 |     case SIGPWR:      return "PWR";
      |     ^~~~
../../gllib/sigabbrev_np.c:135:5: note: previously used here
  135 |     case SIGINFO:     return "INFO";
      |     ^~~~
make[4]: *** [Makefile:9372: sigabbrev_np.o] Error 1

The reason is that SIGPWR and SIGINFO have the same value on this platform.
This patch fixes it, in the same way as glibc does.


2021-08-28  Bruno Haible  <bruno@clisp.org>

	sigabbrev_np, sigdescr_np: Fix compilation error on Linux/alpha.
	* lib/sigabbrev_np.c (sigabbrev_np): When SIGINFO and SIGPWR have the
	same value, give precendence to SIGPWR.
	* lib/sigdescr_np.c (sigdescr_np): Likewise.
	* tests/test-sigabbrev_np.c (main): Likewise.
	* tests/test-sigdescr_np.c (main): Likewise.

diff --git a/lib/sigabbrev_np.c b/lib/sigabbrev_np.c
index 5271a16b0..51e2c3532 100644
--- a/lib/sigabbrev_np.c
+++ b/lib/sigabbrev_np.c
@@ -131,7 +131,7 @@ sigabbrev_np (int sig)
     case SIGEMT:      return "EMT";
     #endif
     /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix */
-    #if defined SIGINFO
+    #if defined SIGINFO && SIGINFO != SIGPWR
     case SIGINFO:     return "INFO";
     #endif
     /* Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin */
diff --git a/lib/sigdescr_np.c b/lib/sigdescr_np.c
index 7f8dccf81..bf6abe55c 100644
--- a/lib/sigdescr_np.c
+++ b/lib/sigdescr_np.c
@@ -189,7 +189,7 @@ sigdescr_np (int sig)
       return "Instruction emulation needed";
     #endif
     /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix */
-    #if defined SIGINFO
+    #if defined SIGINFO && SIGINFO != SIGPWR
     case SIGINFO:
       return "Information request";
     #endif
diff --git a/tests/test-sigabbrev_np.c b/tests/test-sigabbrev_np.c
index 1138195f9..42947f8dc 100644
--- a/tests/test-sigabbrev_np.c
+++ b/tests/test-sigabbrev_np.c
@@ -129,7 +129,7 @@ main (void)
   ASSERT (strcmp (sigabbrev_np (SIGEMT), "EMT") == 0);
   #endif
   /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix */
-  #ifdef SIGINFO
+  #ifdef SIGINFO && SIGINFO != SIGPWR
   ASSERT (strcmp (sigabbrev_np (SIGINFO), "INFO") == 0);
   #endif
   /* AIX */
diff --git a/tests/test-sigdescr_np.c b/tests/test-sigdescr_np.c
index a3f7f85ce..5025ac16f 100644
--- a/tests/test-sigdescr_np.c
+++ b/tests/test-sigdescr_np.c
@@ -131,7 +131,7 @@ main (void)
   ASSERT (strcmp (sigdescr_np (SIGEMT), "Instruction emulation needed") == 0);
   #endif
   /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix */
-  #ifdef SIGINFO
+  #ifdef SIGINFO && SIGINFO != SIGPWR
   ASSERT (strcmp (sigdescr_np (SIGINFO), "Information request") == 0);
   #endif
   /* AIX */





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-28 17:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28 17:41 sigabbrev_np, sigdescr_np: Fix compilation error on Linux/alpha Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).