# HG changeset patch # User Jim Meyering # Date 1552196283 28800 # Node ID 53cae2062bf44b01db455ee4c43890b06ea390a9 # Parent e92cc6824b7f6b2f9a4558488ee75254ae9ee330 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 -r e92cc6824b7f -r 53cae2062bf4 ChangeLog --- 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 + + 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 -r e92cc6824b7f -r 53cae2062bf4 tests/test-userspec.c --- 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; }