From: Richard Guenther <richard.guenther@gmail.com>
To: Nathan Froyd <froydnj@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] use gcc_checking_assert instead of ENABLE_CHECKING/gcc_assert
Date: Thu, 21 Oct 2010 13:04:00 -0000 [thread overview]
Message-ID: <AANLkTi=SEBOfBDHq5t3WKB2bKNBZ_czjCnySPGGuP279@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=8fOOh8D6CWeacdFD+Q+pO46x_S2i_ZRv9zoRD@mail.gmail.com>
On Thu, Oct 21, 2010 at 1:45 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Thu, Oct 21, 2010 at 1:41 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
>> The patch below replaces a number of instances of:
>>
>> #ifdef ENABLE_CHECKING
>> gcc_assert (x)
>> #endif
>>
>> with the simpler:
>>
>> gcc_checking_assert (x)
>>
>> It's actually slightly more aggressive than that; if we had something
>> like:
>>
>> #ifdef ENABLE_CHECKING
>> for (...)
>> gcc_assert (x)
>> #endif
>>
>> I've gone ahead and replaced the gcc_assert there with ENABLE_CHECKING,
>> on the assumption that the compiler will be able to optimize out the
>> empty for loop. I've not replaced cases like:
>>
>> #ifdef ENABLE_CHECKING
>> {
>> thing x = func (...);
>>
>> gcc_assert (y);
>> }
>> #endif
>>
>> as the compiler might not be able to tell x is dead (func might have
>> side-effects). It's certainly possible that such blocks could be
>> modified once func is checked for constness of parameters and so forth;
>> I just did the brainless replacements.
>>
>> Tested on x86_64-unknown-linux-gnu. OK to commit?
>
> I think that #ifdefed loops are more easy to identify as enabled
> only in checkin mode. And I'd be not so sure that the iterators
> themselves are optimized if the loop is empty (they have calls
> to non-inline fns at least).
>
> The rest of the changes is ok.
Which means that the changes removing the #ifdef around loops
are not. Just in case that wasn't clear.
Richard.
next prev parent reply other threads:[~2010-10-21 11:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 11:59 Nathan Froyd
2010-10-21 12:51 ` Richard Guenther
2010-10-21 13:04 ` Richard Guenther [this message]
2010-10-21 16:53 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTi=SEBOfBDHq5t3WKB2bKNBZ_czjCnySPGGuP279@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=froydnj@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).