* [PATCH 1/3] gnulib-common: suppress -Wtautological-constant-out-of-range-compare
@ 2023-12-30 3:22 Paul Eggert
2023-12-30 3:23 ` [PATCH 2/3] Omit no-longer-needed pragmas Paul Eggert
2023-12-30 3:23 ` [PATCH 3/3] tests: don’t skip if LONG_MAX < pid Paul Eggert
0 siblings, 2 replies; 3+ messages in thread
From: Paul Eggert @ 2023-12-30 3:22 UTC (permalink / raw)
To: bug-gnulib; +Cc: Paul Eggert
* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Pass
-Wno-tautological-constant-out-of-range-compare to clang, as it’s
the warning is enabled by default and in portable code where type
ranges are platform dependent it is generally more trouble than
it’s worth.
---
ChangeLog | 9 +++++++++
m4/gnulib-common.m4 | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index a3a10e0258..fd92a5741b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-12-29 Paul Eggert <eggert@cs.ucla.edu>
+
+ gnulib-common: suppress -Wtautological-constant-out-of-range-compare
+ * m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Pass
+ -Wno-tautological-constant-out-of-range-compare to clang, as it’s
+ the warning is enabled by default and in portable code where type
+ ranges are platform dependent it is generally more trouble than
+ it’s worth.
+
2023-12-29 Simon Josefsson <simon@josefsson.org>
announce-gen: Improve links.
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index b3852a595e..72f3f090ff 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1074,6 +1074,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
dnl -Wno-pedantic >= 4.8 >= 3.9
dnl -Wno-sign-compare >= 3 >= 3.9
dnl -Wno-sign-conversion >= 4.3 >= 3.9
+ dnl -Wno-tautological-out-of-range-compare - >= 3.9
dnl -Wno-type-limits >= 4.3 >= 3.9
dnl -Wno-undef >= 3 >= 3.9
dnl -Wno-unsuffixed-float-constants >= 4.5
@@ -1099,6 +1100,9 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
#if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
-Wno-pedantic
#endif
+ #if 3 < __clang_major__ + (9 <= __clang_minor__)
+ -Wno-tautological-constant-out-of-range-compare
+ #endif
#if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
-Wno-sign-conversion
-Wno-type-limits
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] Omit no-longer-needed pragmas
2023-12-30 3:22 [PATCH 1/3] gnulib-common: suppress -Wtautological-constant-out-of-range-compare Paul Eggert
@ 2023-12-30 3:23 ` Paul Eggert
2023-12-30 3:23 ` [PATCH 3/3] tests: don’t skip if LONG_MAX < pid Paul Eggert
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2023-12-30 3:23 UTC (permalink / raw)
To: bug-gnulib; +Cc: Paul Eggert
* lib/anytostr.c, lib/poll.c, lib/regex.c:
Omit pragmas that should no longer be needed.
---
ChangeLog | 4 ++++
lib/anytostr.c | 7 -------
lib/poll.c | 5 -----
lib/regex.c | 4 ----
4 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fd92a5741b..41a85b3cf1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2023-12-29 Paul Eggert <eggert@cs.ucla.edu>
+ Omit no-longer-needed pragmas
+ * lib/anytostr.c, lib/poll.c, lib/regex.c:
+ Omit pragmas that should no longer be needed.
+
gnulib-common: suppress -Wtautological-constant-out-of-range-compare
* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Pass
-Wno-tautological-constant-out-of-range-compare to clang, as it’s
diff --git a/lib/anytostr.c b/lib/anytostr.c
index 3b74789631..72c0998b0c 100644
--- a/lib/anytostr.c
+++ b/lib/anytostr.c
@@ -17,13 +17,6 @@
/* Written by Paul Eggert */
-/* Tell gcc not to warn about the (i < 0) test, below. */
-#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
-# pragma GCC diagnostic ignored "-Wtype-limits"
-#elif defined __clang__
-# pragma clang diagnostic ignored "-Wtautological-compare"
-#endif
-
#include <config.h>
#include "inttostr.h"
diff --git a/lib/poll.c b/lib/poll.c
index ec8d2c2b55..c140156157 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -18,11 +18,6 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
-/* Tell gcc not to warn about the (nfd < 0) tests, below. */
-#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
-# pragma GCC diagnostic ignored "-Wtype-limits"
-#endif
-
#include <config.h>
#include <alloca.h>
diff --git a/lib/regex.c b/lib/regex.c
index 3beb0deb98..f050ba8de4 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -26,10 +26,6 @@
# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
# pragma GCC diagnostic ignored "-Wvla"
# endif
-# if __GNUC_PREREQ (4, 3)
-# pragma GCC diagnostic ignored "-Wold-style-definition"
-# pragma GCC diagnostic ignored "-Wtype-limits"
-# endif
#endif
/* Make sure no one compiles this code with a C++ compiler. */
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] tests: don’t skip if LONG_MAX < pid
2023-12-30 3:22 [PATCH 1/3] gnulib-common: suppress -Wtautological-constant-out-of-range-compare Paul Eggert
2023-12-30 3:23 ` [PATCH 2/3] Omit no-longer-needed pragmas Paul Eggert
@ 2023-12-30 3:23 ` Paul Eggert
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2023-12-30 3:23 UTC (permalink / raw)
To: bug-gnulib; +Cc: Paul Eggert
* modules/pthread_sigmask-tests, modules/sigprocmask-tests:
(Depends-on): Add inttypes.
* tests/test-pthread_sigmask1.c, tests/test-sigprocmask.c:
Include inttypes.h.
(main): Don’t skip test if pid exceeds LONG_MAX.
---
ChangeLog | 7 +++++++
modules/pthread_sigmask-tests | 1 +
modules/sigprocmask-tests | 1 +
tests/test-pthread_sigmask1.c | 12 +++---------
tests/test-sigprocmask.c | 12 +++---------
5 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 41a85b3cf1..02edd93ac7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2023-12-29 Paul Eggert <eggert@cs.ucla.edu>
+ tests: don’t skip if LONG_MAX < pid
+ * modules/pthread_sigmask-tests, modules/sigprocmask-tests:
+ (Depends-on): Add inttypes.
+ * tests/test-pthread_sigmask1.c, tests/test-sigprocmask.c:
+ Include inttypes.h.
+ (main): Don’t skip test if pid exceeds LONG_MAX.
+
Omit no-longer-needed pragmas
* lib/anytostr.c, lib/poll.c, lib/regex.c:
Omit pragmas that should no longer be needed.
diff --git a/modules/pthread_sigmask-tests b/modules/pthread_sigmask-tests
index e4e0d5b019..d40a013687 100644
--- a/modules/pthread_sigmask-tests
+++ b/modules/pthread_sigmask-tests
@@ -5,6 +5,7 @@ tests/signature.h
tests/macros.h
Depends-on:
+inttypes
sleep
pthread-thread
diff --git a/modules/sigprocmask-tests b/modules/sigprocmask-tests
index 80fcd81fea..aba383e20a 100644
--- a/modules/sigprocmask-tests
+++ b/modules/sigprocmask-tests
@@ -4,6 +4,7 @@ tests/signature.h
tests/macros.h
Depends-on:
+inttypes
sleep
configure.ac:
diff --git a/tests/test-pthread_sigmask1.c b/tests/test-pthread_sigmask1.c
index 06158f9d58..c728bba5e8 100644
--- a/tests/test-pthread_sigmask1.c
+++ b/tests/test-pthread_sigmask1.c
@@ -24,7 +24,7 @@
SIGNATURE_CHECK (pthread_sigmask, int, (int, const sigset_t *, sigset_t *));
#include <errno.h>
-#include <limits.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -45,15 +45,9 @@ int
main ()
{
sigset_t set;
- pid_t pid = getpid ();
+ intmax_t pid = getpid ();
char command[80];
- if (LONG_MAX < pid)
- {
- fputs ("Skipping test: pid too large\n", stderr);
- return 77;
- }
-
signal (SIGINT, sigint_handler);
sigemptyset (&set);
@@ -66,7 +60,7 @@ main ()
ASSERT (pthread_sigmask (SIG_BLOCK, &set, NULL) == 0);
/* Request a SIGINT signal from outside. */
- sprintf (command, "sh -c 'sleep 1; kill -INT %ld' &", (long) pid);
+ sprintf (command, "sh -c 'sleep 1; kill -INT %"PRIdMAX"' &", pid);
ASSERT (system (command) == 0);
/* Wait. */
diff --git a/tests/test-sigprocmask.c b/tests/test-sigprocmask.c
index 640a8e2eb0..f9cd86677f 100644
--- a/tests/test-sigprocmask.c
+++ b/tests/test-sigprocmask.c
@@ -24,7 +24,7 @@
SIGNATURE_CHECK (sigprocmask, int, (int, const sigset_t *, sigset_t *));
#include <errno.h>
-#include <limits.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -45,15 +45,9 @@ int
main ()
{
sigset_t set;
- pid_t pid = getpid ();
+ intmax_t pid = getpid ();
char command[80];
- if (LONG_MAX < pid)
- {
- fputs ("Skipping test: pid too large\n", stderr);
- return 77;
- }
-
signal (SIGINT, sigint_handler);
sigemptyset (&set);
@@ -67,7 +61,7 @@ main ()
ASSERT (sigprocmask (SIG_BLOCK, &set, NULL) == 0);
/* Request a SIGINT signal from outside. */
- sprintf (command, "sh -c 'sleep 1; kill -INT %ld' &", (long) pid);
+ sprintf (command, "sh -c 'sleep 1; kill -INT %"PRIdMAX"' &", pid);
ASSERT (system (command) == 0);
/* Wait. */
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-30 3:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-30 3:22 [PATCH 1/3] gnulib-common: suppress -Wtautological-constant-out-of-range-compare Paul Eggert
2023-12-30 3:23 ` [PATCH 2/3] Omit no-longer-needed pragmas Paul Eggert
2023-12-30 3:23 ` [PATCH 3/3] tests: don’t skip if LONG_MAX < pid Paul Eggert
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).