public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Add FALLTHRU to gimple-ssa-sprintf.c
@ 2016-09-21 11:07 Marek Polacek
  2016-09-21 11:11 ` Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Polacek @ 2016-09-21 11:07 UTC (permalink / raw)
  To: GCC Patches, Martin Sebor

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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Add FALLTHRU to gimple-ssa-sprintf.c
  2016-09-21 11:07 Add FALLTHRU to gimple-ssa-sprintf.c Marek Polacek
@ 2016-09-21 11:11 ` Jakub Jelinek
  2016-09-21 11:30   ` Marek Polacek
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2016-09-21 11:11 UTC (permalink / raw)
  To: Marek Polacek; +Cc: GCC Patches, Martin Sebor

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Add FALLTHRU to gimple-ssa-sprintf.c
  2016-09-21 11:11 ` Jakub Jelinek
@ 2016-09-21 11:30   ` Marek Polacek
  2016-09-21 11:47     ` Jakub Jelinek
  2016-09-21 15:10     ` Martin Sebor
  0 siblings, 2 replies; 5+ messages in thread
From: Marek Polacek @ 2016-09-21 11:30 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches, Martin Sebor

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Add FALLTHRU to gimple-ssa-sprintf.c
  2016-09-21 11:30   ` Marek Polacek
@ 2016-09-21 11:47     ` Jakub Jelinek
  2016-09-21 15:10     ` Martin Sebor
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2016-09-21 11:47 UTC (permalink / raw)
  To: Marek Polacek; +Cc: GCC Patches, Martin Sebor

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Add FALLTHRU to gimple-ssa-sprintf.c
  2016-09-21 11:30   ` Marek Polacek
  2016-09-21 11:47     ` Jakub Jelinek
@ 2016-09-21 15:10     ` Martin Sebor
  1 sibling, 0 replies; 5+ messages in thread
From: Martin Sebor @ 2016-09-21 15:10 UTC (permalink / raw)
  To: Marek Polacek, Jakub Jelinek; +Cc: GCC Patches, Martin Sebor

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-21 15:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21 11:07 Add FALLTHRU to gimple-ssa-sprintf.c Marek Polacek
2016-09-21 11:11 ` Jakub Jelinek
2016-09-21 11:30   ` Marek Polacek
2016-09-21 11:47     ` Jakub Jelinek
2016-09-21 15:10     ` Martin Sebor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).