changeset 40219:53cae2062bf4

test-userspec.c: don't print NULL * tests/test-userspec.c (main): A test release of gcc, 9.0.1 20190310, warned that this test would attempt to print a NULL pointer via a %s printf format. Fix that and remove the unnecessary preceding "!diag" conjunct. Also add a comment.
author Jim Meyering <meyering@fb.com>
date Sat, 09 Mar 2019 21:38:03 -0800
parents e92cc6824b7f
children 2796695e9216
files ChangeLog tests/test-userspec.c
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Mar 03 19:36:14 2019 +0100
+++ b/ChangeLog	Sat Mar 09 21:38:03 2019 -0800
@@ -1,3 +1,12 @@
+2019-03-09  Jim Meyering  <meyering@fb.com>
+
+	test-userspec.c: don't print NULL
+	* tests/test-userspec.c (main): A test release of gcc,
+	9.0.1 20190310, warned that this test would attempt to
+	print a NULL pointer via a %s printf format.  Fix that
+	and remove the unnecessary preceding "!diag" conjunct.
+	Also add a comment.
+
 2019-03-03  Bruno Haible  <bruno@clisp.org>
 
 	getloadavg: Write NULL for the null pointer.
--- a/tests/test-userspec.c	Sun Mar 03 19:36:14 2019 +0100
+++ b/tests/test-userspec.c	Sat Mar 09 21:38:03 2019 -0800
@@ -170,10 +170,12 @@
           fail = 1;
         }
 
-      if (!diag && !T[i].result)
+      if (!T[i].result)
         continue;
 
-      printf ("%s diagnostic mismatch (-: expected uid,gid; +:actual)\n"
+      /* Expected a non-NULL result diagnostic, yet got NULL.  */
+      diag = "NULL";
+      printf ("%s diagnostic mismatch (-: expected diagnostic; +:actual)\n"
               "-%s\n+%s\n", T[i].in, T[i].result, diag);
       fail = 1;
     }