Pedantic error on address-of main breaks libjava bootstrap

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


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.
>>
>> (I'm actually not sure what has changed to cause this warning to start
>> happening now.)
> 
> Please send the command line that led to this.

Here's the complete command line.

/mingw/src/gccf/./gcc/xgcc -shared-libgcc -B/mingw/src/gccf/./gcc 
-nostdinc++ -L/mingw/src/gccf/i386-pc-mingw32/libstdc++-v3/src 
-L/mingw/src/gccf/i386-pc-mingw32/libstdc++-v3/src/.libs 
-L/mingw/src/gccf/i386-pc-mingw32/winsup/mingw 
-L/mingw/src/gccf/i386-pc-mingw32/winsup/w32api/lib -isystem 
/mingw/src/svn/winsup/mingw/include -isystem 
/mingw/src/svn/winsup/w32api/include -B/mingw/i386-pc-mingw32/bin/ 
-B/mingw/i386-pc-mingw32/lib/ -isystem /mingw/i386-pc-mingw32/include 
-isystem /mingw/i386-pc-mingw32/sys-include -DHAVE_CONFIG_H -I. 
-I../../../svn/libjava -I./include -I./gcj -I../../../svn/libjava 
-Iinclude -I../../../svn/libjava/include 
-I../../../svn/libjava/classpath/include -Iclasspath/include 
-I../../../svn/libjava/classpath/native/fdlibm 
-I../../../svn/libjava/../boehm-gc/include -I../boehm-gc/include 
-I../../../svn/libjava/libltdl -I../../../svn/libjava/libltdl 
-I../../../svn/libjava/.././libjava/../gcc 
-I../../../svn/libjava/../zlib -I../../../svn/libjava/../libffi/include 
-I../libffi/include -fno-rtti -fnon-call-exceptions -mthreads 
-fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 
-ffloat-store -fomit-frame-pointer -Usun -fno-omit-frame-pointer -Wextra 
-Wall -D_GNU_SOURCE -DPREFIX=\"/mingw\" 
-DTOOLEXECLIBDIR=\"/mingw/lib/gcc/i386-pc-mingw32/4.4.0\" 
-DJAVA_HOME=\"/mingw\" 
-DBOOT_CLASS_PATH=\"/mingw/share/java/libgcj-4.4.0.jar\" 
-DJAVA_EXT_DIRS=\"/mingw/share/java/ext\" 
-DGCJ_ENDORSED_DIRS=\"/mingw/share/java/gcj-endorsed\" 
-DGCJ_VERSIONED_LIBDIR=\"/mingw/lib/gcj-4.4.0-10\" 
"-DPATH_SEPARATOR=\";\"" -DECJ_JAR_FILE=\"\" 
-DLIBGCJ_DEFAULT_DATABASE=\"/mingw/lib/gcj-4.4.0-10/classmap.db\" 
-DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.4.0-10/classmap.db\" -g -O2 
-MT stacktrace.lo -MD -MP -MF .deps/stacktrace.Tpo -c 
../../../svn/libjava/stacktrace.cc  -DDLL_EXPORT -DPIC -o .libs/stacktrace.o

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.

What do you think?



More information about the Gcc mailing list