Module Name: src
Committed By: rillig
Date: Tue Aug 1 19:57:38 UTC 2023
Modified Files:
src/usr.bin/xlint/lint1: decl.c lint1.h
Log Message:
lint: clear global variable 'dcs' after use
Having unnecessarily set members is confusing during debugging.
To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/xlint/lint1/lint1.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.371 src/usr.bin/xlint/lint1/decl.c:1.372
--- src/usr.bin/xlint/lint1/decl.c:1.371 Tue Aug 1 16:08:58 2023
+++ src/usr.bin/xlint/lint1/decl.c Tue Aug 1 19:57:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.371 2023/08/01 16:08:58 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.372 2023/08/01 19:57:38 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.371 2023/08/01 16:08:58 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.372 2023/08/01 19:57:38 rillig Exp $");
#endif
#include <sys/param.h>
@@ -609,12 +609,18 @@ dcs_begin_type(void)
dcs->d_rank_mod = NO_TSPEC;
dcs->d_scl = NOSCL;
dcs->d_type = NULL;
+ dcs->d_redeclared_symbol = NULL;
dcs->d_qual = (type_qualifiers) { .tq_const = false };
dcs->d_inline = false;
dcs->d_multiple_storage_classes = false;
dcs->d_invalid_type_combination = false;
dcs->d_nonempty_decl = false;
dcs->d_no_type_specifier = false;
+ dcs->d_packed = false;
+ dcs->d_used = false;
+ dcs->d_func_args = NULL;
+ dcs->d_func_def_pos = (pos_t){ NULL, 0, 0 };
+ dcs->d_func_proto_syms = NULL;
}
static void
@@ -1380,6 +1386,7 @@ add_function(sym_t *decl, struct paramet
decl->s_type == dcs->d_enclosing->d_type) {
dcs->d_enclosing->d_func_proto_syms = dcs->d_first_dlsym;
dcs->d_enclosing->d_func_args = params.first;
+ debug_dcs_all();
}
/*
Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.197 src/usr.bin/xlint/lint1/lint1.h:1.198
--- src/usr.bin/xlint/lint1/lint1.h:1.197 Sat Jul 29 10:34:24 2023
+++ src/usr.bin/xlint/lint1/lint1.h Tue Aug 1 19:57:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.197 2023/07/29 10:34:24 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.198 2023/08/01 19:57:38 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -390,13 +390,15 @@ typedef struct decl_level {
bool d_used:1;
type_t *d_tag_type; /* during a member declaration, the tag type to
* which the member belongs */
- sym_t *d_func_args; /* during a function declaration, the list of
- * arguments */
+ sym_t *d_func_args; /* during a function declaration, the
+ * parameters, stored in the enclosing level */
pos_t d_func_def_pos; /* position of the function definition */
sym_t *d_first_dlsym; /* first symbol declared at this level */
sym_t **d_last_dlsym; /* points to s_level_next in the last symbol
declaration at this level */
- sym_t *d_func_proto_syms; /* symbols defined in prototype */
+ sym_t *d_func_proto_syms; /* symbols defined in prototype, such
+ * as tagged types or parameter names,
+ * may overlap d_func_args */
struct decl_level *d_enclosing; /* the enclosing declaration level */
} decl_level;