bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: pacify nvc 22.1 set-but-not-used


From: Paul Eggert
Subject: [PATCH] tests: pacify nvc 22.1 set-but-not-used
Date: Fri, 14 Jan 2022 19:27:51 -0800

* tests/test-fnmatch.c (main): Don’t set a var without using it.
* tests/test-sched.c (f1): Now extern.
---
 ChangeLog            |  4 ++++
 tests/test-fnmatch.c | 28 +++++++++++++---------------
 tests/test-sched.c   |  2 +-
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf22140d44..5fb16542aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2022-01-14  Paul Eggert  <eggert@cs.ucla.edu>
 
+       tests: pacify nvc 22.1 set-but-not-used
+       * tests/test-fnmatch.c (main): Don’t set a var without using it.
+       * tests/test-sched.c (f1): Now extern.
+
        intprops: work around nvc 22.1 bug
        Problem reported by Olivier Cessenat (Bug#53256).
        * lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW) [__EDG__]:
diff --git a/tests/test-fnmatch.c b/tests/test-fnmatch.c
index 9b9800d2ec..07ae5eb8ce 100644
--- a/tests/test-fnmatch.c
+++ b/tests/test-fnmatch.c
@@ -28,29 +28,27 @@ SIGNATURE_CHECK (fnmatch, int, (char const *, char const *, 
int));
 int
 main ()
 {
-  int res;
+  ASSERT (fnmatch ("", "", 0) == 0);
 
-  ASSERT (res = fnmatch ("", "", 0) == 0);
+  ASSERT (fnmatch ("*", "", 0) == 0);
+  ASSERT (fnmatch ("*", "foo", 0) == 0);
+  ASSERT (fnmatch ("*", "bar", 0) == 0);
+  ASSERT (fnmatch ("*", "*", 0) == 0);
+  ASSERT (fnmatch ("**", "f", 0) == 0);
+  ASSERT (fnmatch ("**", "foo.txt", 0) == 0);
+  ASSERT (fnmatch ("*.*", "foo.txt", 0) == 0);
 
-  ASSERT (res = fnmatch ("*", "", 0) == 0);
-  ASSERT (res = fnmatch ("*", "foo", 0) == 0);
-  ASSERT (res = fnmatch ("*", "bar", 0) == 0);
-  ASSERT (res = fnmatch ("*", "*", 0) == 0);
-  ASSERT (res = fnmatch ("**", "f", 0) == 0);
-  ASSERT (res = fnmatch ("**", "foo.txt", 0) == 0);
-  ASSERT (res = fnmatch ("*.*", "foo.txt", 0) == 0);
+  ASSERT (fnmatch ("foo*.txt", "foobar.txt", 0) == 0);
 
-  ASSERT (res = fnmatch ("foo*.txt", "foobar.txt", 0) == 0);
-
-  ASSERT (res = fnmatch ("foo.txt", "foo.txt", 0) == 0);
-  ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", 0) == 0);
-  ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", FNM_NOESCAPE) == FNM_NOMATCH);
+  ASSERT (fnmatch ("foo.txt", "foo.txt", 0) == 0);
+  ASSERT (fnmatch ("foo\\.txt", "foo.txt", 0) == 0);
+  ASSERT (fnmatch ("foo\\.txt", "foo.txt", FNM_NOESCAPE) == FNM_NOMATCH);
 
   /* Verify that an unmatched [ is treated as a literal, as POSIX
      requires.  This test ensures that glibc Bugzilla bug #12378 stays
      fixed.
    */
-  ASSERT (res = fnmatch ("[/b", "[/b", 0) == 0);
+  ASSERT (fnmatch ("[/b", "[/b", 0) == 0);
 
   ASSERT (fnmatch ("[[:alpha:]'[:alpha:]\0]", "a", 0) == FNM_NOMATCH);
   ASSERT (fnmatch ("[a[.\0.]]", "a", 0) == FNM_NOMATCH);
diff --git a/tests/test-sched.c b/tests/test-sched.c
index 6d7c54e54f..1326815b94 100644
--- a/tests/test-sched.c
+++ b/tests/test-sched.c
@@ -29,7 +29,7 @@ int b[] = { SCHED_FIFO, SCHED_RR, SCHED_OTHER };
 /* Check that the types are all defined.  */
 pid_t t1;
 
-static int f1;
+int f1;
 
 int
 main ()
-- 
2.32.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]