Module Name:    src
Committed By:   rillig
Date:           Sat Apr 10 18:06:53 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: decl.c func.c lint1.h tree.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.92 -r1.93 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.275 -r1.276 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.171 src/usr.bin/xlint/lint1/decl.c:1.172
--- src/usr.bin/xlint/lint1/decl.c:1.171	Fri Apr  9 20:12:00 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sat Apr 10 18:06:53 2021
@@ -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 @@ type_t *
 gettyp(tspec_t t)
 {
 
+	/* TODO: make the return type 'const' */
 	return &typetab[t];
 }
 

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.102 src/usr.bin/xlint/lint1/func.c:1.103
--- src/usr.bin/xlint/lint1/func.c:1.102	Fri Apr  2 15:06:35 2021
+++ src/usr.bin/xlint/lint1/func.c	Sat Apr 10 18:06:53 2021
@@ -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 @@ check_case_label(tnode_t *tn, cstk_t *ci
 	} 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;

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.92 src/usr.bin/xlint/lint1/lint1.h:1.93
--- src/usr.bin/xlint/lint1/lint1.h:1.92	Fri Apr  2 22:05:43 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Sat Apr 10 18:06:53 2021
@@ -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 @@ typedef	struct {
 } 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 @@ typedef	struct pqinf {
 } 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;

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.275 src/usr.bin/xlint/lint1/tree.c:1.276
--- src/usr.bin/xlint/lint1/tree.c:1.275	Fri Apr  9 21:42:12 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sat Apr 10 18:06:53 2021
@@ -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 @@ convert_constant(op_t op, int arg, const
 	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;

Reply via email to