const char * __attribute__ ((visibility ("hidden"))) foo(void)
{ return "foo"; }

const char __attribute__ ((visibility ("hidden"))) * bar(void)
{ return "bar"; }


Compile this with:

gcc -fPIC -Wl,--version-script=foobar.map -Wl,--strip-all -shared -o foobar.so
foobar.c

foo() now issues the warning "warning: ‘visibility’ attribute ignored on
non-class types" and the visibility is not applied. Placing the attribute at
that position is very unintuitive and the warning isn't particular helpful.
Also I found nothing in the documentation about this.


-- 
           Summary: __attribute__ ((visibility)) weird with functions
                    returning pointers
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eike at sf-mail dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41942

Reply via email to