I'm trying to fold elements in an array with #pragma region and #pragma endregion directives, but every time I compile it I get:
gcc -ffreestanding -fshort-wchar -fno-stack-protector -Wall -Wno-implicit-function-declaration -c main.c -o main.o
main.c:16:13: error: expected expression before ‘#pragma’
16 | #pragma region ExclamationMark
| ^~~~~~
Here's a minimal reproducible example:
#define FontHeight 16
typedef struct { unsigned char g[FontHeight]; } Glyph;
#define GLYPH(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16) (Glyph){{_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16}}
#define EMPTY_GLYPH (Glyph){{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}
Glyph Font[] = {
EMPTY_GLYPH,
EMPTY_GLYPH,
EMPTY_GLYPH,
EMPTY_GLYPH,
// and so on...
#pragma region ExclamationMark
GLYPH(
0b00000000,
0b00000000,
0b00000000,
0b00001000,
0b00001000,
0b00001000,
0b00001000,
0b00001000,
0b00001000,
0b00001000,
0b00000000,
0b00001000,
0b00001000,
0b00000000,
0b00000000,
0b00000000
),
#pragma endregion ExclamationMark
};
The two aforementioned directives were supported in GCC v13 (I'm using GCC 13.1.1 on Arch Linux), but even so GCC throws me an error - this should at most be a warning as far as I know and my toolchain doesn't promote any warnings to errors.
The reason I want to do this is because the elements I'm trying to fold are multiple lines long, themselves simplified by using #define directives in a header file. Permalink to source file is here.
Thanks in advance.