I have following c++ code for an embedded system:
//LIBRARY code:
typedef struct { /*!< (@ 0x48028100) PORT1 Structure */
__IO uint32_t OUT; /*!< (@ 0x48028100) Port 1 Output Register */
__O uint32_t OMR; /*!< (@ 0x48028104) Port 1 Output Modification Register */
__I uint32_t RESERVED[2];
__IO uint32_t IOCR0; /*!< (@ 0x48028110) Port 1 Input/Output Control Register 0 */
__IO uint32_t IOCR4; /*!< (@ 0x48028114) Port 1 Input/Output Control Register 4 */
__IO uint32_t IOCR8; /*!< (@ 0x48028118) Port 1 Input/Output Control Register 8 */
__IO uint32_t IOCR12; /*!< (@ 0x4802811C) Port 1 Input/Output Control Register 12 */
__I uint32_t RESERVED1;
__I uint32_t IN; /*!< (@ 0x48028124) Port 1 Input Register */
__I uint32_t RESERVED2[6];
__IO uint32_t PDR0; /*!< (@ 0x48028140) Port 1 Pad Driver Mode 0 Register */
__IO uint32_t PDR1; /*!< (@ 0x48028144) Port 1 Pad Driver Mode 1 Register */
__I uint32_t RESERVED3[6];
__I uint32_t PDISC; /*!< (@ 0x48028160) Port 1 Pin Function Decision Control Register */
__I uint32_t RESERVED4[3];
__IO uint32_t PPS; /*!< (@ 0x48028170) Port 1 Pin Power Save Register */
__IO uint32_t HWSEL; /*!< (@ 0x48028174) Port 1 Pin Hardware Select Register */
} PORT1_Type;
#define PORT1_BASE 0x48028100UL
#define PORT1 ((PORT1_Type *) PORT1_BASE)
// MY MINIMAL EXAMPLE CODE:
...
uint32_t u32SourceAddress = (uint32_t)(&(PORT1->IN)), // error: expected unqualified-id
// ^
...
This code works just fine when I compile it with GCC or ARMCC. When I use clang-tidy, I get an error: expected unqualified-id [clang-diagnostic-error] on it. What am I doing wrong and how can I fix it?
Thanks, Moritz
edit: Added comments regarding library based code and my code.