From: Jim Meyering Date: Sun, 10 Mar 2019 05:38:03 +0000 (-0800) Subject: test-userspec.c: don't print NULL X-Git-Tag: v1.0~5044 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=81d0d262d83345d3f50b21b0926b740027a1020a;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 4efd9bccc4..27c50744c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-03-09 Jim Meyering + + 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 getloadavg: Write NULL for the null pointer. diff --git a/tests/test-userspec.c b/tests/test-userspec.c index 8211aa2349..800169bb29 100644 --- a/tests/test-userspec.c +++ b/tests/test-userspec.c @@ -170,10 +170,12 @@ main (void) 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; }