First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 17251
Product:  
Component:  
Status: RESOLVED
Resolution: INVALID
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Jakub Jelinek <jakub@gcc.gnu.org>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 17251 depends on: Show dependency tree
Show dependency graph
Bug 17251 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2004-08-31 12:55
struct S { int a; };
struct S *a, b;
int c, *d;

#define __hidden __attribute__((visibility ("hidden")))

struct S * __hidden foo0 (void) { return a; }
__hidden struct S *bar0 (void) { return a; }
struct S *baz0 (void) __hidden;
struct S *baz0 (void) { return a; }
int __hidden foo1 (void) { return c; }
__hidden int bar1 (void) { return c; }
int baz1 (void) __hidden;
int baz1 (void) { return c; }
struct S __hidden foo2 (void) { return b; }
__hidden struct S bar2 (void) { return b; }
struct S baz2 (void) __hidden;
struct S baz2 (void) { return b; }
int * __hidden foo3 (void) { return d; }
__hidden int *bar3 (void) { return d; }
int *baz3 (void) __hidden;
int *baz3 (void) { return d; }

is compiled differently with current CVS than it used to be before the
latest visibility changes in July/August.
Before, all functions were hidden, now foo0 and foo3 is not.
This is related to making visibility attribute apply not just to FUNCTION_DECLs,
but also to types.
The thing unclear to me is why the attribute located in between return type
and function name is sometimes applicable to the return type and sometimes
to the FUNCTION_DECL.

------- Comment #1 From Joseph S. Myers 2004-08-31 13:12 -------
Subject: Re:  New: visibility changes not backward compatible

On Tue, 31 Aug 2004, jakub at gcc dot gnu dot org wrote:

> The thing unclear to me is why the attribute located in between return type
> and function name is sometimes applicable to the return type and sometimes
> to the FUNCTION_DECL.

If the return type is a sequence of declaration specifiers, the attribute 
forms one of the declaration specifiers and applies to the declaration.  
If not - for example, a return type int *__hidden - then it applies to the 
return type, as per the syntax in extend.texi.

If you want to make an attribute applied to a function return type really 
apply to the function itself, check the flags argument to the handler and 
act appropriately.  If you want an attribute in the declaration specifiers 
to apply instead to the type given in those specifiers, look at the 
handling of vector_size attributes.


------- Comment #2 From Jakub Jelinek 2004-09-18 21:53 -------
*** Bug 17555 has been marked as a duplicate of this bug. ***

------- Comment #3 From Mark Mitchell 2004-09-22 05:09 -------
The compiler is adhering to the documented semantics for attributes.

First Last Prev Next    No search results available      Search page      Enter new bug