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: unabbreviate some fields in sym_t



details:   https://anonhg.NetBSD.org/src/rev/7df9ad271d18
branches:  trunk
changeset: 362049:7df9ad271d18
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 27 10:44:45 2022 +0000

description:
lint: unabbreviate some fields in sym_t

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c  |  14 +++++++-------
 usr.bin/xlint/lint1/func.c  |   7 ++++---
 usr.bin/xlint/lint1/lex.c   |  34 +++++++++++++++++-----------------
 usr.bin/xlint/lint1/lint1.h |  14 ++++++++------
 usr.bin/xlint/lint1/tree.c  |  11 ++++++-----
 5 files changed, 42 insertions(+), 38 deletions(-)

diffs (287 lines):

diff -r 5cc9294210b6 -r 7df9ad271d18 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sun Feb 27 10:31:58 2022 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sun Feb 27 10:44:45 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.247 2022/02/27 10:31:58 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.248 2022/02/27 10:44:45 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.247 2022/02/27 10:31:58 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.248 2022/02/27 10:44:45 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1440,7 +1440,7 @@
         * Declarations of structs/unions/enums in param lists are legal,
         * but senseless.
         */
-       for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
+       for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_level_next) {
                sc = sym->s_scl;
                if (sc == STRUCT_TAG || sc == UNION_TAG || sc == ENUM_TAG) {
                        /* dubious tag declaration: %s %s */
@@ -2776,7 +2776,7 @@
        /* look for a symbol with the same name */
        esym = dcs->d_redeclared_symbol;
        while (esym != NULL && esym->s_block_level != 0) {
-               while ((esym = esym->s_link) != NULL) {
+               while ((esym = esym->s_symtab_next) != NULL) {
                        if (esym->s_kind != FVFT)
                                continue;
                        if (strcmp(dsym->s_name, esym->s_name) == 0)
@@ -2984,7 +2984,7 @@
 
 /*
  * Prints warnings for a list of variables and labels (concatenated
- * with s_dlnxt) if these are not used or only set.
+ * with s_level_next) if these are not used or only set.
  */
 void
 check_usage(dinfo_t *di)
@@ -2997,7 +2997,7 @@
        lwarn = LWARN_ALL;
 
        debug_step("begin lwarn %d", lwarn);
-       for (sym = di->d_dlsyms; sym != NULL; sym = sym->s_dlnxt)
+       for (sym = di->d_dlsyms; sym != NULL; sym = sym->s_level_next)
                check_usage_sym(di->d_asm, sym);
        lwarn = mklwarn;
        debug_step("end lwarn %d", lwarn);
@@ -3170,7 +3170,7 @@
        if (block_level != 0 || dcs->d_next != NULL)
                norecover();
 
-       for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
+       for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_level_next) {
                if (sym->s_block_level == -1)
                        continue;
                if (sym->s_kind == FVFT) {
diff -r 5cc9294210b6 -r 7df9ad271d18 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Sun Feb 27 10:31:58 2022 +0000
+++ b/usr.bin/xlint/lint1/func.c        Sun Feb 27 10:44:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.127 2022/02/27 08:31:26 rillig Exp $        */
+/*     $NetBSD: func.c,v 1.128 2022/02/27 10:44:45 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.127 2022/02/27 08:31:26 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.128 2022/02/27 10:44:45 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -235,7 +235,8 @@
         * Put all symbols declared in the argument list back to the
         * symbol table.
         */
-       for (sym = dcs->d_func_proto_syms; sym != NULL; sym = sym->s_dlnxt) {
+       for (sym = dcs->d_func_proto_syms; sym != NULL;
+           sym = sym->s_level_next) {
                if (sym->s_block_level != -1) {
                        lint_assert(sym->s_block_level == 1);
                        inssym(1, sym);
diff -r 5cc9294210b6 -r 7df9ad271d18 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Feb 27 10:31:58 2022 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Feb 27 10:44:45 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.101 2022/02/27 08:31:26 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.102 2022/02/27 10:44:45 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.101 2022/02/27 08:31:26 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.102 2022/02/27 10:44:45 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -266,9 +266,9 @@
        size_t h;
 
        h = hash(sym->s_name);
-       if ((sym->s_link = symtab[h]) != NULL)
-               symtab[h]->s_rlink = &sym->s_link;
-       sym->s_rlink = &symtab[h];
+       if ((sym->s_symtab_next = symtab[h]) != NULL)
+               symtab[h]->s_symtab_ref = &sym->s_symtab_next;
+       sym->s_symtab_ref = &symtab[h];
        symtab[h] = sym;
 }
 
@@ -276,9 +276,9 @@
 symtab_remove(sym_t *sym)
 {
 
-       if ((*sym->s_rlink = sym->s_link) != NULL)
-               sym->s_link->s_rlink = sym->s_rlink;
-       sym->s_link = NULL;
+       if ((*sym->s_symtab_ref = sym->s_symtab_next) != NULL)
+               sym->s_symtab_next->s_symtab_ref = sym->s_symtab_ref;
+       sym->s_symtab_next = NULL;
 }
 
 
@@ -426,7 +426,7 @@
        const struct keyword *kw;
 
        h = hash(sb->sb_name);
-       for (sym = symtab[h]; sym != NULL; sym = sym->s_link) {
+       for (sym = symtab[h]; sym != NULL; sym = sym->s_symtab_next) {
                if (strcmp(sym->s_name, sb->sb_name) != 0)
                        continue;
                kw = sym->s_keyword;
@@ -1377,7 +1377,7 @@
        symtab_add(sym);
 
        *di->d_ldlsym = sym;
-       di->d_ldlsym = &sym->s_dlnxt;
+       di->d_ldlsym = &sym->s_level_next;
 
        free(sb);
        return sym;
@@ -1412,7 +1412,7 @@
        symtab_add(sym);
 
        *dcs->d_ldlsym = sym;
-       dcs->d_ldlsym = &sym->s_dlnxt;
+       dcs->d_ldlsym = &sym->s_level_next;
 
        return sym;
 }
@@ -1439,13 +1439,13 @@
 {
        sym_t   *sym;
 
-       for (sym = syms; sym != NULL; sym = sym->s_dlnxt) {
+       for (sym = syms; sym != NULL; sym = sym->s_level_next) {
                if (sym->s_block_level != -1) {
                        debug_step("rmsyms '%s' %s '%s'",
                            sym->s_name, symt_name(sym->s_kind),
                            type_name(sym->s_type));
                        symtab_remove(sym);
-                       sym->s_rlink = NULL;
+                       sym->s_symtab_ref = NULL;
                }
        }
 }
@@ -1461,8 +1461,8 @@
            sym->s_name, symt_name(sym->s_kind), type_name(sym->s_type));
        symtab_add(sym);
        sym->s_block_level = bl;
-       lint_assert(sym->s_link == NULL ||
-                   sym->s_block_level >= sym->s_link->s_block_level);
+       lint_assert(sym->s_symtab_next == NULL ||
+                   sym->s_block_level >= sym->s_symtab_next->s_block_level);
 }
 
 /*
@@ -1480,7 +1480,7 @@
 
        for (i = 0; i < HSHSIZ1; i++) {
                for (sym = symtab[i]; sym != NULL; sym = nsym) {
-                       nsym = sym->s_link;
+                       nsym = sym->s_symtab_next;
                        if (sym->s_block_level >= 1)
                                symtab_remove(sym);
                }
@@ -1510,7 +1510,7 @@
        symtab_add(nsym);
 
        *dcs->d_ldlsym = nsym;
-       dcs->d_ldlsym = &nsym->s_dlnxt;
+       dcs->d_ldlsym = &nsym->s_level_next;
 
        return nsym;
 }
diff -r 5cc9294210b6 -r 7df9ad271d18 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sun Feb 27 10:31:58 2022 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sun Feb 27 10:44:45 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.138 2022/02/27 07:50:09 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.139 2022/02/27 10:44:45 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -273,11 +273,13 @@
                struct  sym *_s_args; /* arguments in old style function
                                         definitions */
        } u;
-       struct  sym *s_link;    /* next symbol with same hash value */
-       struct  sym **s_rlink;  /* pointer to s_link of prev. symbol */
+       struct  sym *s_symtab_next;     /* next symbol with same hash value */
+       struct  sym **s_symtab_ref;     /* pointer to s_symtab_next of the
+                                        * previous symbol */
        struct  sym *s_next;    /* next struct/union member, enumerator,
                                   argument */
-       struct  sym *s_dlnxt;   /* next symbol declared on same level */
+       struct  sym *s_level_next;      /* next symbol declared on the same
+                                        * level */
 } sym_t;
 
 #define        s_styp  u._s_st
@@ -387,8 +389,8 @@
        sym_t   *d_func_args;   /* list of arguments during function def. */
        pos_t   d_func_def_pos; /* position of function definition */
        sym_t   *d_dlsyms;      /* first symbol declared at this level */
-       sym_t   **d_ldlsym;     /* points to s_dlnxt in last symbol decl.
-                                  at this level */
+       sym_t   **d_ldlsym;     /* points to s_level_next in the last symbol
+                                  declaration at this level */
        sym_t   *d_func_proto_syms; /* symbols defined in prototype */
        struct  dinfo *d_next;  /* next level */
 } dinfo_t;
diff -r 5cc9294210b6 -r 7df9ad271d18 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Feb 27 10:31:58 2022 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Feb 27 10:44:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.406 2022/02/27 10:31:58 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.407 2022/02/27 10:44:45 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.406 2022/02/27 10:31:58 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.407 2022/02/27 10:44:45 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -379,7 +379,7 @@
         * If this struct/union has a member with the name of msym, return it.
         */
        if (str != NULL) {
-               for (sym = msym; sym != NULL; sym = sym->s_link) {
+               for (sym = msym; sym != NULL; sym = sym->s_symtab_next) {
                        if (sym->s_scl != MOS && sym->s_scl != MOU)
                                continue;
                        if (sym->s_styp != str)
@@ -395,12 +395,13 @@
         * name and different types and/or offsets.
         */
        eq = true;
-       for (csym = msym; csym != NULL; csym = csym->s_link) {
+       for (csym = msym; csym != NULL; csym = csym->s_symtab_next) {
                if (csym->s_scl != MOS && csym->s_scl != MOU)
                        continue;
                if (strcmp(msym->s_name, csym->s_name) != 0)
                        continue;
-               for (sym = csym->s_link; sym != NULL; sym = sym->s_link) {
+               for (sym = csym->s_symtab_next; sym != NULL;
+                   sym = sym->s_symtab_next) {
                        bool w;
 
                        if (sym->s_scl != MOS && sym->s_scl != MOU)



Home | Main Index | Thread Index | Old Index