I have a project with a lot of c-Files with statements like the following:
static const uint8_t MOD_BIT_POS = 10;
static const uint16_t MOD_SHUTDOWN = 0x0001 << MOD_BIT_POS;
When I try to compile the project, I get the following error:
error: initializer element is not constant
static const uint16_t MOD_SHUTDOWN = 0x0001 << MOD_BIT_POS;
As soon as I change the above code to
static const uint16_t MOD_SHUTDOWN = 0x0001 << 10;
the error disappears.
As I said the project has a lot of files with a lot of lines like this, it is not my code and replacing might not be an option in every occasion, so I would like to resolve this issue. My colleagues do not have the same issue, so it must have something to do with my setup.
I use gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 on Linux Mint.
The CFLAGS are the following:
-pedantic -Wall -Wformat=2 -Winit-self -Wmissing-include-dirs -Wcast-qual -Wstrict-prototypes -Wnormalized=nfc -Wunreachable-code -Wextra -O2
But my colleagues are using the same, so I would think this can't be the root of the problem.