]> Savannah Git Hosting - gnulib.git/commitdiff
setlocale-tests: do not trigger gcc's -Wanalyzer-possible-null-argument
authorJim Meyering <meyering@fb.com>
Thu, 26 Nov 2020 02:21:25 +0000 (18:21 -0800)
committerJim Meyering <meyering@fb.com>
Thu, 26 Nov 2020 02:21:25 +0000 (18:21 -0800)
* tests/test-setlocale1.c (main): Assert that each strcmp argument is
non-NULL, since we don't bother handing strdup failure.

ChangeLog
tests/test-setlocale1.c

index bb3e664becabd027c5ba2002da679027fd9028a6..49d4ed1046c35329e5204eb3c1db7fe3d03350f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2020-11-25  Jim Meyering  <meyering@fb.com>
 
+       setlocale-tests: do not trigger gcc's -Wanalyzer-possible-null-argument
+       * tests/test-setlocale1.c (main): Assert that each strcmp argument is
+       non-NULL, since we don't bother handing strdup failure.
+
        raise-tests: avoid GCC 11's new exit-from-signal-handler warning
        gcc's -Wanalyzer-unsafe-call-within-signal-handler exposed this.
        * tests/test-raise.c: Include unistd.h.
index 1dd41e3e8d1877855b03bad9251fc925c30549e5..73c2cae37591cd9d6ee8cc8ec4c6f85be7aefd5b 100644 (file)
@@ -52,6 +52,9 @@ main (int argc, char *argv[])
 
   name2 = strdup (setlocale (LC_ALL, NULL));
 
+  ASSERT (name1);
+  ASSERT (name2);
+
   /* Test that the two results are the same.  */
   ASSERT (strcmp (name1, name2) == 0);
   free (name1);