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][libcpp] New deferred output pragma


With GCC4.4 and compiling the following test case we get

gcc -O2 test.c

int
bar (int *array, int offset, int size)
{
  int access (int *array, int index) __attribute__ ((far));
  
  int
  access (int *array, int index)
  { return array[index + offset]; }
  
  for (int i = 0; i < size; i++)
    access (array, i);
}


test.c: In function 'bar':
test.c:3: warning: 'far' attribute directive ignored
test.c:4: error: static declaration of 'access' follows non-static
declaration
test.c:3: note: previous declaration of 'access' was here

The GCC documentation says declaring a nested function static is
erroneous
which is very confusing.


Rahul


-----Original Message-----
From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
Bonzini
Sent: 13 April 2010 18:14
To: Dave Edwards
Cc: Chris Lattner; David Stubbs; Basile Starynkevitch;
tromey@redhat.com; gcc-patches@gcc.gnu.org; sdkteam-gnu
Subject: Re: [PATCH][libcpp] New deferred output pragma

On 04/13/2010 07:06 PM, Dave Edwards wrote:
>> Adding a generally useful feature like attributes-on-nested-functions
>> seems a lot more interesting than adding a special preprocessor
>> extension like this.
>
> That may well be the case, but the manner in which gcc barfed when
> trying to use attributes on nested functions led us to believe that
> their implementation isn't necessarily robust or well exercised
anyway.

In the middle-end, nested functions are definitely well supported (and 
relied upon by the Ada compiler).

Can you expand further on the issues you encountered?

Paolo


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