Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: properly clean up when leaving a f...



details:   https://anonhg.NetBSD.org/src/rev/b1389a66751f
branches:  trunk
changeset: 373289:b1389a66751f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 29 18:37:20 2023 +0000

description:
lint: properly clean up when leaving a function definition

diffstat:

 tests/usr.bin/xlint/lint1/msg_249.c |  6 +++---
 usr.bin/xlint/lint1/func.c          |  6 ++++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r b8347f866824 -r b1389a66751f tests/usr.bin/xlint/lint1/msg_249.c
--- a/tests/usr.bin/xlint/lint1/msg_249.c       Sun Jan 29 18:16:48 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_249.c       Sun Jan 29 18:37:20 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_249.c,v 1.12 2022/06/17 18:54:53 rillig Exp $      */
+/*     $NetBSD: msg_249.c,v 1.13 2023/01/29 18:37:20 rillig Exp $      */
 # 3 "msg_249.c"
 
 // Test for message: syntax error '%s' [249]
@@ -66,12 +66,12 @@
  */
 
 int gcc_statement_expression_1 = ({
-/* expect+1: warning: label 'unused_label' unused in function 'access_declaration_after_syntax_error' [232] */
 unused_label:
        1;
        1;
 });
 /* expect-1: error: non-constant initializer [177] */
+/* expect-2: error: syntax error 'labels are only valid inside a function' [249] */
 
 /* Even another function definition does not help. */
 void
@@ -80,9 +80,9 @@
 }
 
 int gcc_statement_expression_2 = ({
-/* expect+1: warning: label 'unused_label' unused in function 'try_to_recover' [232] */
 unused_label:
        1;
        1;
 });
 /* expect-1: error: non-constant initializer [177] */
+/* expect-2: error: syntax error 'labels are only valid inside a function' [249] */
diff -r b8347f866824 -r b1389a66751f usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Sun Jan 29 18:16:48 2023 +0000
+++ b/usr.bin/xlint/lint1/func.c        Sun Jan 29 18:37:20 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.146 2023/01/29 18:13:56 rillig Exp $        */
+/*     $NetBSD: func.c,v 1.147 2023/01/29 18:37:20 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: func.c,v 1.146 2023/01/29 18:13:56 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.147 2023/01/29 18:37:20 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -432,6 +432,8 @@
 
        /* must be set on level 0 */
        set_reached(true);
+
+       funcsym = NULL;
 }
 
 void



Home | Main Index | Thread Index | Old Index