From 7dc09fdb05051de5273abb83679924b7b265a680 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 15 Sep 2024 19:22:16 +0200 Subject: [PATCH] add test related to bug#2515 / pr#2518 --- test/misc/Makefile | 8 ++++++++ test/misc/bug2515.c | 4 ++++ test/misc/bug2515.c99.ref | 2 ++ test/misc/bug2515.ref | 1 + 4 files changed, 15 insertions(+) create mode 100644 test/misc/bug2515.c create mode 100644 test/misc/bug2515.c99.ref create mode 100644 test/misc/bug2515.ref diff --git a/test/misc/Makefile b/test/misc/Makefile index cfcae0530..ebae0964e 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -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) diff --git a/test/misc/bug2515.c b/test/misc/bug2515.c new file mode 100644 index 000000000..62ee52a25 --- /dev/null +++ b/test/misc/bug2515.c @@ -0,0 +1,4 @@ + +#line 13"x" +#define X"y" +int main() { foo; } diff --git a/test/misc/bug2515.c99.ref b/test/misc/bug2515.c99.ref new file mode 100644 index 000000000..f6cf2fcea --- /dev/null +++ b/test/misc/bug2515.c99.ref @@ -0,0 +1,2 @@ +x:13: Warning: ISO C99 requires whitespace after the macro name +x:14: Error: Undeclared identifier 'foo' diff --git a/test/misc/bug2515.ref b/test/misc/bug2515.ref new file mode 100644 index 000000000..affbaebb9 --- /dev/null +++ b/test/misc/bug2515.ref @@ -0,0 +1 @@ +x:14: Error: Undeclared identifier 'foo'