From a48bbc4be09fdfcc0bd2a157341ffccece882fe8 Mon Sep 17 00:00:00 2001 From: laubzega Date: Sun, 23 Sep 2018 16:22:59 -0700 Subject: [PATCH] Switched from warning to error. Tightened the testcase. --- src/cc65/symtab.c | 2 +- test/misc/Makefile | 4 ++-- test/misc/goto.c | 2 +- test/misc/goto.ref | 11 +++++------ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/cc65/symtab.c b/src/cc65/symtab.c index 51b43b4c9..fe3787f00 100644 --- a/src/cc65/symtab.c +++ b/src/cc65/symtab.c @@ -700,7 +700,7 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags) a goto statement, we will only look for the label definition. */ if (((DOR->Flags & SC_DEF) != (Flags & SC_DEF)) && (DOR->LocalsBlockNum != (long)CollLast (&CurrentFunc->LocalsBlockStack))) - Warning ("Goto from line %d to label \'%s\' can result in a " + Error ("Goto from line %d to label \'%s\' can result in a " "trashed stack", Flags & SC_DEF ? DOR->Line : GetCurrentLine (), Name); } diff --git a/test/misc/Makefile b/test/misc/Makefile index 2332f1785..83d6e03ba 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -72,10 +72,10 @@ $(WORKDIR)/limits.$1.$2.prg: limits.c $(DIFF) $(SIM65) $(SIM65FLAGS) $$@ > $(WORKDIR)/limits.$1.out $(DIFF) $(WORKDIR)/limits.$1.out limits.ref -# here we check if the right warnings are produced +# here we check if the right errors are produced $(WORKDIR)/goto.$1.$2.prg: goto.c $(DIFF) $(if $(QUIET),echo misc/goto.$1.$2.prg) - $(CL65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.out + $(NOT) $(CL65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.out $(DIFF) $(WORKDIR)/goto.$1.out goto.ref # the rest are tests that fail currently for one reason or another diff --git a/test/misc/goto.c b/test/misc/goto.c index bdc407f82..6d16722e1 100644 --- a/test/misc/goto.c +++ b/test/misc/goto.c @@ -61,5 +61,5 @@ int function () { goto end; end: - ; + return 0; } diff --git a/test/misc/goto.ref b/test/misc/goto.ref index f31fa4507..e319a153f 100644 --- a/test/misc/goto.ref +++ b/test/misc/goto.ref @@ -1,7 +1,6 @@ -goto.c(34): Warning: Goto from line 29 to label 'bad' can result in a trashed stack -goto.c(40): Warning: Goto from line 18 to label 'unsafe' can result in a trashed stack -goto.c(42): Warning: Goto from line 42 to label 'another' can result in a trashed stack -goto.c(47): Warning: Goto from line 47 to label 'bad' can result in a trashed stack -goto.c(56): Warning: Goto from line 38 to label 'finish' can result in a trashed stack +goto.c(34): Error: Goto from line 29 to label 'bad' can result in a trashed stack +goto.c(40): Error: Goto from line 18 to label 'unsafe' can result in a trashed stack +goto.c(42): Error: Goto from line 42 to label 'another' can result in a trashed stack +goto.c(47): Error: Goto from line 47 to label 'bad' can result in a trashed stack +goto.c(56): Error: Goto from line 38 to label 'finish' can result in a trashed stack goto.c(58): Warning: `unused' is defined but never used -goto.c(65): Warning: Control reaches end of non-void function -- 2.39.5