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 storage class constants to ...



details:   https://anonhg.NetBSD.org/src/rev/786034a0aa86
branches:  trunk
changeset: 952855:786034a0aa86
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Feb 19 22:35:42 2021 +0000

description:
lint: rename storage class constants to be more expressive

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |   8 ++++----
 usr.bin/xlint/lint1/decl.c  |  34 +++++++++++++++++-----------------
 usr.bin/xlint/lint1/lint1.h |  25 +++++++++++++------------
 3 files changed, 34 insertions(+), 33 deletions(-)

diffs (216 lines):

diff -r fd77e6500fdd -r 786034a0aa86 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Fri Feb 19 22:27:49 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Fri Feb 19 22:35:42 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.161 2021/02/19 22:16:12 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.162 2021/02/19 22:35:42 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.161 2021/02/19 22:16:12 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.162 2021/02/19 22:35:42 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1212,7 +1212,7 @@
 id_list_lparn:
          T_LPAREN {
                blklev++;
-               pushdecl(PARG);
+               pushdecl(PROTO_ARG);
          }
        ;
 
@@ -1244,7 +1244,7 @@
 abstract_decl_lparn:
          T_LPAREN {
                blklev++;
-               pushdecl(PARG);
+               pushdecl(PROTO_ARG);
          }
        ;
 
diff -r fd77e6500fdd -r 786034a0aa86 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Fri Feb 19 22:27:49 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Fri Feb 19 22:35:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.136 2021/02/19 22:27:49 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.137 2021/02/19 22:35:42 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.136 2021/02/19 22:27:49 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.137 2021/02/19 22:35:42 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -654,7 +654,7 @@
                /* check usage of local vars */
                check_usage(di);
                /* FALLTHROUGH */
-       case PARG:
+       case PROTO_ARG:
                /* usage of arguments will be checked by funcend() */
                rmsyms(di->d_dlsyms);
                break;
@@ -825,7 +825,7 @@
                        error(8);
                        scl = NOSCL;
                }
-       } else if (dcs->d_ctx == ARG || dcs->d_ctx == PARG) {
+       } else if (dcs->d_ctx == ARG || dcs->d_ctx == PROTO_ARG) {
                if (scl != NOSCL && scl != REG) {
                        /* only register valid as formal parameter storage... */
                        error(9);
@@ -1015,7 +1015,7 @@
                                }
                                return;
                        } else if (tp->t_const || tp->t_volatile) {
-                               if (sflag) {    /* XXX oder better !tflag ? */
+                               if (sflag) {    /* XXX or better !tflag ? */
                                        /* function cannot return const... */
                                        warning(228);
                                }
@@ -1047,7 +1047,7 @@
 #endif
                        }
                } else if (to == NOTSPEC && t == VOID) {
-                       if (dcs->d_ctx == PARG) {
+                       if (dcs->d_ctx == PROTO_ARG) {
                                if (sym->s_scl != ABSTRACT) {
                                        lint_assert(sym->s_name != unnamed);
                                        /* void param. cannot have name: %s */
@@ -1414,7 +1414,7 @@
         */
        for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
                sc = sym->s_scl;
-               if (sc == STRTAG || sc == UNIONTAG || sc == ENUMTAG) {
+               if (sc == STRUCT_TAG || sc == UNION_TAG || sc == ENUM_TAG) {
                        /* dubious tag declaration: %s %s */
                        warning(85, storage_class_name(sc), sym->s_name);
                }
@@ -1534,7 +1534,7 @@
                        sym->s_def = DECL;
                }
                break;
-       case PARG:
+       case PROTO_ARG:
                sym->s_arg = true;
                /* FALLTHROUGH */
        case ARG:
@@ -1619,12 +1619,12 @@
        type_t  *tp;
 
        if (kind == STRUCT) {
-               scl = STRTAG;
+               scl = STRUCT_TAG;
        } else if (kind == UNION) {
-               scl = UNIONTAG;
+               scl = UNION_TAG;
        } else {
                lint_assert(kind == ENUM);
-               scl = ENUMTAG;
+               scl = ENUM_TAG;
        }
 
        if (tag != NULL) {
@@ -1633,7 +1633,7 @@
                } else {
                        /* a new tag, no empty declaration */
                        dcs->d_next->d_nedecl = true;
-                       if (scl == ENUMTAG && !decl) {
+                       if (scl == ENUM_TAG && !decl) {
                                if (!tflag && (sflag || pflag))
                                        /* forward reference to enum type */
                                        warning(42);
@@ -1749,9 +1749,9 @@
        case AUTO:      s = "auto";     break;
        case REG:       s = "register"; break;
        case TYPEDEF:   s = "typedef";  break;
-       case STRTAG:    s = "struct";   break;
-       case UNIONTAG:  s = "union";    break;
-       case ENUMTAG:   s = "enum";     break;
+       case STRUCT_TAG:s = "struct";   break;
+       case UNION_TAG: s = "union";    break;
+       case ENUM_TAG:  s = "enum";     break;
        default:        lint_assert(/*CONSTCOND*/false);
        }
        return s;
@@ -2798,7 +2798,7 @@
 {
        sym_t   *sym;
 
-       lint_assert(dcs->d_ctx == ABSTRACT || dcs->d_ctx == PARG);
+       lint_assert(dcs->d_ctx == ABSTRACT || dcs->d_ctx == PROTO_ARG);
 
        sym = getblk(sizeof (sym_t));
 
@@ -2807,7 +2807,7 @@
        sym->s_scl = ABSTRACT;
        sym->s_blklev = -1;
 
-       if (dcs->d_ctx == PARG)
+       if (dcs->d_ctx == PROTO_ARG)
                sym->s_arg = true;
 
        sym->s_type = dcs->d_type;
diff -r fd77e6500fdd -r 786034a0aa86 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Fri Feb 19 22:27:49 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Fri Feb 19 22:35:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.64 2021/02/19 22:27:49 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.65 2021/02/19 22:35:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -200,15 +200,15 @@
        AUTO,           /* automatic symbols (except register) */
        REG,            /* register */
        TYPEDEF,        /* typedef */
-       STRTAG,
-       UNIONTAG,
-       ENUMTAG,
+       STRUCT_TAG,
+       UNION_TAG,
+       ENUM_TAG,
        MOS,            /* member of struct */
        MOU,            /* member of union */
        CTCONST,        /* enumerator, enum constant or bool constant */
        ABSTRACT,       /* abstract symbol (sizeof, casts, unnamed argument) */
        ARG,            /* argument */
-       PARG,           /* used in declaration stack during prototype
+       PROTO_ARG,      /* used in declaration stack during prototype
                           declaration */
        INLINE          /* only used by the parser */
 } scl_t;
@@ -313,13 +313,14 @@
  *
  * ctx describes the context of the current declaration. Its value is
  * one of
- *     EXTERN  global declarations
- *     MOS oder MOU declarations of struct or union members
- *     CTCONST declarations of enums
- *     ARG     declaration of arguments in old style function definitions
- *     PARG    declaration of arguments in function prototypes
- *     AUTO    declaration of local symbols
- *     ABSTRACT abstract declarations (sizeof, casts)
+ *     EXTERN          global declarations
+ *     MOS or MOU      declarations of struct or union members
+ *     CTCONST         declarations of enums
+ *     ARG             declaration of arguments in old style function
+ *                     definitions
+ *     PROTO_ARG       declaration of arguments in function prototypes
+ *     AUTO            declaration of local symbols
+ *     ABSTRACT        abstract declarations (sizeof, casts)
  *
  */
 typedef        struct dinfo {



Home | Main Index | Thread Index | Old Index