This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Speed up genattrtab
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Richard Earnshaw <rearnsha at arm dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 25 Jan 2007 09:34:00 -0800
- Subject: Re: [PATCH] Speed up genattrtab
- References: <20061229125133.GE29911@devserv.devel.redhat.com> <45B8162A.3050901@codesourcery.com> <1169736474.30230.1.camel@pc960.cambridge.arm.com>
Richard Earnshaw wrote:
>>> + else
>>> + {
>>> + for (av = attr->first_value; av; av = av->next)
>>> + for (ie = av->first_insn; ie; ie = ie->next)
>>> + if (ie->def->insn_code == insn_code)
>>> + goto got_av;
>>> + }
>> Style nit: there should be no braces here, since there is a single
>> dependent statement.
>
> I disagree. The for loops contain an un-braced 'if' statement.
> Consider someone making the change to make the first else an 'else if'
> and then tacking on a further else clause...
I agree that the original version is more robust against future change.
In my own code, I always write "if (...) { ... }" even if there's only
one dependent statement. But, I thought that the GNU coding standards
left no room for interpretation in this case. If everyone's comfortable
with making an exception for this case, it's fine by me.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713