On 04/05/2018 03:00 PM, Jakub Jelinek wrote: > On Thu, Apr 05, 2018 at 02:51:22PM +0200, Martin Liška wrote: >> On 04/04/2018 09:31 PM, Marek Polacek wrote: >>> On Tue, Apr 03, 2018 at 02:29:37PM +0200, Martin Liška wrote: >>>> Hi. >>>> >>>> This helps the warning with --save-temps. Doing that one needs to preserve >>>> comments >>>> in preprocessed source file. >>> >>> Do we really want to only use -C when -Wimplicit-fallthrough is in effect? >>> I >>> mean, shouldn't we always use -C when -save-temps? >> >> Why not, Jakub what do you think? Note that it was originally Jakub's idea >> to do that. > > I'd prefer to do that only when we actually care about the comments, it is a > behavior change in any case, and might be undesirable to some people. > > Note that we do not care about the comments if -Wimplicit-fallthrough=0 > or -Wimplicit-fallthrough=5, but do care for: > -Wimplicit-fallthrough > -Wimplicit-fallthrough=1 > -Wimplicit-fallthrough=2 > -Wimplicit-fallthrough=3 > -Wimplicit-fallthrough=4 > -Wextra > -W
Or you can trigger the warning via -Werror=implicit-fallthrough* which would complicate the option matching. > (unless -Wno-implicit-fallthrough). So, it would be desirable to: > 1) swap the order, put save-temps to the outer level > 2) use > {Wimplicit-fallthrough*:{!Wimplicit-fallthrough=0:{!Wimplicit-fallthrough=5:...}}} > 3) verify (including adding testcases) that it doesn't emit comments for the > =0, =5 or -W -Wno-implicit-fallthrough cases, but does for -W etc. That would also complicate the exclusion of negative forms. Sigh. I'm thinking if really worth it.. Martin > > Jakub >