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: rename 'blklev' to 'block_level'



details:   https://anonhg.NetBSD.org/src/rev/6ef9ca786a5b
branches:  trunk
changeset: 960376:6ef9ca786a5b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Mar 17 01:15:31 2021 +0000

description:
lint: rename 'blklev' to 'block_level'

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y    |  60 +++++++++++++++++++++---------------------
 usr.bin/xlint/lint1/decl.c     |  49 +++++++++++++++++----------------
 usr.bin/xlint/lint1/externs1.h |   6 ++--
 usr.bin/xlint/lint1/func.c     |   8 ++--
 usr.bin/xlint/lint1/lex.c      |  32 +++++++++++-----------
 usr.bin/xlint/lint1/lint1.h    |   4 +-
 usr.bin/xlint/lint1/mem1.c     |  12 ++++----
 usr.bin/xlint/lint1/tree.c     |   8 ++--
 8 files changed, 90 insertions(+), 89 deletions(-)

diffs (truncated from 685 to 300 lines):

diff -r 407e7f17f11c -r 6ef9ca786a5b usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Wed Mar 17 01:07:33 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Wed Mar 17 01:15:31 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.170 2021/03/17 01:07:33 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.171 2021/03/17 01:15:31 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.170 2021/03/17 01:07:33 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.171 2021/03/17 01:15:31 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -50,15 +50,15 @@
  * Contains the level of current declaration, used for symbol table entries.
  * 0 is the top-level, > 0 is inside a function body.
  */
-int    blklev;
+int    block_level;
 
 /*
- * level for memory allocation. Normally the same as blklev.
+ * level for memory allocation. Normally the same as block_level.
  * An exception is the declaration of arguments in prototypes. Memory
  * for these can't be freed after the declaration, but symbols must
  * be removed from the symbol table after the declaration.
  */
-int    mblklev;
+int    mem_block_level;
 
 /*
  * Save the no-warns state and restore it to avoid the problem where
@@ -423,13 +423,13 @@
                        YYERROR;
                }
                funcdef($1);
-               blklev++;
+               block_level++;
                pushdecl(ARG);
                if (lwarn == LWARN_NONE)
                        $1->s_used = true;
          } arg_declaration_list_opt {
                popdecl();
-               blklev--;
+               block_level--;
                check_func_lint_directives();
                check_func_old_style_arguments();
                pushctrl(0);
@@ -1048,7 +1048,7 @@
        | notype_direct_decl param_list opt_asm_or_symbolrename {
                $$ = add_function(symbolrename($1, $3), $2);
                popdecl();
-               blklev--;
+               block_level--;
          }
        | notype_direct_decl type_attribute_list
        ;
@@ -1081,7 +1081,7 @@
        | type_direct_decl param_list opt_asm_or_symbolrename {
                $$ = add_function(symbolrename($1, $3), $2);
                popdecl();
-               blklev--;
+               block_level--;
          }
        | type_direct_decl type_attribute_list
        ;
@@ -1121,7 +1121,7 @@
        | direct_param_decl param_list opt_asm_or_symbolrename {
                $$ = add_function(symbolrename($1, $3), $2);
                popdecl();
-               blklev--;
+               block_level--;
          }
        ;
 
@@ -1150,7 +1150,7 @@
        | direct_notype_param_decl param_list opt_asm_or_symbolrename {
                $$ = add_function(symbolrename($1, $3), $2);
                popdecl();
-               blklev--;
+               block_level--;
          }
        ;
 
@@ -1210,7 +1210,7 @@
 
 id_list_lparen:
          T_LPAREN {
-               blklev++;
+               block_level++;
                pushdecl(PROTO_ARG);
          }
        ;
@@ -1242,7 +1242,7 @@
 
 abstract_decl_lparen:
          T_LPAREN {
-               blklev++;
+               block_level++;
                pushdecl(PROTO_ARG);
          }
        ;
@@ -1459,12 +1459,12 @@
        | abstract_decl_param_list opt_asm_or_symbolrename {
                $$ = add_function(symbolrename(abstract_name(), $2), $1);
                popdecl();
-               blklev--;
+               block_level--;
          }
        | direct_abstract_decl abstract_decl_param_list opt_asm_or_symbolrename {
                $$ = add_function(symbolrename($1, $3), $2);
                popdecl();
-               blklev--;
+               block_level--;
          }
        | direct_abstract_decl type_attribute_list
        ;
@@ -1527,8 +1527,8 @@
 
 compound_statement_lbrace:
          T_LBRACE {
-               blklev++;
-               mblklev++;
+               block_level++;
+               mem_block_level++;
                pushdecl(AUTO);
          }
        ;
@@ -1537,8 +1537,8 @@
          T_RBRACE {
                popdecl();
                freeblk();
-               mblklev--;
-               blklev--;
+               mem_block_level--;
+               block_level--;
                ftflg = false;
          }
        ;
@@ -1677,13 +1677,13 @@
                CLEAR_WARN_FLAGS(__FILE__, __LINE__);
                for2();
                popdecl();
-               blklev--;
+               block_level--;
          }
        | for_exprs error {
                CLEAR_WARN_FLAGS(__FILE__, __LINE__);
                for2();
                popdecl();
-               blklev--;
+               block_level--;
          }
        ;
 
@@ -1709,7 +1709,7 @@
 for_start:
          T_FOR T_LPAREN {
                pushdecl(AUTO);
-               blklev++;
+               block_level++;
          }
        ;
 for_exprs:
@@ -1867,22 +1867,22 @@
          }
        | T_LPAREN compound_statement_lbrace declaration_list
            expr_statement_list {
-               blklev--;
-               mblklev--;
+               block_level--;
+               mem_block_level--;
                initsym = mktempsym(duptyp($4->tn_type));
-               mblklev++;
-               blklev++;
+               mem_block_level++;
+               block_level++;
                /* ({ }) is a GCC extension */
                gnuism(320);
         } compound_statement_rbrace T_RPAREN {
                $$ = new_name_node(initsym, 0);
         }
        | T_LPAREN compound_statement_lbrace expr_statement_list {
-               blklev--;
-               mblklev--;
+               block_level--;
+               mem_block_level--;
                initsym = mktempsym($3->tn_type);
-               mblklev++;
-               blklev++;
+               mem_block_level++;
+               block_level++;
                /* ({ }) is a GCC extension */
                gnuism(320);
         } compound_statement_rbrace T_RPAREN {
diff -r 407e7f17f11c -r 6ef9ca786a5b usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Wed Mar 17 01:07:33 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Wed Mar 17 01:15:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.143 2021/02/28 18:51:51 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.144 2021/03/17 01:15:31 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.143 2021/02/28 18:51:51 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.144 2021/03/17 01:15:31 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1255,7 +1255,7 @@
                dsym->s_kind = FMEMBER;
                dsym->s_scl = MOS;
                dsym->s_type = gettyp(UINT);
-               dsym->s_blklev = -1;
+               dsym->s_block_level = -1;
        }
        dsym->s_type = duptyp(dsym->s_type);
        dsym->s_type->t_bitfield = true;
@@ -1606,7 +1606,7 @@
 {
 
        if (sym->s_scl != NOSCL) {
-               if (blklev == sym->s_blklev) {
+               if (block_level == sym->s_block_level) {
                        /* redeclaration of formal parameter %s */
                        error(21, sym->s_name);
                        lint_assert(sym->s_defarg);
@@ -1669,7 +1669,7 @@
                UNIQUE_CURR_POS(tag->s_def_pos);
                tag->s_kind = FTAG;
                tag->s_scl = scl;
-               tag->s_blklev = -1;
+               tag->s_block_level = -1;
                tag->s_type = tp = getblk(sizeof (type_t));
                tp->t_packed = dcs->d_packed;
                dcs->d_next->d_nedecl = true;
@@ -1700,7 +1700,7 @@
 newtag(sym_t *tag, scl_t scl, bool decl, bool semi)
 {
 
-       if (tag->s_blklev < blklev) {
+       if (tag->s_block_level < block_level) {
                if (semi) {
                        /* "struct a;" */
                        if (!tflag) {
@@ -1846,7 +1846,7 @@
 {
 
        if (sym->s_scl != NOSCL) {
-               if (sym->s_blklev == blklev) {
+               if (sym->s_block_level == block_level) {
                        /* no hflag, because this is illegal!!! */
                        if (sym->s_arg) {
                                /* enumeration constant hides parameter: %s */
@@ -1859,7 +1859,7 @@
                                 * complicated to find the position of the
                                 * previous declaration
                                 */
-                               if (blklev == 0)
+                               if (block_level == 0)
                                        print_previous_declaration(-1, sym);
                        }
                } else {
@@ -2355,7 +2355,8 @@
 
        check_type(sym);
 
-       if (dcs->d_rdcsym != NULL && dcs->d_rdcsym->s_blklev == blklev) {
+       if (dcs->d_rdcsym != NULL &&
+           dcs->d_rdcsym->s_block_level == block_level) {
                /* redeclaration of formal parameter %s */
                error(237, sym->s_name);
                rmsym(dcs->d_rdcsym);
@@ -2641,7 +2642,7 @@
 
        if (dcs->d_rdcsym != NULL) {
 
-               if (dcs->d_rdcsym->s_blklev == 0) {
+               if (dcs->d_rdcsym->s_block_level == 0) {
 
                        switch (dsym->s_scl) {
                        case AUTO:
@@ -2669,7 +2670,7 @@
                                lint_assert(/*CONSTCOND*/false);
                        }
 
-               } else if (dcs->d_rdcsym->s_blklev == blklev) {
+               } else if (dcs->d_rdcsym->s_block_level == block_level) {
 
                        /* no hflag, because it's illegal! */



Home | Main Index | Thread Index | Old Index