Fixed compiling with pragmas in the middle of declarations or statements.

This commit is contained in:
acqn
2023-10-04 21:22:04 +08:00
parent 6222cd9115
commit 20c3e994c6
7 changed files with 271 additions and 116 deletions

29
test/val/bug2151.c Normal file
View File

@@ -0,0 +1,29 @@
/* Bug #2151 - #pragma causes errors when used within functions */
#pragma bss-name("BSS1")
int
#pragma code-name("CODE_WUT")
main _Pragma("message(\"_Pragma note\")")
(
void
_Pragma _Pragma (
#pragma message("nested message 1")
"message(\"nested message 2\")"
)
(
"message(\"_Pragma in function parentheses\")")
#pragma code-name("CODE")
)
#pragma bss-name("BSS")
{
extern int y;
#pragma bss-name("BSS2")
static
#pragma zpsym ("y")
int x; // TODO: currently in "BSS", but supposed to be in "BSS2"?
x = 0;
return x + y;
#pragma bss-name("BSS")
}
int y;