On Fri, 2009-06-26 at 07:44 -0700, Ian Lance Taylor wrote: > > Next error is related to enum in for loop: > > > > g++ -c -g -g -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -fno-common -DHAVE_CONFIG_H -I.. -I. -Iada -I../../gcc/gcc -I../../gcc/gcc/ada -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I/opt/cfarm/gmp-4.2.4//include -I/opt/cfarm/mpfr-2.4.1//include -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/bid -I../libdecnumber ../../gcc/gcc/ada/gcc-interface/misc.c -o ada/misc.o > > ../../gcc/gcc/ada/gcc-interface/misc.c: In function 'void enumerate_modes(void (*)(int, int, int, int, int, int, unsigned int))': > > ../../gcc/gcc/ada/gcc-interface/misc.c:734: error: invalid conversion from 'int' to 'machine_mode' > > ../../gcc/gcc/ada/gcc-interface/misc.c:734: error: no 'operator++(int)' declared for postfix '++', trying prefix operator instead > > ../../gcc/gcc/ada/gcc-interface/misc.c:734: error: no match for 'operator++' in '++i' > > > In the C/C++ common subset you can not write loops in which the index > variable has enum type. Loops like these must be written as something > along the lines of > > int iloop; > > for (iloop = 0; iloop < NUM_MACHINE_MODES; iloop++) > { > enum machine_mode i = (enum machine_mode) iloop; > ... > } > > > > Another kind of error on struct declarations: > > > > << > > g++ -c -g -g -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -fno-common -DHAVE_CONFIG_H -I.. -I. -Iada -I../../gcc/gcc -I../../gcc/gcc/ada -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I/opt/cfarm/gmp-4.2.4//include -I/opt/cfarm/mpfr-2.4.1//include -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/bid -I../libdecnumber ../../gcc/gcc/ada/gcc-interface/trans.c -o ada/trans.o > > ../../gcc/gcc/ada/gcc-interface/trans.c:111: error: conflicting declaration 'typedef struct parm_attr* parm_attr' > > ../../gcc/gcc/ada/gcc-interface/trans.c:103: error: 'struct parm_attr' has a previous declaration as 'struct parm_attr' > > In C++, if a typedef and a struct tag have the same name, they must name > the same type. I've been addressing these issues by consistently > renaming the struct with a "_d" suffix. See, e.g., struct > alias_set_entry_d and alias_set_entry in alias.c. > > > > Last error is on void* arithmetic: > > > > << > > g++ -c -g -g -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -fno-common -Wno-error -DHAVE_CONFIG_H -I. -Iada -I../../gcc/gcc -I../../gcc/gcc/ada -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I/opt/cfarm/gmp-4.2.4//include -I/opt/cfarm/mpfr-2.4.1//include -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/bid -I../libdecnumber \ > > -I. -Iada -I../../gcc/gcc -I../../gcc/gcc/ada -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I/opt/cfarm/gmp-4.2.4//include -I/opt/cfarm/mpfr-2.4.1//include -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/bid -I../libdecnumber -fno-omit-frame-pointer ../../gcc/gcc/ada/tracebak.c -o ada/tracebak.o > > In file included from ../../gcc/gcc/ada/tracebak.c:396: > > ../../gcc/gcc/ada/tb-gcc.c: In function '_Unwind_Reason_Code trace_callback(_Unwind_Context*, uw_data_t*)': > > ../../gcc/gcc/ada/tb-gcc.c:86: error: pointer of type 'void *' used in arithmetic > > Here pc has type "void *", but the code computes "pc + PC_ADJUST". This > is not permitted in C either, and is actually a gcc extension. The fix > is to change pc to "char *". Thanks for the advices, there were no other compile issue. As suggested by Arnaud I will test my current patch (attached below as patch-ada-gcc-in-cxx-v2.txt) on trunk (I checked and it applies cleanly) and submit it on gcc-patches with a proper ChangeLog for trunk. Next issue is that gnat1 link fails on many missing symbols: ada/b_gnat1.o: In function `adainit()': ada/b_gnat1.c:287: undefined reference to `system__soft_links___elabb()' ada/b_gnat1.c:291: undefined reference to `system__secondary_stack___elabb()' .... ada/b_gnat1.c:89: undefined reference to `system__standard_library__adafinal()' ada/b_gnat1.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' ada/adadecode.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' ... (full log attached as b.log.gz) I suspect some Makefile+gnatbind work specific to this branch is needed to go past this issue but I've no idea on what is the exact source of the issue and how to fix it, I've no experience in C++/Ada code mixing. Help welcomed :). Sincerely, Laurent