This is the mail archive of the
mailing list for the GCC project.
Re: [PING][RFC] Assertions as optimization hints
- From: Vincent Lefevre <vincent+gcc at vinc17 dot org>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 2 Dec 2016 12:38:51 +0100
- Subject: Re: [PING][RFC] Assertions as optimization hints
- Authentication-results: sourceware.org; auth=none
- References: <CAJOtW+48=FfefSgyPakMmFzaHfCqNv0CpXY-1p3gva4ShuqgjA@mail.gmail.com> <CAFiYyc2oi9brPTnTBGNE8n4T5OOFSxOCF3oeFo=qcT2zMzo6Sg@mail.gmail.com> <CAJOtW+5jLHCZ_JQ4NikDaO1ntBvzzSgY95Mqw3nb_rng=JnD_g@mail.gmail.com> <20161128160349.GA4013@cventin.lip.ens-lyon.fr> <CAJOtW+4p8a_=2Ut-L1Hnq-sdWk-zZLkSmcsFyCadMpmeFOMMMg@mail.gmail.com>
On 2016-11-28 18:49:55 +0000, Yuri Gribov wrote:
> On Mon, Nov 28, 2016 at 4:03 PM, Vincent Lefevre <email@example.com> wrote:
> > Concerning the "per-project decision", I'm not sure that's a good
> > idea: as soon as one includes a header file, __ASSUME_ASSERTS__
> > could potentially break code.
> Sorry, not sure I understood. __ASSUME_ASSERTS__ is supplied via
> cmdline when compiling project's shared libraries and executables to
> treat assertions as hints (effectively similar to MS __assume
> directives). It does not propagate to project's public header files.
What I was thinking of is that header files can contain calls to
assert(), e.g. via macros or inlined function (or classes in C++). For
instance, I can see the use of assert() in the following header files:
So, if the behavior of assert() is globally changed for a project that
uses ncursesw, this is bad as this would affect ncursesw too. Now, if
__ASSUME_ASSERTS__ does not propagate to "external" header files,
that's fine. But I wonder how this is implemented, i.e. to know which
header files should be affected which of them shouldn't, and how macro
definitions are affected, so that macros are expanded with the
expected behavior. This doesn't seem to be simple.
Vincent Lefèvre <firstname.lastname@example.org> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)