Pedantic error on address-of main breaks libjava bootstrap

Aaron W. LaFramboise aaronavay62@aaronwl.com
Wed Jul 30 00:36:00 GMT 2008


When building libjava stacktrace.o on i386-pc-mingw32, bootstrap fails with:

> ./sysdep/backtrace.h: In function '_Unwind_Reason_Code fallback_backtrace(_Unwind_Reason_Code (*)(_Unwind_Context*, void*), _Jv_UnwindState*)':
> ./sysdep/backtrace.h:107: error: ISO C++ forbids taking address of function '::main'

On mingw32, backtrace.h is a symlink or copy to i386/backtrace.h, which 
is what has this problem:

>       if (ctx.meth_addr == (_Jv_uintptr_t)jv_runmain
>           || ctx.meth_addr == (_Jv_uintptr_t)_Jv_ThreadStart
>           || (ctx.meth_addr - (_Jv_uintptr_t)main) < 16)
>         break;

The code needs the address of main to stop the unwind.  What is the 
proper way to suppress this warning?  __extension__ doesn't seem to help.

(I'm actually not sure what has changed to cause this warning to start 
happening now.)



More information about the Gcc mailing list