add test related to bug#2515 / pr#2518

This commit is contained in:
mrdudz 2024-09-15 19:22:16 +02:00
parent fe6afa621b
commit 7dc09fdb05
4 changed files with 15 additions and 0 deletions

View File

@ -102,6 +102,14 @@ $(WORKDIR)/bug1265.$1.$2.prg: bug1265.c | $(WORKDIR)
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)
$(SIM65) $(SIM65FLAGS) $$@ $(NULLOUT) $(NULLERR)
# should not compile, but gives different diagnostics in C99 mode than in others
$(WORKDIR)/bug2515.$1.$2.prg: bug2515.c | $(WORKDIR)
$(if $(QUIET),echo misc/bug2515.$1.$2.prg)
$(NOT) $(CC65) --standard c99 -t sim$2 -$1 -o $$(@:.prg=.s) $$< 2>$(WORKDIR)/bug2515.$1.$2.out
$(ISEQUAL) $(WORKDIR)/bug2515.$1.$2.out bug2515.c99.ref
$(NOT) $(CC65) -t sim$2 -$1 -o $$(@:.prg=.s) $$< 2>$(WORKDIR)/bug2515.$1.$2.out
$(ISEQUAL) $(WORKDIR)/bug2515.$1.$2.out bug2515.ref
# this one requires -Werror
$(WORKDIR)/bug1768.$1.$2.prg: bug1768.c | $(WORKDIR)
$(if $(QUIET),echo misc/bug1768.$1.$2.prg)

4
test/misc/bug2515.c Normal file
View File

@ -0,0 +1,4 @@
#line 13"x"
#define X"y"
int main() { foo; }

View File

@ -0,0 +1,2 @@
x:13: Warning: ISO C99 requires whitespace after the macro name
x:14: Error: Undeclared identifier 'foo'

1
test/misc/bug2515.ref Normal file
View File

@ -0,0 +1 @@
x:14: Error: Undeclared identifier 'foo'