Skip to content

Duplicate macro definitions (LITTLE_ENDIAN and SPI_HAS_TRANSACTION) #581

Closed
@matthijskooijman

Description

@matthijskooijman

While compiling, I see duplicate definitions for these two macros. These usually just raise a warning, so it's not essential but probably nice to fix anyway. Below output is from an arduino-cli compile with -Werror set (from CI build where I want to try and build as clean as possible), so these are not normally errors, I believe.

IIRC this build used to work, so I suspect that at least the SPI duplicate definitions was introduced by the -API integration in 1.8.10. IIRC I've seen the LITTLE_ENDIAN warning before, so maybe that one was already there but just exposed (to this particular test sketch) by the recent 1.8.10 release.

I don't have a small sketch ready to reproduce this, but I suspect a simple sketch that just includes SPI.h would do.

Using board 'arduino_zero_edbg' from platform in folder: /home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10
Using core 'arduino' from platform in folder: /home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10
In file included from /home/runner/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
                 from /home/runner/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/samd.h:105,
                 from /home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10/cores/arduino/Arduino.h:34,
                 from /tmp/arduino-sketch-ABF9B50E94FCEC00D5773118A2D4EAA2/sketch/basicmac-otaa.ino.cpp:1:
/home/runner/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h:226:0: error: "LITTLE_ENDIAN" redefined [-Werror]
 #define LITTLE_ENDIAN          1
 
In file included from /home/runner/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/sys/types.h:67:0,
                 from /home/runner/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/stdio.h:61,
                 from /home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10/cores/arduino/api/Print.h:22,
                 from /home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10/cores/arduino/api/ArduinoAPI.h:31,
                 from /home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10/cores/arduino/Arduino.h:23,
                 from /tmp/arduino-sketch-ABF9B50E94FCEC00D5773118A2D4EAA2/sketch/basicmac-otaa.ino.cpp:1:
/home/runner/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/machine/endian.h:17:0: note: this is the location of the previous definition
 #define LITTLE_ENDIAN _LITTLE_ENDIAN
In file included from /home/runner/work/basicmac/basicmac/BasicMacArduino/examples/basicmac-otaa/basicmac-otaa.ino:34:0:
/home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10/libraries/SPI/SPI.h:31:0: error: "SPI_HAS_TRANSACTION" redefined [-Werror]
 #define SPI_HAS_TRANSACTION 1
 
In file included from /home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10/libraries/SPI/SPI.h:24:0,
                 from /home/runner/work/basicmac/basicmac/BasicMacArduino/examples/basicmac-otaa/basicmac-otaa.ino:34:
/home/runner/.arduino15/packages/arduino/hardware/samd/1.8.10/cores/arduino/api/HardwareSPI.h:25:0: note: this is the location of the previous definition
 #define SPI_HAS_TRANSACTION

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions