Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint lint: rename t_isenum and t_aincompl to be mor...



details:   https://anonhg.NetBSD.org/src/rev/bbef57d64820
branches:  trunk
changeset: 980816:bbef57d64820
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Feb 19 22:27:49 2021 +0000

description:
lint: rename t_isenum and t_aincompl to be more expressive

No functional change.

diffstat:

 usr.bin/xlint/common/tyname.c |   6 +++---
 usr.bin/xlint/lint1/decl.c    |  10 +++++-----
 usr.bin/xlint/lint1/emit1.c   |   6 +++---
 usr.bin/xlint/lint1/func.c    |  10 +++++-----
 usr.bin/xlint/lint1/lint1.h   |   6 +++---
 usr.bin/xlint/lint1/tree.c    |  24 ++++++++++++------------
 usr.bin/xlint/lint2/chk.c     |   8 ++++----
 usr.bin/xlint/lint2/emit2.c   |   6 +++---
 usr.bin/xlint/lint2/lint2.h   |   8 ++++----
 usr.bin/xlint/lint2/read.c    |   6 +++---
 10 files changed, 45 insertions(+), 45 deletions(-)

diffs (truncated from 374 to 300 lines):

diff -r 7479913daaf4 -r bbef57d64820 usr.bin/xlint/common/tyname.c
--- a/usr.bin/xlint/common/tyname.c     Fri Feb 19 22:20:18 2021 +0000
+++ b/usr.bin/xlint/common/tyname.c     Fri Feb 19 22:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tyname.c,v 1.28 2021/02/19 22:20:18 rillig Exp $       */
+/*     $NetBSD: tyname.c,v 1.29 2021/02/19 22:27:49 rillig Exp $       */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.28 2021/02/19 22:20:18 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.29 2021/02/19 22:27:49 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -294,7 +294,7 @@
         * XXX: Why is this necessary, and in which cases does this apply?
         * Shouldn't the type be an ENUM from the beginning?
         */
-       if ((t = tp->t_tspec) == INT && tp->t_isenum)
+       if ((t = tp->t_tspec) == INT && tp->t_is_enum)
                t = ENUM;
 
        buf_init(&buf);
diff -r 7479913daaf4 -r bbef57d64820 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Fri Feb 19 22:20:18 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Fri Feb 19 22:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.135 2021/02/19 22:20:18 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.136 2021/02/19 22:27:49 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.135 2021/02/19 22:20:18 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.136 2021/02/19 22:27:49 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -179,7 +179,7 @@
        if ((t = tp->t_tspec) == VOID) {
                return true;
        } else if (t == ARRAY) {
-               return tp->t_aincompl;
+               return tp->t_incomplete_array;
        } else if (t == STRUCT || t == UNION) {
                return tp->t_str->sou_incomplete;
        } else if (t == ENUM) {
@@ -197,7 +197,7 @@
        tspec_t t;
 
        if ((t = tp->t_tspec) == ARRAY) {
-               tp->t_aincompl = !complete;
+               tp->t_incomplete_array = !complete;
        } else if (t == STRUCT || t == UNION) {
                tp->t_str->sou_incomplete = !complete;
        } else {
@@ -1665,7 +1665,7 @@
                        tp->t_str->sou_align_in_bit = CHAR_SIZE;
                        tp->t_str->sou_tag = tag;
                } else {
-                       tp->t_isenum = true;
+                       tp->t_is_enum = true;
                        tp->t_enum = getblk(sizeof(*tp->t_enum));
                        tp->t_enum->en_tag = tag;
                }
diff -r 7479913daaf4 -r bbef57d64820 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c       Fri Feb 19 22:20:18 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c       Fri Feb 19 22:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.41 2021/02/19 22:20:18 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.42 2021/02/19 22:27:49 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: emit1.c,v 1.41 2021/02/19 22:20:18 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.42 2021/02/19 22:27:49 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -99,7 +99,7 @@
        tspec_t ts;
 
        while (tp != NULL) {
-               if ((ts = tp->t_tspec) == INT && tp->t_isenum)
+               if ((ts = tp->t_tspec) == INT && tp->t_is_enum)
                        ts = ENUM;
                switch (ts) {
                case BOOL:      t = 'B';        s = '\0';       break;
diff -r 7479913daaf4 -r bbef57d64820 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Fri Feb 19 22:20:18 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c        Fri Feb 19 22:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.70 2021/02/19 22:20:18 rillig Exp $ */
+/*     $NetBSD: func.c,v 1.71 2021/02/19 22:27:49 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.70 2021/02/19 22:20:18 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.71 2021/02/19 22:27:49 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -637,7 +637,7 @@
        tp = xcalloc(1, sizeof (type_t));
        if (tn != NULL) {
                tp->t_tspec = tn->tn_type->t_tspec;
-               if ((tp->t_isenum = tn->tn_type->t_isenum) != false)
+               if ((tp->t_is_enum = tn->tn_type->t_is_enum) != false)
                        tp->t_enum = tn->tn_type->t_enum;
        } else {
                tp->t_tspec = INT;
@@ -671,7 +671,7 @@
         * labels and the number of enumerators. If both counts are not
         * equal print a warning.
         */
-       if (cstmt->c_swtype->t_isenum) {
+       if (cstmt->c_swtype->t_is_enum) {
                nenum = nclab = 0;
                lint_assert(cstmt->c_swtype->t_enum != NULL);
                for (esym = cstmt->c_swtype->t_enum->en_first_enumerator;
@@ -695,7 +695,7 @@
                 */
                reached = true;
        } else if (!cstmt->c_default &&
-                  (!hflag || !cstmt->c_swtype->t_isenum || nenum != nclab)) {
+                  (!hflag || !cstmt->c_swtype->t_is_enum || nenum != nclab)) {
                /*
                 * there are possible values which are not handled in
                 * switch
diff -r 7479913daaf4 -r bbef57d64820 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Fri Feb 19 22:20:18 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Fri Feb 19 22:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.63 2021/02/19 22:20:18 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.64 2021/02/19 22:27:49 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -150,14 +150,14 @@
  */
 struct type {
        tspec_t t_tspec;        /* type specifier */
-       bool    t_aincompl : 1; /* incomplete array type */
+       bool    t_incomplete_array : 1;
        bool    t_const : 1;    /* const modifier */
        bool    t_volatile : 1; /* volatile modifier */
        bool    t_proto : 1;    /* function prototype (t_args valid) */
        bool    t_vararg : 1;   /* prototype with '...' */
        bool    t_typedef : 1;  /* type defined with typedef */
        bool    t_bitfield : 1;
-       bool    t_isenum : 1;   /* type is (or was) enum (t_enum valid) */
+       bool    t_is_enum : 1;  /* type is (or was) enum (t_enum valid) */
        bool    t_packed : 1;
        union {
                int     _t_dim;         /* dimension */
diff -r 7479913daaf4 -r bbef57d64820 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Fri Feb 19 22:20:18 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Fri Feb 19 22:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.208 2021/02/19 22:16:12 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.209 2021/02/19 22:27:49 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.208 2021/02/19 22:16:12 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.209 2021/02/19 22:27:49 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -1456,13 +1456,13 @@
            const tnode_t *rn, const type_t *rtp)
 {
        if (mp->m_bad_on_enum &&
-           (ltp->t_isenum || (mp->m_binary && rtp->t_isenum))) {
+           (ltp->t_is_enum || (mp->m_binary && rtp->t_is_enum))) {
                check_bad_enum_operation(op, ln, rn);
        } else if (mp->m_valid_on_enum &&
-                  (ltp->t_isenum && rtp != NULL && rtp->t_isenum)) {
+                  (ltp->t_is_enum && rtp != NULL && rtp->t_is_enum)) {
                check_enum_type_mismatch(op, arg, ln, rn);
        } else if (mp->m_valid_on_enum &&
-                  (ltp->t_isenum || (rtp != NULL && rtp->t_isenum))) {
+                  (ltp->t_is_enum || (rtp != NULL && rtp->t_is_enum))) {
                check_enum_int_mismatch(op, arg, ln, rn);
        }
 }
@@ -1692,8 +1692,8 @@
 
        mp = &modtab[op];
 
-       if (!(ln->tn_type->t_isenum ||
-             (mp->m_binary && rn->tn_type->t_isenum))) {
+       if (!(ln->tn_type->t_is_enum ||
+             (mp->m_binary && rn->tn_type->t_is_enum))) {
                return;
        }
 
@@ -1702,8 +1702,8 @@
         * could not be used as array indices).
         */
        if (op == PLUS &&
-           ((ln->tn_type->t_isenum && rn->tn_type->t_tspec == PTR) ||
-            (rn->tn_type->t_isenum && ln->tn_type->t_tspec == PTR))) {
+           ((ln->tn_type->t_is_enum && rn->tn_type->t_tspec == PTR) ||
+            (rn->tn_type->t_is_enum && ln->tn_type->t_tspec == PTR))) {
                return;
        }
 
@@ -1764,7 +1764,7 @@
                 * Initialization with 0 is allowed. Otherwise, all implicit
                 * initializations would need to be warned upon as well.
                 */
-               if (!rn->tn_type->t_isenum && rn->tn_op == CON &&
+               if (!rn->tn_type->t_is_enum && rn->tn_op == CON &&
                    is_integer(rn->tn_type->t_tspec) &&
                    rn->tn_val->v_quad == 0) {
                        return;
@@ -1929,7 +1929,7 @@
                ntp = tduptyp(tn->tn_type);
                ntp->t_tspec = t;
                /*
-                * Keep t_isenum so we are later able to check compatibility
+                * Keep t_is_enum so we are later able to check compatibility
                 * of enum types.
                 */
                tn = convert(op, 0, ntp, tn);
@@ -3622,7 +3622,7 @@
                        error(152, n);
                        return NULL;
                } else if (is_integer(at) &&
-                          arg->tn_left->tn_type->t_isenum &&
+                          arg->tn_left->tn_type->t_is_enum &&
                           is_incomplete(arg->tn_left->tn_type)) {
                        /* argument cannot have unknown size, arg #%d */
                        warning(152, n);
diff -r 7479913daaf4 -r bbef57d64820 usr.bin/xlint/lint2/chk.c
--- a/usr.bin/xlint/lint2/chk.c Fri Feb 19 22:20:18 2021 +0000
+++ b/usr.bin/xlint/lint2/chk.c Fri Feb 19 22:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chk.c,v 1.37 2021/01/24 00:15:20 rillig Exp $ */
+/* $NetBSD: chk.c,v 1.38 2021/02/19 22:27:49 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: chk.c,v 1.37 2021/01/24 00:15:20 rillig Exp $");
+__RCSID("$NetBSD: chk.c,v 1.38 2021/02/19 22:27:49 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -496,7 +496,7 @@
        t1 = arg1->t_tspec;
        t2 = arg2->t_tspec;
        if (is_integer(t1) && is_integer(t2) &&
-           !arg1->t_isenum && !arg2->t_isenum) {
+           !arg1->t_is_enum && !arg2->t_is_enum) {
                if (promote) {
                        /*
                         * XXX Here is a problem: Although it is possible to
@@ -1244,7 +1244,7 @@
                                return false;
                }
 
-               if (tp1->t_isenum && tp2->t_isenum) {
+               if (tp1->t_is_enum && tp2->t_is_enum) {
                        if (tp1->t_istag && tp2->t_istag) {
                                return tp1->t_tag == tp2->t_tag;
                        } else if (tp1->t_istynam && tp2->t_istynam) {
diff -r 7479913daaf4 -r bbef57d64820 usr.bin/xlint/lint2/emit2.c
--- a/usr.bin/xlint/lint2/emit2.c       Fri Feb 19 22:20:18 2021 +0000
+++ b/usr.bin/xlint/lint2/emit2.c       Fri Feb 19 22:27:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit2.c,v 1.15 2020/12/30 10:26:12 rillig Exp $ */
+/* $NetBSD: emit2.c,v 1.16 2021/02/19 22:27:49 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@



Home | Main Index | Thread Index | Old Index