aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-10-08 12:53:05 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-10-08 12:53:05 +0200
commit81b02905b035e7afee46c38186c95434b6d86813 (patch)
tree4947622b51f5c1b8e380d14c7173ad3d1d835182 /gcc
parent7bad794aa005aa3ee52fc9c872051d8346c09a24 (diff)
downloadgcc-81b02905b035e7afee46c38186c95434b6d86813.zip
gcc-81b02905b035e7afee46c38186c95434b6d86813.tar.gz
gcc-81b02905b035e7afee46c38186c95434b6d86813.tar.bz2
invoke.texi (-Wimplicit-fallthrough): Document FALLTHRU comment style changes.
* doc/invoke.texi (-Wimplicit-fallthrough): Document FALLTHRU comment style changes. * lex.c (fallthrough_comment_p): Extend to handle more common FALLTHRU comment styles. * c-c++-common/Wimplicit-fallthrough-23.c (foo): Add further tests. From-SVN: r240885
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/doc/invoke.texi8
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-23.c112
4 files changed, 120 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 353fdba..f547a7b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
2016-10-08 Jakub Jelinek <jakub@redhat.com>
+ * doc/invoke.texi (-Wimplicit-fallthrough): Document FALLTHRU comment
+ style changes.
+
* doc/invoke.texi (-Wimplicit-fallthrough): Document the accepted
FALLTHRU comment styles.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index e1a3e5f..65805ba 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -4179,11 +4179,13 @@ should match one of the following regular expressions:
@item @code{@@fallthrough@@}
-@item @code{[ \t]*FALL(S | |-)?THR(OUGH|U)\.?[ \t]*}
+@item @code{lint -fallthrough ?}
-@item @code{[ \t]*Fall((s | |-)[Tt]|t)hr(ough|u)\.?[ \t]*}
+@item @code{[ \t.!]*(ELSE |INTENTIONAL(LY)? )?FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
-@item @code{[ \t]*fall(s | |-)?thr(ough|u)\.?[ \t]*}
+@item @code{[ \t.!]*(Else |Intentional(ly)? )?Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
+
+@item @code{[ \t.!]*([Ee]lse |[Ii]ntentional(ly)? )?fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
@end itemize
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1868c4c..12b9009 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2016-10-08 Jakub Jelinek <jakub@redhat.com>
+ * c-c++-common/Wimplicit-fallthrough-23.c (foo): Add further tests.
+
* c-c++-common/Wimplicit-fallthrough-23.c: New test.
* c-c++-common/Wimplicit-fallthrough-24.c: New test.
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-23.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-23.c
index 137b517..c2988b7 100644
--- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-23.c
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-23.c
@@ -21,15 +21,39 @@ foo (int i)
case 4:
bar (4);
break;
+ case 5:
+ bar (5); /* { dg-bogus "this statement may \[laf]* through" } */
+ /* Else Fall-Thru! */
+ case 6:
+ bar (6);
+ break;
case 7:
bar (7); /* { dg-bogus "this statement may \[laf]* through" } */
/* Some comment. */
- /* fallthrough. */
+ /* ... fallthrough ... */
/* Some other comment. */
/* And yet another. */
case 8:
bar (8);
break;
+ case 9:
+ bar (9); /* { dg-bogus "this statement may \[laf]* through" } */
+ /* Intentional Fallthru */
+ case 10:
+ bar (10);
+ break;
+ case 11:
+ bar (11); /* { dg-bogus "this statement may \[laf]* through" } */
+ /* intentionally fall through */
+ case 12:
+ bar (12);
+ break;
+ case 13:
+ bar (13); /* { dg-bogus "this statement may \[laf]* through" } */
+ /* Falls Through - for reasons known only to the author. */
+ case 14:
+ bar (14);
+ break;
case 15:
bar (15); /* { dg-bogus "this statement may \[laf]* through" } */
/*-fallthrough*/
@@ -42,12 +66,42 @@ foo (int i)
case 18:
bar (18);
break;
+ case 19:
+ bar (19); /* { dg-bogus "this statement may \[laf]* through" } */
+ /*lint -fallthrough*/
+ case 20:
+ bar (20);
+ break;
+ case 21:
+ bar (21); /* { dg-bogus "this statement may \[laf]* through" } */
+ /*lint -fallthrough */
+ case 22:
+ bar (22);
+ break;
case 23:
bar (23); /* { dg-bogus "this statement may \[laf]* through" } */
/*fallthru*/
case 24:
bar (24);
break;
+ case 25:
+ bar (25); /* { dg-bogus "this statement may \[laf]* through" } */
+ /*Else fallthru*/
+ case 26:
+ bar (26);
+ break;
+ case 27:
+ bar (27); /* { dg-bogus "this statement may \[laf]* through" } */
+ /*Intentional fallthru*/
+ case 28:
+ bar (28);
+ break;
+ case 29:
+ bar (29); /* { dg-bogus "this statement may \[laf]* through" } */
+ /*Intentionally fallthru*/
+ case 30:
+ bar (30);
+ break;
case 31:
bar (31); /* { dg-bogus "this statement may \[laf]* through" } */
/*Falls thru*/
@@ -78,15 +132,39 @@ foo (int i)
case 4:
bar (4);
break;
+ case 5:
+ bar (5); /* { dg-bogus "this statement may \[laf]* through" } */
+ // Else Fall-Thru!
+ case 6:
+ bar (6);
+ break;
case 7:
bar (7); /* { dg-bogus "this statement may \[laf]* through" } */
// Some comment.
- // fallthrough
+ // ... fallthrough ...
// Some other comment.
// And yet another.
case 8:
bar (8);
break;
+ case 9:
+ bar (9); /* { dg-bogus "this statement may \[laf]* through" } */
+ // Intentional Fallthru
+ case 10:
+ bar (10);
+ break;
+ case 11:
+ bar (11); /* { dg-bogus "this statement may \[laf]* through" } */
+ // intentionally fall through
+ case 12:
+ bar (12);
+ break;
+ case 13:
+ bar (13); /* { dg-bogus "this statement may \[laf]* through" } */
+ // Falls Through - for reasons known only to the author.
+ case 14:
+ bar (14);
+ break;
case 15:
bar (15); /* { dg-bogus "this statement may \[laf]* through" } */
//-fallthrough
@@ -99,12 +177,42 @@ foo (int i)
case 18:
bar (18);
break;
+ case 19:
+ bar (19); /* { dg-bogus "this statement may \[laf]* through" } */
+ //lint -fallthrough
+ case 20:
+ bar (20);
+ break;
+ case 21:
+ bar (21); /* { dg-bogus "this statement may \[laf]* through" } */
+ //lint -fallthrough
+ case 22:
+ bar (22);
+ break;
case 23:
bar (23); /* { dg-bogus "this statement may \[laf]* through" } */
//fallthru
case 24:
bar (24);
break;
+ case 25:
+ bar (25); /* { dg-bogus "this statement may \[laf]* through" } */
+ //Else fallthru
+ case 26:
+ bar (26);
+ break;
+ case 27:
+ bar (27); /* { dg-bogus "this statement may \[laf]* through" } */
+ //Intentional fallthru
+ case 28:
+ bar (28);
+ break;
+ case 29:
+ bar (29); /* { dg-bogus "this statement may \[laf]* through" } */
+ //Intentionally fallthru
+ case 30:
+ bar (30);
+ break;
case 31:
bar (31); /* { dg-bogus "this statement may \[laf]* through" } */
//Falls thru