This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, Ada] Third Argument for pragma Machine_Attribute


Hello Peter,

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
> +0200
> +++ 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
 like

       __attribute__((altivec(vector__)))

 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.

 Olivier








 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]