This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
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.
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.
*** Bug 17555 has been marked as a duplicate of this bug. ***
The compiler is adhering to the documented semantics for attributes.