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 ARG to OLD_STYLE_ARG



details:   https://anonhg.NetBSD.org/src/rev/324b93e3b61f
branches:  trunk
changeset: 362043:324b93e3b61f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 27 01:47:28 2022 +0000

description:
lint: rename ARG to OLD_STYLE_ARG

Pre-C90 argument declarations have been old for more than 30 years now,
so mention that fact in the constant name.  This reduces potential
confusion with other occurrences of the words 'arg' or 'argument'.

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |   6 +++---
 usr.bin/xlint/lint1/decl.c  |  18 +++++++++---------
 usr.bin/xlint/lint1/lint1.h |   8 ++++----
 3 files changed, 16 insertions(+), 16 deletions(-)

diffs (138 lines):

diff -r 982d53a86d76 -r 324b93e3b61f usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Feb 27 01:03:14 2022 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Feb 27 01:47:28 2022 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.381 2022/02/26 20:36:11 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.382 2022/02/27 01:47:28 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.381 2022/02/26 20:36:11 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.382 2022/02/27 01:47:28 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1970,7 +1970,7 @@
                }
                funcdef($1);
                block_level++;
-               begin_declaration_level(ARG);
+               begin_declaration_level(OLD_STYLE_ARG);
                if (lwarn == LWARN_NONE)
                        $1->s_used = true;
          } arg_declaration_list_opt {
diff -r 982d53a86d76 -r 324b93e3b61f usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sun Feb 27 01:03:14 2022 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sun Feb 27 01:47:28 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.244 2022/02/07 02:44:49 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.245 2022/02/27 01:47:28 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.244 2022/02/07 02:44:49 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.245 2022/02/27 01:47:28 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -148,8 +148,8 @@
        static const char *const names[] = {
            "none", "extern", "static", "auto", "register", "typedef",
            "struct", "union", "enum", "member of struct", "member of union",
-           "compile-time constant", "abstract", "argument",
-           "prototype argument", "inline"
+           "compile-time constant", "abstract",
+           "old-style function argument", "prototype argument", "inline"
        };
 
        return names[scl];
@@ -498,7 +498,7 @@
  * Remember the symbol of a typedef name (2nd arg) in a struct, union
  * or enum tag if the typedef name is the first defined for this tag.
  *
- * If the tag is unnamed, the typdef name is used for identification
+ * If the tag is unnamed, the typedef name is used for identification
  * of this tag in lint2. Although it's possible that more than one typedef
  * name is defined for one tag, the first name defined should be unique
  * if the tag is unnamed.
@@ -651,7 +651,7 @@
                if ((*dcs->d_ldlsym = di->d_dlsyms) != NULL)
                        dcs->d_ldlsym = di->d_ldlsym;
                break;
-       case ARG:
+       case OLD_STYLE_ARG:
                /*
                 * All symbols in dcs->d_dlsyms are introduced in old style
                 * argument declarations (it's not clean, but possible).
@@ -751,7 +751,7 @@
                        error(8);
                        dcs->d_scl = NOSCL;
                }
-       } else if (dcs->d_ctx == ARG || dcs->d_ctx == PROTO_ARG) {
+       } else if (dcs->d_ctx == OLD_STYLE_ARG || dcs->d_ctx == PROTO_ARG) {
                if (dcs->d_scl != NOSCL && dcs->d_scl != REG) {
                        /* only register valid as formal parameter storage... */
                        error(9);
@@ -1565,7 +1565,7 @@
        case PROTO_ARG:
                sym->s_arg = true;
                /* FALLTHROUGH */
-       case ARG:
+       case OLD_STYLE_ARG:
                if ((sc = dcs->d_scl) == NOSCL) {
                        sc = AUTO;
                } else {
@@ -2027,7 +2027,7 @@
 
        if (dcs->d_ctx == EXTERN) {
                declare_extern(decl, initflg, renaming);
-       } else if (dcs->d_ctx == ARG || dcs->d_ctx == PROTO_ARG) {
+       } else if (dcs->d_ctx == OLD_STYLE_ARG || dcs->d_ctx == PROTO_ARG) {
                if (renaming != NULL) {
                        /* symbol renaming can't be used on function arguments */
                        error(310);
diff -r 982d53a86d76 -r 324b93e3b61f usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sun Feb 27 01:03:14 2022 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sun Feb 27 01:47:28 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.135 2022/02/07 21:57:47 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.136 2022/02/27 01:47:28 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -226,7 +226,7 @@
        MOU,            /* member of union */
        CTCONST,        /* enumerator, enum constant or bool constant */
        ABSTRACT,       /* abstract symbol (sizeof, casts, unnamed argument) */
-       ARG,            /* argument */
+       OLD_STYLE_ARG,  /* old-style function argument declarations */
        PROTO_ARG,      /* used in declaration stack during prototype
                           declaration */
        INLINE          /* only used by the parser */
@@ -342,7 +342,7 @@
 };
 
 /*
- * For nested declarations a stack exists, which holds all information
+ * For nested declarations there is a stack that holds all information
  * needed for the current level. dcs points to the innermost element of this
  * stack.
  *
@@ -351,7 +351,7 @@
  *     EXTERN          global declarations
  *     MOS or MOU      declarations of struct or union members
  *     CTCONST         declarations of enums or boolean constants
- *     ARG             declaration of arguments in old-style function
+ *     OLD_STYLE_ARG   declaration of arguments in old-style function
  *                     definitions
  *     PROTO_ARG       declaration of arguments in function prototypes
  *     AUTO            declaration of local symbols



Home | Main Index | Thread Index | Old Index