Message ID | 20160921105233.GI19950@redhat.com |
---|---|
State | New |
Headers | show |
On Wed, Sep 21, 2016 at 12:52:33PM +0200, Marek Polacek wrote: > Pointed out by Tobias. This looks like a missing fallthru marker. > > Ok? > > 2016-09-21 Marek Polacek <polacek@redhat.com> > > * gimple-ssa-sprintf.c (pass_sprintf_length::compute_format_length): > Add falls through comment. This is obvious. > diff --git gcc/gimple-ssa-sprintf.c gcc/gimple-ssa-sprintf.c > index 0afcf68..dddb026 100644 > --- gcc/gimple-ssa-sprintf.c > +++ gcc/gimple-ssa-sprintf.c > @@ -2260,6 +2260,7 @@ pass_sprintf_length::compute_format_length (const call_info &info, > case '\0': > --pf; > res->bounded = false; > + /* FALLTHRU */ > case '%': > spec.fmtfunc = format_percent; > break; > > Marek Jakub
On Wed, Sep 21, 2016 at 12:57:23PM +0200, Jakub Jelinek wrote: > On Wed, Sep 21, 2016 at 12:52:33PM +0200, Marek Polacek wrote: > > Pointed out by Tobias. This looks like a missing fallthru marker. > > > > Ok? > > > > 2016-09-21 Marek Polacek <polacek@redhat.com> > > > > * gimple-ssa-sprintf.c (pass_sprintf_length::compute_format_length): > > Add falls through comment. > > This is obvious. I wanted to give Martin a chance to comment, maybe it should've been a break, but I'll commit this now. Thanks. Marek
On Wed, Sep 21, 2016 at 01:07:20PM +0200, Marek Polacek wrote: > On Wed, Sep 21, 2016 at 12:57:23PM +0200, Jakub Jelinek wrote: > > On Wed, Sep 21, 2016 at 12:52:33PM +0200, Marek Polacek wrote: > > > Pointed out by Tobias. This looks like a missing fallthru marker. > > > > > > Ok? > > > > > > 2016-09-21 Marek Polacek <polacek@redhat.com> > > > > > > * gimple-ssa-sprintf.c (pass_sprintf_length::compute_format_length): > > > Add falls through comment. > > > > This is obvious. > > I wanted to give Martin a chance to comment, maybe it should've been > a break, but I'll commit this now. Thanks. Well, generally it isn't obvious, but in this case IMHO it is, in the light of the comment: /* Handle a sole '%' character the same as "%%" but since it's undefined prevent the result from being folded. */ case '\0': --pf; res->bounded = false; case '%': spec.fmtfunc = format_percent; break; so, what it does for "...%" is that it decreases the char pointer, so it acts almost like "...%%" - spec.specifier = *pf++; will be also '%' and pf afterwards will point after it. Jakub
On 09/21/2016 05:07 AM, Marek Polacek wrote: > On Wed, Sep 21, 2016 at 12:57:23PM +0200, Jakub Jelinek wrote: >> On Wed, Sep 21, 2016 at 12:52:33PM +0200, Marek Polacek wrote: >>> Pointed out by Tobias. This looks like a missing fallthru marker. >>> >>> Ok? >>> >>> 2016-09-21 Marek Polacek <polacek@redhat.com> >>> >>> * gimple-ssa-sprintf.c (pass_sprintf_length::compute_format_length): >>> Add falls through comment. >> >> This is obvious. > > I wanted to give Martin a chance to comment, maybe it should've been > a break, but I'll commit this now. Thanks. Yes, falling through is intentional here and should have probably been better documented. Thanks for taking care of it! Martin
diff --git gcc/gimple-ssa-sprintf.c gcc/gimple-ssa-sprintf.c index 0afcf68..dddb026 100644 --- gcc/gimple-ssa-sprintf.c +++ gcc/gimple-ssa-sprintf.c @@ -2260,6 +2260,7 @@ pass_sprintf_length::compute_format_length (const call_info &info, case '\0': --pf; res->bounded = false; + /* FALLTHRU */ case '%': spec.fmtfunc = format_percent; break;