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: prepare renaming of 'struct type'



details:   https://anonhg.NetBSD.org/src/rev/99c84f91b979
branches:  trunk
changeset: 961098:99c84f91b979
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Apr 10 18:06:53 2021 +0000

description:
lint: prepare renaming of 'struct type'

It's confusing to have the same struct tag in both lint1 and lint2, with
mostly the same members, but also some differences.  Before actually
changing this, I reviewed all occurrences of the word 'type' in the
code.

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c  |  5 +++--
 usr.bin/xlint/lint1/func.c  |  9 +++------
 usr.bin/xlint/lint1/lint1.h |  9 +++++----
 usr.bin/xlint/lint1/tree.c  |  8 ++++++--
 4 files changed, 17 insertions(+), 14 deletions(-)

diffs (115 lines):

diff -r 8647dc61b981 -r 99c84f91b979 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Apr 10 15:34:05 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Apr 10 18:06:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.171 2021/04/09 20:12:00 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.172 2021/04/10 18:06:53 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.171 2021/04/09 20:12:00 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.172 2021/04/10 18:06:53 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -141,6 +141,7 @@
 gettyp(tspec_t t)
 {
 
+       /* TODO: make the return type 'const' */
        return &typetab[t];
 }
 
diff -r 8647dc61b981 -r 99c84f91b979 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Sat Apr 10 15:34:05 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c        Sat Apr 10 18:06:53 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.102 2021/04/02 15:06:35 rillig Exp $        */
+/*     $NetBSD: func.c,v 1.103 2021/04/10 18:06:53 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.102 2021/04/02 15:06:35 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.103 2021/04/10 18:06:53 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -519,10 +519,7 @@
        } else {
                check_getopt_case_label(nv.v_quad);
 
-               /*
-                * append the value to the list of
-                * case values
-                */
+               /* append the value to the list of case values */
                cl = xcalloc(1, sizeof(*cl));
                cl->cl_val = nv;
                cl->cl_next = ci->c_case_labels;
diff -r 8647dc61b981 -r 99c84f91b979 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sat Apr 10 15:34:05 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sat Apr 10 18:06:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.92 2021/04/02 22:05:43 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.93 2021/04/10 18:06:53 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -145,8 +145,8 @@
 } enumeration;
 
 /*
- * Types are represented by concatenation of structures of type type_t
- * via t_subt.
+ * The type of an expression or object. Complex types are formed via t_subt
+ * (for arrays, pointers and functions), as well as t_str.
  */
 struct type {
        tspec_t t_tspec;        /* type specifier */
@@ -371,7 +371,8 @@
 } pqinf_t;
 
 /*
- * Case values are stored in a list of type case_label_t.
+ * The values of the 'case' labels, linked via cl_next in reverse order of
+ * appearance in the code, that is from bottom to top.
  */
 typedef        struct case_label {
        val_t   cl_val;
diff -r 8647dc61b981 -r 99c84f91b979 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sat Apr 10 15:34:05 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sat Apr 10 18:06:53 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.275 2021/04/09 21:42:12 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.276 2021/04/10 18:06:53 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.275 2021/04/09 21:42:12 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.276 2021/04/10 18:06:53 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2111,6 +2111,10 @@
        int64_t xmask, xmsk1;
        int     osz, nsz;
 
+       /*
+        * TODO: make 'v' const; the name of this function does not suggest
+        *  that it modifies 'v'.
+        */
        ot = v->v_tspec;
        nt = nv->v_tspec = tp->t_tspec;
        rchk = false;



Home | Main Index | Thread Index | Old Index