Skip to content

Commit

Permalink
Merge #19634
Browse files Browse the repository at this point in the history
19634: tree-wide: mixed box of compilation fixes with clang r=benpicco a=maribu

### Contribution description

As the title says: This should increase the number of apps being able to build with clang quite a bit.


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
  • Loading branch information
3 people authored Jul 18, 2023
2 parents 39b9e34 + 52cf2b4 commit ceaf6bd
Show file tree
Hide file tree
Showing 355 changed files with 1,566 additions and 917 deletions.
3 changes: 1 addition & 2 deletions .murdock
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ esac

# temporarily disabling llvm builds until https://github.com/RIOT-OS/RIOT/pull/15595
# is in
#: ${TEST_BOARDS_LLVM_COMPILE:="iotlab-m3 native nrf52dk mulle nucleo-f401re samr21-xpro slstk3402a"}
: ${TEST_BOARDS_LLVM_COMPILE:=""}
: ${TEST_BOARDS_LLVM_COMPILE:="iotlab-m3 native nrf52dk mulle nucleo-f401re samr21-xpro slstk3402a"}

: ${TEST_KCONFIG_BOARDS_AVAILABLE:="
adafruit-itsybitsy-m4
Expand Down
20 changes: 12 additions & 8 deletions cpu/nrf5x_common/periph/gpio_ll_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ struct isr_ctx {
};
static struct isr_ctx isr_ctx[GPIOTE_CHAN_NUMOF];

static uint8_t get_portsel(uint32_t conf)
{
#ifdef GPIOTE_CONFIG_PORT_Msk
return (conf & GPIOTE_CONFIG_PORT_Msk) >> GPIOTE_CONFIG_PORT_Pos;
#else
(void)conf;
return 0;
#endif
}

/**
* @brief get the GPIOTE channel used to monitor the given pin
*
Expand All @@ -74,14 +84,8 @@ static unsigned get_channel_of_pin(uint8_t port_num, uint8_t pin)
uint32_t mode = (conf & GPIOTE_CONFIG_MODE_Msk) >> GPIOTE_CONFIG_MODE_Pos;
if (mode == GPIOTE_CONFIG_MODE_Event) {
uint8_t pinsel = (conf & GPIOTE_CONFIG_PSEL_Msk) >> GPIOTE_CONFIG_PSEL_Pos;
#ifdef GPIOTE_CONFIG_PORT_Msk
uint8_t portsel = (conf & GPIOTE_CONFIG_PORT_Msk) >> GPIOTE_CONFIG_PORT_Pos;
#endif
if ((pinsel == pin)
#ifdef GPIOTE_CONFIG_PORT_Msk
&& (portsel == port_num)
#endif
) {
uint8_t portsel = get_portsel(conf);
if ((pinsel == pin) && (portsel == port_num)) {
return i;
}
}
Expand Down
8 changes: 8 additions & 0 deletions cpu/sam0_common/include/vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ all `source` folders are removed.
Be aware that if you want to make changes to any file in this tree that the
changes will be lost when a new ASF release is going to be used.

### C++ compatibility (with LLVM)

Many of the header files where generated with an outdated version of SVDConv
that adds the `__I` qualifier to anonymous bit fields, which `clang++` won't
compile. Run the script `fix_cxx_compat.sh` in this directory whenever you
add or update vendor header filers until Microchips starts using a fixed version
of SVDConv.

### sam0.h

A SAM based CPU should include `sam0.h` in this directory, which will
Expand Down
10 changes: 10 additions & 0 deletions cpu/sam0_common/include/vendor/fix_cxx_compat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# This script removes type qualifiers from anonymous padding fields in bit
# fields for compatibility with clang++.

offenders="$(grep -Erl '__I [u]*int[0-9]*_t[ \t]*:[0-9]*;')"

for file in $offenders; do
sed -i "$file" -e 's/__I \([u]*int[0-9]*_t[\t ]*:[0-9]*;\)/\1 /g'
done
8 changes: 4 additions & 4 deletions cpu/sam0_common/include/vendor/samd10/include/component/ac.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,15 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
struct {
__I uint8_t COMP0:1; /*!< bit: 0 Comparator 0 */
__I uint8_t COMP1:1; /*!< bit: 1 Comparator 1 */
__I uint8_t :2; /*!< bit: 2.. 3 Reserved */
uint8_t :2; /*!< bit: 2.. 3 Reserved */
__I uint8_t WIN0:1; /*!< bit: 4 Window 0 */
__I uint8_t :3; /*!< bit: 5.. 7 Reserved */
uint8_t :3; /*!< bit: 5.. 7 Reserved */
} bit; /*!< Structure used for bit access */
struct {
__I uint8_t COMP:2; /*!< bit: 0.. 1 Comparator x */
__I uint8_t :2; /*!< bit: 2.. 3 Reserved */
uint8_t :2; /*!< bit: 2.. 3 Reserved */
__I uint8_t WIN:1; /*!< bit: 4 Window x */
__I uint8_t :3; /*!< bit: 5.. 7 Reserved */
uint8_t :3; /*!< bit: 5.. 7 Reserved */
} vec; /*!< Structure used for vec access */
uint8_t reg; /*!< Type used for register access */
} AC_INTFLAG_Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint8_t OVERRUN:1; /*!< bit: 1 Overrun */
__I uint8_t WINMON:1; /*!< bit: 2 Window Monitor */
__I uint8_t SYNCRDY:1; /*!< bit: 3 Synchronization Ready */
__I uint8_t :4; /*!< bit: 4.. 7 Reserved */
uint8_t :4; /*!< bit: 4.. 7 Reserved */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
} ADC_INTFLAG_Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint8_t UNDERRUN:1; /*!< bit: 0 Underrun */
__I uint8_t EMPTY:1; /*!< bit: 1 Data Buffer Empty */
__I uint8_t SYNCRDY:1; /*!< bit: 2 Synchronization Ready */
__I uint8_t :5; /*!< bit: 3.. 7 Reserved */
uint8_t :5; /*!< bit: 3.. 7 Reserved */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
} DAC_INTFLAG_Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint8_t TERR:1; /*!< bit: 0 Channel Transfer Error */
__I uint8_t TCMPL:1; /*!< bit: 1 Channel Transfer Complete */
__I uint8_t SUSP:1; /*!< bit: 2 Channel Suspend */
__I uint8_t :5; /*!< bit: 3.. 7 Reserved */
uint8_t :5; /*!< bit: 3.. 7 Reserved */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
} DMAC_CHINTFLAG_Type;
Expand Down
4 changes: 2 additions & 2 deletions cpu/sam0_common/include/vendor/samd10/include/component/eic.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint32_t EXTINT5:1; /*!< bit: 5 External Interrupt 5 */
__I uint32_t EXTINT6:1; /*!< bit: 6 External Interrupt 6 */
__I uint32_t EXTINT7:1; /*!< bit: 7 External Interrupt 7 */
__I uint32_t :24; /*!< bit: 8..31 Reserved */
uint32_t :24; /*!< bit: 8..31 Reserved */
} bit; /*!< Structure used for bit access */
struct {
__I uint32_t EXTINT:8; /*!< bit: 0.. 7 External Interrupt x */
__I uint32_t :24; /*!< bit: 8..31 Reserved */
uint32_t :24; /*!< bit: 8..31 Reserved */
} vec; /*!< Structure used for vec access */
uint32_t reg; /*!< Type used for register access */
} EIC_INTFLAG_Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,20 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint32_t OVR3:1; /*!< bit: 3 Channel 3 Overrun */
__I uint32_t OVR4:1; /*!< bit: 4 Channel 4 Overrun */
__I uint32_t OVR5:1; /*!< bit: 5 Channel 5 Overrun */
__I uint32_t :2; /*!< bit: 6.. 7 Reserved */
uint32_t :2; /*!< bit: 6.. 7 Reserved */
__I uint32_t EVD0:1; /*!< bit: 8 Channel 0 Event Detection */
__I uint32_t EVD1:1; /*!< bit: 9 Channel 1 Event Detection */
__I uint32_t EVD2:1; /*!< bit: 10 Channel 2 Event Detection */
__I uint32_t EVD3:1; /*!< bit: 11 Channel 3 Event Detection */
__I uint32_t EVD4:1; /*!< bit: 12 Channel 4 Event Detection */
__I uint32_t EVD5:1; /*!< bit: 13 Channel 5 Event Detection */
__I uint32_t :18; /*!< bit: 14..31 Reserved */
uint32_t :18; /*!< bit: 14..31 Reserved */
} bit; /*!< Structure used for bit access */
struct {
__I uint32_t OVR:6; /*!< bit: 0.. 5 Channel x Overrun */
__I uint32_t :2; /*!< bit: 6.. 7 Reserved */
uint32_t :2; /*!< bit: 6.. 7 Reserved */
__I uint32_t EVD:6; /*!< bit: 8..13 Channel x Event Detection */
__I uint32_t :18; /*!< bit: 14..31 Reserved */
uint32_t :18; /*!< bit: 14..31 Reserved */
} vec; /*!< Structure used for vec access */
uint32_t reg; /*!< Type used for register access */
} EVSYS_INTFLAG_Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
struct {
__I uint8_t READY:1; /*!< bit: 0 NVM Ready */
__I uint8_t ERROR:1; /*!< bit: 1 Error */
__I uint8_t :6; /*!< bit: 2.. 7 Reserved */
uint8_t :6; /*!< bit: 2.. 7 Reserved */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
} NVMCTRL_INTFLAG_Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
struct {
__I uint8_t CKRDY:1; /*!< bit: 0 Clock Ready */
__I uint8_t CFD:1; /*!< bit: 1 Clock Failure Detector */
__I uint8_t :6; /*!< bit: 2.. 7 Reserved */
uint8_t :6; /*!< bit: 2.. 7 Reserved */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
} PM_INTFLAG_Type;
Expand Down
12 changes: 6 additions & 6 deletions cpu/sam0_common/include/vendor/samd10/include/component/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,13 +615,13 @@ typedef union {
typedef union { // __I to avoid read-modify-write on write-to-clear register
struct {
__I uint8_t CMP0:1; /*!< bit: 0 Compare 0 */
__I uint8_t :5; /*!< bit: 1.. 5 Reserved */
uint8_t :5; /*!< bit: 1.. 5 Reserved */
__I uint8_t SYNCRDY:1; /*!< bit: 6 Synchronization Ready */
__I uint8_t OVF:1; /*!< bit: 7 Overflow */
} bit; /*!< Structure used for bit access */
struct {
__I uint8_t CMP:1; /*!< bit: 0 Compare x */
__I uint8_t :7; /*!< bit: 1.. 7 Reserved */
uint8_t :7; /*!< bit: 1.. 7 Reserved */
} vec; /*!< Structure used for vec access */
uint8_t reg; /*!< Type used for register access */
} RTC_MODE0_INTFLAG_Type;
Expand All @@ -647,13 +647,13 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
struct {
__I uint8_t CMP0:1; /*!< bit: 0 Compare 0 */
__I uint8_t CMP1:1; /*!< bit: 1 Compare 1 */
__I uint8_t :4; /*!< bit: 2.. 5 Reserved */
uint8_t :4; /*!< bit: 2.. 5 Reserved */
__I uint8_t SYNCRDY:1; /*!< bit: 6 Synchronization Ready */
__I uint8_t OVF:1; /*!< bit: 7 Overflow */
} bit; /*!< Structure used for bit access */
struct {
__I uint8_t CMP:2; /*!< bit: 0.. 1 Compare x */
__I uint8_t :6; /*!< bit: 2.. 7 Reserved */
uint8_t :6; /*!< bit: 2.. 7 Reserved */
} vec; /*!< Structure used for vec access */
uint8_t reg; /*!< Type used for register access */
} RTC_MODE1_INTFLAG_Type;
Expand All @@ -680,13 +680,13 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
typedef union { // __I to avoid read-modify-write on write-to-clear register
struct {
__I uint8_t ALARM0:1; /*!< bit: 0 Alarm 0 */
__I uint8_t :5; /*!< bit: 1.. 5 Reserved */
uint8_t :5; /*!< bit: 1.. 5 Reserved */
__I uint8_t SYNCRDY:1; /*!< bit: 6 Synchronization Ready */
__I uint8_t OVF:1; /*!< bit: 7 Overflow */
} bit; /*!< Structure used for bit access */
struct {
__I uint8_t ALARM:1; /*!< bit: 0 Alarm x */
__I uint8_t :7; /*!< bit: 1.. 7 Reserved */
uint8_t :7; /*!< bit: 1.. 7 Reserved */
} vec; /*!< Structure used for vec access */
uint8_t reg; /*!< Type used for register access */
} RTC_MODE2_INTFLAG_Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
struct {
__I uint8_t MB:1; /*!< bit: 0 Master On Bus Interrupt */
__I uint8_t SB:1; /*!< bit: 1 Slave On Bus Interrupt */
__I uint8_t :5; /*!< bit: 2.. 6 Reserved */
uint8_t :5; /*!< bit: 2.. 6 Reserved */
__I uint8_t ERROR:1; /*!< bit: 7 Combined Error Interrupt */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
Expand All @@ -853,7 +853,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint8_t PREC:1; /*!< bit: 0 Stop Received Interrupt */
__I uint8_t AMATCH:1; /*!< bit: 1 Address Match Interrupt */
__I uint8_t DRDY:1; /*!< bit: 2 Data Interrupt */
__I uint8_t :4; /*!< bit: 3.. 6 Reserved */
uint8_t :4; /*!< bit: 3.. 6 Reserved */
__I uint8_t ERROR:1; /*!< bit: 7 Combined Error Interrupt */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
Expand Down Expand Up @@ -881,7 +881,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint8_t TXC:1; /*!< bit: 1 Transmit Complete Interrupt */
__I uint8_t RXC:1; /*!< bit: 2 Receive Complete Interrupt */
__I uint8_t SSL:1; /*!< bit: 3 Slave Select Low Interrupt Flag */
__I uint8_t :3; /*!< bit: 4.. 6 Reserved */
uint8_t :3; /*!< bit: 4.. 6 Reserved */
__I uint8_t ERROR:1; /*!< bit: 7 Combined Error Interrupt */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
Expand Down Expand Up @@ -913,7 +913,7 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint8_t RXS:1; /*!< bit: 3 Receive Start Interrupt */
__I uint8_t CTSIC:1; /*!< bit: 4 Clear To Send Input Change Interrupt */
__I uint8_t RXBRK:1; /*!< bit: 5 Break Received Interrupt */
__I uint8_t :1; /*!< bit: 6 Reserved */
uint8_t :1; /*!< bit: 6 Reserved */
__I uint8_t ERROR:1; /*!< bit: 7 Combined Error Interrupt */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ typedef union { // __I to avoid read-modify-write on write-to-clear register
__I uint32_t BOD33RDY:1; /*!< bit: 9 BOD33 Ready */
__I uint32_t BOD33DET:1; /*!< bit: 10 BOD33 Detection */
__I uint32_t B33SRDY:1; /*!< bit: 11 BOD33 Synchronization Ready */
__I uint32_t :3; /*!< bit: 12..14 Reserved */
uint32_t :3; /*!< bit: 12..14 Reserved */
__I uint32_t DPLLLCKR:1; /*!< bit: 15 DPLL Lock Rise */
__I uint32_t DPLLLCKF:1; /*!< bit: 16 DPLL Lock Fall */
__I uint32_t DPLLLTO:1; /*!< bit: 17 DPLL Lock Timeout */
__I uint32_t :14; /*!< bit: 18..31 Reserved */
uint32_t :14; /*!< bit: 18..31 Reserved */
} bit; /*!< Structure used for bit access */
uint32_t reg; /*!< Type used for register access */
} SYSCTRL_INTFLAG_Type;
Expand Down
Loading

0 comments on commit ceaf6bd

Please sign in to comment.