From 70f6d5e19bb7c0eed9f3fc028632405b5c166676 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 12 Oct 2016 01:19:06 +0200 Subject: gcc/ * common.opt (Wimplicit-fallthrough) Turn into alias to -Wimplicit-fallthrough=3. Remove EnabledBy. (Wimplicit-fallthrough=): New option. * gimplify.c (warn_implicit_fallthrough_r): Use OPT_Wimplicit_fallthrough_ instead of OPT_Wimplicit_fallthrough. * doc/invoke.texi (-Wimplicit-fallthrough): Document as alias to -Wimplicit-fallthrough=3. (-Wimplicit-fallthrough=): Document. gcc/c-family/ * c.opt (Wextra): Add as C/C++/ObjC/ObjC++ option. (Wimplicit-fallthrough=): Enable for these languages by -Wextra. * c-opts.c (sanitize_cpp_opts): Initialize cpp_opts->cpp_warn_implicit_fallthrough. gcc/testsuite/ * c-c++-common/Wimplicit-fallthrough-25.c: New test. * c-c++-common/Wimplicit-fallthrough-26.c: New test. * c-c++-common/Wimplicit-fallthrough-27.c: New test. * c-c++-common/Wimplicit-fallthrough-28.c: New test. * c-c++-common/Wimplicit-fallthrough-29.c: New test. * c-c++-common/Wimplicit-fallthrough-30.c: New test. * c-c++-common/Wimplicit-fallthrough-31.c: New test. * c-c++-common/Wimplicit-fallthrough-32.c: New test. * c-c++-common/Wimplicit-fallthrough-33.c: New test. libcpp/ * include/cpplib.h (struct cpp_options): Add cpp_warn_implicit_fallthrough. * init.c (cpp_create_reader): Initialize it to 0. * lex.c (fallthrough_comment_p): Handle different cpp_warn_implicit_fallthrough levels. Whitespace fixes. From-SVN: r241013 --- gcc/c-family/c-opts.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/c-family/c-opts.c') diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index c5a699d..da62b55 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1279,6 +1279,11 @@ sanitize_cpp_opts (void) if (flag_working_directory == -1) flag_working_directory = (debug_info_level != DINFO_LEVEL_NONE); + if (warn_implicit_fallthrough < 5) + cpp_opts->cpp_warn_implicit_fallthrough = warn_implicit_fallthrough; + else + cpp_opts->cpp_warn_implicit_fallthrough = 0; + if (cpp_opts->directives_only) { if (cpp_warn_unused_macros) -- cgit v1.1