This is the mail archive of the
mailing list for the GCC project.
Re: [patch, Ada] Third Argument for pragma Machine_Attribute
- From: Olivier Hainque <hainque at adacore dot com>
- To: Peter Schildmann <peter at schildmann dot info>
- Cc: gcc-patches at gcc dot gnu dot org, hainque at adacore dot com
- Date: Tue, 10 Jul 2007 13:06:01 +0200
- Subject: Re: [patch, Ada] Third Argument for pragma Machine_Attribute
- References: <email@example.com>
Thanks for your suggestion.
Peter Schildmann wrote:
> The implementation defined pragma Machine_Attribute has an
> undocumented third argument 'Info' (see sem_prag.adb):
The documentation is indeed incomplete.
> For example
> procedure Handler;
> pragma Machine_Attribute (Handler, "interrupt", "FIQ");
> procedure Handler is ...
> is equivalent to
> void handler (void) __attribute__ ((interrupt ("FIQ")));
> The following small patch makes the 'Info' argument work:
> --- gcc-4.3-20070615-orig/gcc/ada/decl.c 2007-06-10 20:36:40.000000000
> +++ gcc-4.3-20070615/gcc/ada/decl.c 2007-07-07 19:41:06.000000000 +0200
> @@ -4870,11 +4870,8 @@
> if (Present (Next (Next (First (gnat_assoc))))
> && (Nkind (Expression (Next (Next (First (gnat_assoc)))))
> == N_String_Literal))
> - gnu_arg1 = get_identifier (TREE_STRING_POINTER
> - (gnat_to_gnu
> - (Expression
> - (Next (Next
> - (First (gnat_assoc)))))));
> + gnu_arg1 = gnat_to_gnu (Expression
> + (Next (Next (First (gnat_assoc)))));
> switch (Get_Pragma_Id (Chars (gnat_temp)))
Humm, this is unfortunately not totally appropriate. The current
processing of the third argument is as intended, for other attributes
We have no clean way in place to distinguish between the two kinds of
expectations, which is a limitation of both our current implementation
and attribute definition.
I'm not sure about the best way to address this.