I build the latest gcc from git regularly, to ensure it can
still build the tools I care about still build from source
and the resulting binaries still do pass their tests.
Here's an instance in which, when configured with
--enable-gcc-warnings, one of coreutils' tests
(inherited from gnulib) failed to compile due to this
new gcc warning:
test-userspec.c:176:9: error: statement is indented as if it were \
guarded by... [-Werror=misleading-indentation]
{
^
test-userspec.c:173:7: note: ...this 'if' clause, but it is not
if (!diag && !T[i].result)
^~
It is a useful warning, but in this case, while the code was
indeed improperly indented, there was no semantic error.
I've pushed this patch:
From fddaabfd235fac7a8dd14d4080d1506a4bec8fde Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Thu, 17 Mar 2016 10:35:08 -0700
Subject: [PATCH] test-userspec.c: do not trigger gcc's new
-Wmisleading-indentation
* tests/test-userspec.c (main): Remove unnecessary braces and fix
misleading indentation. Here is the diagnostic gcc-6.0-to-be issued:
test-userspec.c:176:9: error: statement is indented as if it were \
guarded by... [-Werror=misleading-indentation]
{
^
test-userspec.c:173:7: note: ...this 'if' clause, but it is not
if (!diag && !T[i].result)
^~
---
ChangeLog | 13 +++++++++++++
tests/test-userspec.c | 9 +++------
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 49180d9..a2966d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2016-03-17 Jim Meyering <[email protected]>
+
+ test-userspec.c: do not trigger gcc's new -Wmisleading-indentation
+ * tests/test-userspec.c (main): Remove unnecessary braces and fix
+ misleading indentation. Here is the diagnostic gcc-6.0-to-be issued:
+ test-userspec.c:176:9: error: statement is indented as if it were \
+ guarded by... [-Werror=misleading-indentation]
+ {
+ ^
+ test-userspec.c:173:7: note: ...this 'if' clause, but it is not
+ if (!diag && !T[i].result)
+ ^~
+
2016-03-15 Paul Eggert <[email protected]>
time_rz: port to clang -Wunused-const-variable
diff --git a/tests/test-userspec.c b/tests/test-userspec.c
index 23e7007..2dc1564 100644
--- a/tests/test-userspec.c
+++ b/tests/test-userspec.c
@@ -173,12 +173,9 @@ main (void)
if (!diag && !T[i].result)
continue;
- {
- printf ("%s diagnostic mismatch (-: expected uid,gid; +:actual)\n"
- "-%s\n+%s\n",
- T[i].in, T[i].result, diag);
- fail = 1;
- }
+ printf ("%s diagnostic mismatch (-: expected uid,gid; +:actual)\n"
+ "-%s\n+%s\n", T[i].in, T[i].result, diag);
+ fail = 1;
}
/* Ensure NULL parameters are ignored. */
--
2.8.0.rc2