diff options
author | Marek Polacek <polacek@redhat.com> | 2016-08-18 10:28:03 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-08-18 10:28:03 +0000 |
commit | 9c62c8735891bd29be0bc379b51b295f2838019a (patch) | |
tree | db24bfe1b22f4718c813c9284791aba188561a2a | |
parent | f9d97e407ff87e930c40d27f37e666fa4db79643 (diff) | |
download | gcc-9c62c8735891bd29be0bc379b51b295f2838019a.zip gcc-9c62c8735891bd29be0bc379b51b295f2838019a.tar.gz gcc-9c62c8735891bd29be0bc379b51b295f2838019a.tar.bz2 |
re PR c/7652 (-Wswitch-break : Warn if a switch case falls through)
PR c/7652
gcc/cp/
* call.c (add_builtin_candidate): Add gcc_fallthrough.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Likewise.
* parser.c (cp_parser_skip_to_end_of_statement): Likewise.
(cp_parser_cache_defarg): Likewise.
libcpp/
* pch.c (write_macdef): Add CPP_FALLTHRU.
From-SVN: r239566
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/call.c | 2 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 2 | ||||
-rw-r--r-- | gcc/cp/parser.c | 4 | ||||
-rw-r--r-- | libcpp/ChangeLog | 5 | ||||
-rw-r--r-- | libcpp/pch.c | 2 |
6 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 52965b8..705a034 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-08-18 Marek Polacek <polacek@redhat.com> + + PR c/7652 + * call.c (add_builtin_candidate): Add gcc_fallthrough. + * cxx-pretty-print.c (pp_cxx_unqualified_id): Likewise. + * parser.c (cp_parser_skip_to_end_of_statement): Likewise. + (cp_parser_cache_defarg): Likewise. + 2016-08-12 Marek Polacek <polacek@redhat.com> PR c/7652 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 0203cd1..05f0431 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2544,6 +2544,8 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code, type2 = ptrdiff_type_node; break; } + /* XXX Really fallthru? */ + /* FALLTHRU */ case MULT_EXPR: case TRUNC_DIV_EXPR: if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)) diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 370476c..f4d2a2e 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -142,6 +142,8 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t) case OVERLOAD: t = OVL_CURRENT (t); + /* XXX Really fallthru? */ + /* FALLTHRU */ case VAR_DECL: case PARM_DECL: case CONST_DECL: diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 48510d0..690e928 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3490,6 +3490,8 @@ cp_parser_skip_to_end_of_statement (cp_parser* parser) cp_lexer_consume_token (parser->lexer); return; } + /* XXX Really fallthru? */ + /* FALLTHRU */ case CPP_OPEN_BRACE: ++nesting_depth; @@ -27669,6 +27671,8 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi) parser->in_template_argument_list_p = saved_italp; break; } + /* XXX Really fallthru? */ + /* FALLTHRU */ case CPP_CLOSE_PAREN: case CPP_ELLIPSIS: /* If we run into a non-nested `;', `}', or `]', diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index c049599..e700dfe 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2016-08-18 Marek Polacek <polacek@redhat.com> + + PR c/7652 + * pch.c (write_macdef): Add CPP_FALLTHRU. + 2016-08-12 Marek Polacek <polacek@redhat.com> PR c/7652 diff --git a/libcpp/pch.c b/libcpp/pch.c index fb9696d..04064c0 100644 --- a/libcpp/pch.c +++ b/libcpp/pch.c @@ -55,6 +55,8 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p) case NT_VOID: if (! (hn->flags & NODE_POISONED)) return 1; + /* XXX Really fallthru? */ + /* FALLTHRU */ case NT_MACRO: if ((hn->flags & NODE_BUILTIN) |