The below code doesn't compile on sdcc (I think it used to work) but compiles successfully on gcc.
I have a macro that declares the extern variable, and I use the macro multiple times in a function. I can work around this using curly braces.
/// GPL 2.0 or later
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
void test() {
extern const uint8_t * const name_data[];
extern const uint8_t * const name_data[];
}
$ sdcc -c ./extern.c
./extern.c:6: warning 283: function declarator with no prototype
./extern.c:9: error 91: extern definition for 'name_data' mismatches with declaration.
./extern.c:8: error 177: previously defined here
./extern.c:8: error 146: two or more storage classes in declaration for 'name_data'
-:0: warning 85: in function test unreferenced local variable : 'name_data'
$ echo $?
1
$ gcc -c ./extern.c
$ echo $?
0
$ sdcc -v
SDCC : z80/sm83/z80n/mos6502/mos65c02 TD- 4.4.0 #14620 (Linux)