This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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: libc_hidden_proto vs __attribute__


On Sun, Aug 04, 2002 at 12:09:06AM -0400, Roland McGrath wrote:
> It appears to be `_exit' in particular that is loused up.
> Probably because GCC thinks it knows about _exit before it's told.
> 
> This test gets the warning, but with -D_exit=loser, it does not.
> 
> 
> extern void _exit (int __status) __attribute__ ((__noreturn__));
> 
> __typeof (_exit) __GI__exit; __typeof (_exit) _exit __asm__ (""
> "__GI__exit") __attribute__ ((visibility ("hidden")));
> 
> extern void bar (void) __attribute__ ((noreturn));
> void
> bar (void)
> {
>   _exit (0);
> }

extern void _exit (int __status) __attribute__ ((__noreturn__));

__typeof (_exit) __GI__exit; __typeof (_exit) _exit __asm__ ("" "__GI__exit") __attribute__ ((visibility ("hidden")));

extern void _exit (int __status) __attribute__ ((__noreturn__));

extern void bar (void) __attribute__ ((noreturn));
void
bar (void)
{
  _exit (0);
}

works though - looks like some bad interaction between gcc builtins attributes and __asm,
I'll have a look.

BTW: As I haven't yet done anything about gcc builtins and redirection, we should perhaps
not convert all the builtins before that's done (particularly about:

sprintf, scanf, fscanf, sscanf, vprintf, vfprintf, vsprintf, strftime,
snprintf, vsnprintf, vscanf, vfscanf, vsscanf, gettext, dgettext, dcgettext,
alloca, abs, labs, fabs, fabsf, fabsl, llabs, imaxabs, conj, conjf, conjl,
creal, crealf, creall, cimag, cimagf, cimagl, bzero, bcmp, ffs, index,
rindex, memcpy, memcmp, memset, strcat, strncat, strcpy, strncpy, strcmp,
strncmp, strlen, strstr, strpbrk, strspn, strcspn, strchr, strrchr, sqrt,
sin, cos, sqrtf, sinf, cosf, sqrtl, sinl, cosl, setjmp, longjmp, trap,
prefetch, putchar, puts, printf, fputc, fputs, fwrite, fprintf,
putchar_unlocked, puts_unlocked, printf_unlocked, fputc_unlocked,
fputs_unlocked, fwrite_unlocked, fprintf_unlocked, isgreater,
isgreaterequal, isless, islessequal, islessgreater, isunordered, abort,
exit, _exit, _Exit

).

 	Jakub


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