This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

RFA: What combination of tree flags to check for correct error message?


Hi,

I'm working on a patch to mirror the DECL_WEAK flag into the SYMBOL_REF to 
correctly control some optimizations.
The raw functionality is fine, but I would like to error out on the following 
situation:

extern void *__dso_handle;
 
int
atexit (void (*func) (void))
{
  return __cxa_atexit ((void (*) (void *)) func, ((void *)0) ,
                       &__dso_handle == ((void *)0)  ? ((void *)0)
			: __dso_handle);
}

extern void *__dso_handle __attribute__((weak));

For this I added a TREE_USED check to varasm.c:declare_weak() and call it 
from c-decl.c:duplicate_decls(). This works fine on the gcc-2_95-branch, but 
with current sources I even get an error on:

extern void *__dso_handle;
extern void *__dso_handle __attribute__((weak));
 
int
atexit (void (*func) (void))
{
  return __cxa_atexit ((void (*) (void *)) func, ((void *)0) ,
                       &__dso_handle == ((void *)0)  ? ((void *)0)
			: __dso_handle);
}


So it seems TREE_USED is the wrong check, what else can I use?

Basically the same happens for corresponding uses of #pragma weak, though I 
have no idea yet how to search for the symbolname passsed to #pragma in the 
tree structure and then error out...

Franz.


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