diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-29 16:06:19 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-29 16:06:19 +0000 |
commit | f0fbe519e07e1ae1d850785496222f7c01d0a38b (patch) | |
tree | de65daf646063d398a29e838164556dae2e7bbc3 /libcpp/directives.c | |
parent | ae93ec7734218885a6e456be549eb7881aa2ca80 (diff) | |
download | gcc-f0fbe519e07e1ae1d850785496222f7c01d0a38b.tar.gz |
libcpp/ChangeLog:
2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
* directives.c (check_eol_1): New.
(check_eol_endif_labels): New.
(check_eol): Call check_eol_1.
(do_else,do_endif): Call check_eol_endif_labels.
gcc/c-family/ChangeLog:
2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c.opt (Wbuiltin-macro-redefined,Wdeprecated,Wendif-labels,
Winvalid-pch,Wliteral-suffix,Wmissing-include-dirs,Wtrigraphs,
Wundef): Use CPP, Var and Init.
* c-opts.c (c_common_handle_option): Do not handle the above flags here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214735 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r-- | libcpp/directives.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c index 631557df8bb..173e609d1e0 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -213,16 +213,33 @@ skip_rest_of_line (cpp_reader *pfile) ; } -/* Ensure there are no stray tokens at the end of a directive. If - EXPAND is true, tokens macro-expanding to nothing are allowed. */ +/* Helper function for check_oel. */ + static void -check_eol (cpp_reader *pfile, bool expand) +check_eol_1 (cpp_reader *pfile, bool expand, int reason) { if (! SEEN_EOL () && (expand ? cpp_get_token (pfile) : _cpp_lex_token (pfile))->type != CPP_EOF) - cpp_error (pfile, CPP_DL_PEDWARN, "extra tokens at end of #%s directive", - pfile->directive->name); + cpp_pedwarning (pfile, reason, "extra tokens at end of #%s directive", + pfile->directive->name); +} + +/* Variant of check_eol used for Wendif-labels warnings. */ + +static void +check_eol_endif_labels (cpp_reader *pfile) +{ + check_eol_1 (pfile, false, CPP_W_ENDIF_LABELS); +} + +/* Ensure there are no stray tokens at the end of a directive. If + EXPAND is true, tokens macro-expanding to nothing are allowed. */ + +static void +check_eol (cpp_reader *pfile, bool expand) +{ + check_eol_1 (pfile, expand, CPP_W_NONE); } /* Ensure there are no stray tokens other than comments at the end of @@ -1990,7 +2007,7 @@ do_else (cpp_reader *pfile) /* Only check EOL if was not originally skipping. */ if (!ifs->was_skipping && CPP_OPTION (pfile, warn_endif_labels)) - check_eol (pfile, false); + check_eol_endif_labels (pfile); } } @@ -2051,7 +2068,7 @@ do_endif (cpp_reader *pfile) { /* Only check EOL if was not originally skipping. */ if (!ifs->was_skipping && CPP_OPTION (pfile, warn_endif_labels)) - check_eol (pfile, false); + check_eol_endif_labels (pfile); /* If potential control macro, we go back outside again. */ if (ifs->next == 0 && ifs->mi_cmacro) |