This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] make a bunch of attribute handlers globally available
- From: Andrew Haley <aph at redhat dot com>
- To: Olivier Hainque <hainque at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 16 Jun 2009 15:17:17 +0100
- Subject: Re: [PATCH] make a bunch of attribute handlers globally available
- References: <20090616140501.GA12242@cardhu.act-europe.fr>
Olivier Hainque wrote:
> Hello,
>
> A number of GCC attribute handlers today shared by the C family of languages
> are needed by at least Ada and possibly others, e.g. for builtins support.
>
> For Ada, we so far dealt with this by copy-paste operations, not exactly
> proper software engineering practice. We'd like to improve the situation, all
> the more that we now have needs for the vector_size attribute as well, and
> maybe others in the future.
>
> This message/patch is a suggestion to address the issue in a simple
> manner, by moving the relevant attribute handlers in a dedicated
> source file common to all languages (attrib-handlers.c), together with
> the definition of a "global_attribute_table" to collect them.
>
> This will add a few functions to compilers that possibly don't need them, but
> the amount of code is small, there is no other penalty, it really looks
> preferrable to the copy/paste alternative, and it could well become handy at
> some point anyway. It seems to me that alternate schemes to allow any
> combination of choices by any combination of languages would rapidly grow too
> complex for the final gain.
>
> Moving the "nonnull" attribute processing to a common place conflicts with a
> dummy entry for it in the current java front-end, introduced in revision
> 112574 together with other changes for PR java/26858.
>
> The purpose of this specific piece wrt the bug behavior is unclear to
> me - maybe the author (cc'ed) could enlighten.
If I recall correctly this was the only way to define the attribute:
without this there was no way to use it. I can't see any reason why a
common "nonnull" attribute shouldn't be used instead.
> Part of the patch suggested here removes the java specific attribute table
> altogether, without effect on the testresults in my configuration
> (bootstrap+check for languages=all,ada on x86_64-suse-linux). The PR dedicated
> libjava test is exercised and passes.
OK.
Andrew.