[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sigabbrev_np, sigdescr_np: Fix compilation error on Linux/alpha
From: |
Bruno Haible |
Subject: |
sigabbrev_np, sigdescr_np: Fix compilation error on Linux/alpha |
Date: |
Sat, 28 Aug 2021 19:41:48 +0200 |
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 */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- sigabbrev_np, sigdescr_np: Fix compilation error on Linux/alpha,
Bruno Haible <=