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: clean up variable names



details:   https://anonhg.NetBSD.org/src/rev/1c51e643e77f
branches:  trunk
changeset: 377228:1c51e643e77f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 02 08:16:19 2023 +0000

description:
lint: clean up variable names

diffstat:

 usr.bin/xlint/lint1/debug.c |  15 +++++++--------
 usr.bin/xlint/lint1/decl.c  |  11 +++++------
 usr.bin/xlint/lint1/lint1.h |   5 ++---
 usr.bin/xlint/lint1/tree.c  |  14 +++++++-------
 4 files changed, 21 insertions(+), 24 deletions(-)

diffs (160 lines):

diff -r bc3415627791 -r 1c51e643e77f usr.bin/xlint/lint1/debug.c
--- a/usr.bin/xlint/lint1/debug.c       Sun Jul 02 00:52:04 2023 +0000
+++ b/usr.bin/xlint/lint1/debug.c       Sun Jul 02 08:16:19 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.41 2023/07/01 09:21:31 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.42 2023/07/02 08:16:19 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.41 2023/07/01 09:21:31 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.42 2023/07/02 08:16:19 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -368,14 +368,13 @@ debug_sym(const char *prefix, const sym_
                    sym->u.s_bool_constant ? "true" : "false");
 
        if (is_member(sym)) {
-               struct_or_union *sou_type = sym->u.s_member.sm_sou_type;
-               lint_assert(sou_type != NULL);
-               const char *tag = sou_type->sou_tag->s_name;
-               const sym_t *def = sou_type->sou_first_typedef;
+               struct_or_union *sou = sym->u.s_member.sm_containing_type;
+               const char *tag = sou->sou_tag->s_name;
+               const sym_t *def = sou->sou_first_typedef;
                if (tag == unnamed && def != NULL)
                        debug_printf(" sou='typedef %s'", def->s_name);
                else
-                       debug_printf(" sou=%s", tag);
+                       debug_printf(" sou='%s'", tag);
        }
 
        if (sym->s_keyword != NULL) {
@@ -383,7 +382,7 @@ debug_sym(const char *prefix, const sym_
                if (t == T_TYPE || t == T_STRUCT_OR_UNION)
                        debug_printf(" %s",
                            tspec_name(sym->u.s_keyword.sk_tspec));
-               else if (t == T_QUAL)
+               if (t == T_QUAL)
                        debug_printf(" %s",
                            tqual_name(sym->u.s_keyword.sk_qualifier));
        }
diff -r bc3415627791 -r 1c51e643e77f usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sun Jul 02 00:52:04 2023 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sun Jul 02 08:16:19 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.332 2023/07/01 10:04:27 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.333 2023/07/02 08:16:19 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.332 2023/07/01 10:04:27 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.333 2023/07/02 08:16:19 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1069,8 +1069,8 @@ declare_member(sym_t *dsym)
        if (dcs->d_redeclared_symbol != NULL) {
                lint_assert(is_member(dcs->d_redeclared_symbol));
 
-               if (dsym->u.s_member.sm_sou_type ==
-                   dcs->d_redeclared_symbol->u.s_member.sm_sou_type) {
+               if (dsym->u.s_member.sm_containing_type ==
+                   dcs->d_redeclared_symbol->u.s_member.sm_containing_type) {
                        /* duplicate member name '%s' */
                        error(33, dsym->s_name);
                        rmsym(dcs->d_redeclared_symbol);
@@ -1465,8 +1465,7 @@ declarator_name(sym_t *sym)
        switch (dcs->d_kind) {
        case DLK_STRUCT:
        case DLK_UNION:
-               /* Set parent */
-               sym->u.s_member.sm_sou_type = dcs->d_tag_type->t_sou;
+               sym->u.s_member.sm_containing_type = dcs->d_tag_type->t_sou;
                sym->s_def = DEF;
                sc = dcs->d_kind == DLK_STRUCT ? STRUCT_MEMBER : UNION_MEMBER;
                break;
diff -r bc3415627791 -r 1c51e643e77f usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sun Jul 02 00:52:04 2023 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sun Jul 02 08:16:19 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.174 2023/07/01 09:59:51 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.175 2023/07/02 08:16:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -248,8 +248,7 @@ typedef     struct sym {
                bool s_bool_constant;
                int s_enum_constant;    /* XXX: should be TARG_INT */
                struct {
-                       /* XXX: what is the difference to s_type->t_sou? */
-                       struct_or_union *sm_sou_type;
+                       struct_or_union *sm_containing_type;
                        unsigned int sm_offset_in_bits;
                } s_member;
                struct {
diff -r bc3415627791 -r 1c51e643e77f usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jul 02 00:52:04 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jul 02 08:16:19 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.542 2023/07/01 10:04:27 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.543 2023/07/02 08:16:19 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.542 2023/07/01 10:04:27 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.543 2023/07/02 08:16:19 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -1925,7 +1925,7 @@ struct_or_union_member(tnode_t *tn, op_t
                sou->sou_tag = expr_zero_alloc(sizeof(*sou->sou_tag));
                sou->sou_tag->s_name = unnamed;
 
-               msym->u.s_member.sm_sou_type = sou;
+               msym->u.s_member.sm_containing_type = sou;
                /*
                 * The member sm_offset_in_bits is not needed here since this
                 * symbol can only be used for error reporting.
@@ -1940,16 +1940,16 @@ struct_or_union_member(tnode_t *tn, op_t
        if (op == ARROW && tn->tn_type->t_tspec == PTR
            && is_struct_or_union(tn->tn_type->t_subt->t_tspec))
                tp = tn->tn_type->t_subt;
-       struct_or_union *str = tp != NULL ? tp->t_sou : NULL;
+       struct_or_union *sou = tp != NULL ? tp->t_sou : NULL;
 
        /*
         * If this struct/union has a member with the name of msym, return it.
         */
-       if (str != NULL) {
+       if (sou != NULL) {
                for (sym_t *sym = msym;
                     sym != NULL; sym = sym->s_symtab_next) {
                        if (is_member(sym) &&
-                           sym->u.s_member.sm_sou_type == str &&
+                           sym->u.s_member.sm_containing_type == sou &&
                            strcmp(sym->s_name, msym->s_name) == 0)
                                return sym;
                }
@@ -1967,7 +1967,7 @@ struct_or_union_member(tnode_t *tn, op_t
         * Now handle the case in which the left operand refers really
         * to a struct/union, but the right operand is not member of it.
         */
-       if (str != NULL) {
+       if (sou != NULL) {
                if (eq && !allow_c90) {
                        /* illegal use of member '%s' */
                        warning(102, msym->s_name);



Home | Main Index | Thread Index | Old Index