This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed 1/2] Wmisleading-indentation: add reproducer for PR c/70085
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Fri, 11 Mar 2016 15:27:54 -0500
- Subject: [committed 1/2] Wmisleading-indentation: add reproducer for PR c/70085
- Authentication-results: sourceware.org; auth=none
- References: <1457020600 dot 1637 dot 29 dot camel at redhat dot com>
PR c/70085 reported a false-positive from -Wmisleading-indentation.
The warning was fixed by the fix for PR c/68187 (r233972), but it seems
worth capturing the reproducer for PR c/70085 as an additional test case,
as it's slightly different to those seen in PR c/68187.
Committed to trunk (as "obvious") as r234145.
gcc/testsuite/ChangeLog:
PR c/70085
* c-c++-common/Wmisleading-indentation.c (pr70085): New test case.
---
gcc/testsuite/c-c++-common/Wmisleading-indentation.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gcc/testsuite/c-c++-common/Wmisleading-indentation.c b/gcc/testsuite/c-c++-common/Wmisleading-indentation.c
index 7b499d4..38c8aec 100644
--- a/gcc/testsuite/c-c++-common/Wmisleading-indentation.c
+++ b/gcc/testsuite/c-c++-common/Wmisleading-indentation.c
@@ -1054,3 +1054,19 @@ fn_42_c (int locked, int i)
return 0;
#undef engine_ref_debug
}
+
+/* We shouldn't complain about the following function. */
+#define ENABLE_FEATURE
+int pr70085 (int x, int y)
+{
+ if (x > y)
+ return x - y;
+
+ #ifdef ENABLE_FEATURE
+ if (x == y)
+ return 0;
+ #endif
+
+ return -1;
+}
+#undef ENABLE_FEATURE
--
1.8.5.3