summaryrefslogtreecommitdiff
path: root/gcc/doc/invoke.texi
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-10-08 12:48:54 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-10-08 12:48:54 +0200
commit7bad794aa005aa3ee52fc9c872051d8346c09a24 (patch)
treedbcbde73147d32631dd626a01571e5964d9ff5fe /gcc/doc/invoke.texi
parent6dc29c6db124fab32ab9b69cfb283e078cc881fc (diff)
downloadgcc-7bad794aa005aa3ee52fc9c872051d8346c09a24.tar.gz
c-lex.c (c_lex_with_flags): For CPP_COMMENT token with PREV_FALLTHROUGH...
* c-lex.c (c_lex_with_flags) <case CPP_COMMENT>: For CPP_COMMENT token with PREV_FALLTHROUGH, skip all following CPP_PADDING and CPP_COMMENT tokens and set add_flags to PREV_FALLTHROUGH afterwards. * doc/invoke.texi (-Wimplicit-fallthrough): Document the accepted FALLTHRU comment styles. * lex.c (fallthrough_comment_p): Fix off-by-one size comparison errors, cleanup. (_cpp_lex_direct): Allow arbitrary comments in between fallthrough_comment_p comment and following token. * c-c++-common/Wimplicit-fallthrough-23.c: New test. * c-c++-common/Wimplicit-fallthrough-24.c: New test. From-SVN: r240884
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r--gcc/doc/invoke.texi24
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 22af6e45673..e1a3e5f291f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -4170,10 +4170,26 @@ C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
Instead of the these attributes, it is also possible to add a "falls through"
-comment to silence the warning. GCC accepts a wide range of such comments,
-for example all of "Falls through.", "fallthru", "FALLS-THROUGH" work. This
-comment needs to consist of two words merely, optionally followed by periods
-or whitespaces.
+comment to silence the warning. The whole body of the C or C++ style comment
+should match one of the following regular expressions:
+
+@itemize @bullet
+
+@item @code{-fallthrough}
+
+@item @code{@@fallthrough@@}
+
+@item @code{[ \t]*FALL(S | |-)?THR(OUGH|U)\.?[ \t]*}
+
+@item @code{[ \t]*Fall((s | |-)[Tt]|t)hr(ough|u)\.?[ \t]*}
+
+@item @code{[ \t]*fall(s | |-)?thr(ough|u)\.?[ \t]*}
+
+@end itemize
+
+and the comment needs to be followed after optional whitespace and other comments
+by @code{case} or @code{default} keywords or by a user label that preceeds some
+@code{case} or @code{default} label.
@smallexample
@group