Add FALLTHRU to gimple-ssa-sprintf.c

Jakub Jelinek jakub@redhat.com
Wed Sep 21 11:47:00 GMT 2016


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



More information about the Gcc-patches mailing list