This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Pedantic error on address-of main breaks libjava bootstrap
2008/7/30 Aaron W. LaFramboise <aaronavay62@aaronwl.com>:
> Andrew Haley wrote:
>>
>> Aaron W. LaFramboise wrote:
>>>
>>> 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.
>>>
[snip]
> Sorry, I noticed now that there isn't actually a -pedantic anywhere in
> there. Removing -Wextra and -Wall have no effect, so this is obviously a
> default error. Adding -fpermissive turns the error into a warning.
* You don't need -pedantic to get a pedwarn. -pedantic enables all
pedwarns but some of them are enabled even without -pedantic.
* -fdiagnostics-show-option should tell you what is generating that
diagnostic (but only if it can be disabled). If you are using trunk,
it should show [-fpermissive].
* That is a "permissive error" or permerror for short. These are
errors that can be downgraded to warnings using -fpermissive.
* It would be interesting to know when this started to show up because
as far as I see, it was a default pedwarn before, so nothing should
have changed. What revision of GCC are you using to compile? In which
revision did it work?
* permerrors and default pedwarns are not affected by __extension__.
Nonetheless, is there an __extension__ in that code?
* Is i386/backtrace.h a system header?
Cheers,
Manuel.