This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: alias symbol changes for gcc4


That is all reasonable enough.  But, I get:

SYS_libc.c:7: warning: array '__EI__libc_intl_domainname' assumed to have one element

from gcc 4 though not from 3.4.  It does:

	const char _libc_intl_domainname[] = "libc";
	libc_hidden_data_def (_libc_intl_domainname)

The warning goes away if that's 

	const char _libc_intl_domainname[sizeof "libc"] = "libc";
	libc_hidden_data_def (_libc_intl_domainname)

This is reduced in the second part of the following example.  I really
don't see what's different about that from the first case (foo).  In the
case that generates the warning, the __typeof type seems to be the
incomplete type const char[], not the complete type implicitly created by
the initializer's size in the definition.  The "foo" example below shows
that __typeof(foo) is the array type with size set by the initializer,
as that's the size that bar and fred get.  It seems like a bug that
__typeof (_libc_intl_domainname) should not be const char[5] and so
__EI__libc_intl_domainname should have that same type.


extern char foo[];
extern __typeof(foo) foo asm("foonotfoo") __attribute__((visibility ("hidden")));
char foo[] = "abcdef";
__typeof(foo) bar = {};
int barsz = sizeof bar;
extern __typeof(foo) fred;
int fredsz = sizeof fred;

extern const char _libc_intl_domainname[];
extern __typeof (_libc_intl_domainname) _libc_intl_domainname __asm__ ("" "__GI__libc_intl_domainname") __attribute__ ((visibility ("hidden")));

const char _libc_intl_domainname[] = "libc";
extern __typeof (_libc_intl_domainname) __EI__libc_intl_domainname __asm__("" "_libc_intl_domainname"); extern __typeof (_libc_intl_domainname) __EI__libc_intl_domainname __attribute__((alias ("" "__GI__libc_intl_domainname")));

int after = sizeof _libc_intl_domainname;
//int ei = sizeof __EI__libc_intl_domainname; // gives error



Thanks,
Roland


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