Originally Posted by
MartinR
@john.c, the exact gcc error about line 6 says "error: initializer element is not constant".
To illustrate john.c's point, I compiled this program with gcc 5.4.0 with options -Wall -pedantic -ansi, and also compiled it again with -ansi swapped out for -std=c99, and in both cases gcc neither issued a warning nor an error message:
Code:
#define GET_TX_BASE() DEBUG_TX_BASE
#define DEBUG_RX_BASE 0xBE000000
#define DEBUG_TX_BASE 0xBEFE0000
volatile struct ring * const rx = (void *) DEBUG_RX_BASE;
volatile struct ring * const tx = (void *) GET_TX_BASE();
int main(void)
{
return 0;
}
Consequently, your claim that gcc emitted an error message concerning line 6 must be wrong, unless you can produce a program that demonstrates the contrary.