Subpatch in Subpatch fails to compile


#1

I get a compile error when I try to go live with a patch that contains a subpatch, which itself references a subpatch (see example further down):

arm-none-eabi-g++ -nostdlib -fno-exceptions -fno-rtti -mcpu=cortex-m4 -O3 -fomit-frame-pointer -falign-functions=16 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wunused-parameter -DCORTEX_USE_FPU=TRUE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB -std=c++11 -DARM_MATH_CM4 -D__FPU_PRESENT -H -IC:\PROGRA~2\Axoloti\app/CMSIS/Include -IC:\PROGRA~2\Axoloti\app/chibios/os/ports/common/ARMCMx/CMSIS/include -IC:\PROGRA~2\Axoloti\app/chibios/os/ports/common/ARMCMx -IC:\PROGRA~2\Axoloti\app/chibios/os/ports/GCC/ARMCMx -IC:\PROGRA~2\Axoloti\app/chibios/os/ports/GCC/ARMCMx/STM32F4xx -IC:\PROGRA~2\Axoloti\app/chibios/os/kernel/include -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/include -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32F4xx -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/GPIOv2 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/I2Cv1 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/OTGv1 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/RTCv2 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/SPIv1 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/TIMv1 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/USARTv1 -IC:\PROGRA~2\Axoloti\app/chibios/boards/ST_STM32F4_DISCOVERY -IC:\PROGRA~2\Axoloti\app/chibios/ext/fatfs/src -I. -IC:\PROGRA~2\Axoloti\app/chibios -Winvalid-pch -MD -MP --include C:\Users\SCHRUM~1\DOCUME~1\axoloti/build/xpatch.h -c C:\Users\SCHRUM~1\DOCUME~1\axoloti/build/xpatch.cpp -o C:\Users\SCHRUM~1\DOCUME~1\axoloti/build/xpatch.o
! C:\Users\SCHRUM~1\DOCUME~1\axoloti/build/xpatch.h.gch
C:\Users\SCHRUM~1\DOCUME~1\axoloti/build/xpatch.cpp:116:8: error: 'rootc::instanceobj__1::instanceobj__1' has the same name as the class in which it is declared
;class instanceobj__1{
^
C:\Users\SCHRUM~1\DOCUME~1\axoloti/build/xpatch.cpp:565:21: error: field 'instanceobj__1_i' has incomplete type 'rootc::instanceobj__1'
instanceobj__1 instanceobj__1_i;
^
make: *** [C:\Users\SCHRUM~1\DOCUME~1\axoloti/build/xpatch.bin] Error 1
shell task failed, exit value: 1
Compiling patch failed ( S:\Joerg\DIY\Axoloti\Effekte\NonWorking.axp )

I've attached a simple example:

  • Subpatch A.axs is self-contained and has no references to any subpatches
  • Subpatch B.axs references subpatch A.axs
  • Patch Working.axp references A.axs --> all fine
  • Patch NonWorking.axp references B.axs --> see above compile error

Does anyone have an idea for a workaround?

I'd prefer not to use "inline subpatches", as I would like to create my patches in a modular manner and reuse as many subpatches as possible.

Thanks for your help! :smiley:

NonWorking.axp (633 Bytes)
Working.axp (386 Bytes)
B.axs (962 Bytes)
A.axs (781 Bytes)


#2

I was not aware of this, thanks for the clear report.
The error comes form the object instance name, the subpatch object instance name is "obj_1" and the subpatch contains an object with instance name "obj_1". Renaming one of these should work around this error.


#3

That solved it -- subpatch name clash was the source of evil.

Thanks for the quick reply :smile: