Module Name:    src
Committed By:   rillig
Date:           Fri Feb 19 22:20:18 UTC 2021

Modified Files:
        src/usr.bin/xlint/common: tyname.c
        src/usr.bin/xlint/lint1: decl.c emit1.c func.c lint1.h

Log Message:
lint: rename tenum_t and its members to be more expressive


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/common/tyname.c
cvs rdiff -u -r1.134 -r1.135 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint1/lint1.h

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/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.27 src/usr.bin/xlint/common/tyname.c:1.28
--- src/usr.bin/xlint/common/tyname.c:1.27	Fri Feb 19 22:16:12 2021
+++ src/usr.bin/xlint/common/tyname.c	Fri Feb 19 22:20:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.27 2021/02/19 22:16:12 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.28 2021/02/19 22:20:18 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.27 2021/02/19 22:16:12 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.28 2021/02/19 22:20:18 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -230,8 +230,8 @@ sametype(const type_t *t1, const type_t 
 		return sametype(t1->t_subt, t2->t_subt);
 	case ENUM:
 #ifdef t_enum
-		return strcmp(t1->t_enum->etag->s_name,
-		    t2->t_enum->etag->s_name) == 0;
+		return strcmp(t1->t_enum->en_tag->s_name,
+		    t2->t_enum->en_tag->s_name) == 0;
 #else
 		return true;
 #endif
@@ -339,7 +339,7 @@ type_name(const type_t *tp)
 	case ENUM:
 		buf_add(&buf, " ");
 #ifdef t_enum
-		buf_add(&buf, tp->t_enum->etag->s_name);
+		buf_add(&buf, tp->t_enum->en_tag->s_name);
 #else
 		buf_add(&buf,
 		    tp->t_isuniqpos ? "*anonymous*" : tp->t_tag->h_name);

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.134 src/usr.bin/xlint/lint1/decl.c:1.135
--- src/usr.bin/xlint/lint1/decl.c:1.134	Fri Feb 19 22:16:12 2021
+++ src/usr.bin/xlint/lint1/decl.c	Fri Feb 19 22:20:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.134 2021/02/19 22:16:12 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.135 2021/02/19 22:20:18 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.134 2021/02/19 22:16:12 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.135 2021/02/19 22:20:18 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -183,7 +183,7 @@ is_incomplete(const type_t *tp)
 	} else if (t == STRUCT || t == UNION) {
 		return tp->t_str->sou_incomplete;
 	} else if (t == ENUM) {
-		return tp->t_enum->eincompl;
+		return tp->t_enum->en_incomplete;
 	}
 	return false;
 }
@@ -202,7 +202,7 @@ setcomplete(type_t *tp, bool complete)
 		tp->t_str->sou_incomplete = !complete;
 	} else {
 		lint_assert(t == ENUM);
-		tp->t_enum->eincompl = !complete;
+		tp->t_enum->en_incomplete = !complete;
 	}
 }
 
@@ -485,8 +485,8 @@ settdsym(type_t *tp, sym_t *sym)
 		if (tp->t_str->sou_first_typedef == NULL)
 			tp->t_str->sou_first_typedef = sym;
 	} else if (t == ENUM) {
-		if (tp->t_enum->etdef == NULL)
-			tp->t_enum->etdef = sym;
+		if (tp->t_enum->en_first_typedef == NULL)
+			tp->t_enum->en_first_typedef = sym;
 	}
 }
 
@@ -1667,7 +1667,7 @@ mktag(sym_t *tag, tspec_t kind, bool dec
 		} else {
 			tp->t_isenum = true;
 			tp->t_enum = getblk(sizeof(*tp->t_enum));
-			tp->t_enum->etag = tag;
+			tp->t_enum->en_tag = tag;
 		}
 		setcomplete(tp, false);
 	}
@@ -1813,7 +1813,7 @@ complete_tag_enum(type_t *tp, sym_t *fme
 {
 
 	setcomplete(tp, true);
-	tp->t_enum->elem = fmem;
+	tp->t_enum->en_first_enumerator = fmem;
 	return tp;
 }
 

Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.40 src/usr.bin/xlint/lint1/emit1.c:1.41
--- src/usr.bin/xlint/lint1/emit1.c:1.40	Fri Feb 19 22:16:12 2021
+++ src/usr.bin/xlint/lint1/emit1.c	Fri Feb 19 22:20:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.40 2021/02/19 22:16:12 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.41 2021/02/19 22:20:18 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.40 2021/02/19 22:16:12 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.41 2021/02/19 22:20:18 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -140,7 +140,7 @@ outtype(const type_t *tp)
 		if (ts == ARRAY) {
 			outint(tp->t_dim);
 		} else if (ts == ENUM) {
-			outtt(tp->t_enum->etag, tp->t_enum->etdef);
+			outtt(tp->t_enum->en_tag, tp->t_enum->en_first_typedef);
 		} else if (ts == STRUCT || ts == UNION) {
 			outtt(tp->t_str->sou_tag, tp->t_str->sou_first_typedef);
 		} else if (ts == FUNC && tp->t_proto) {

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.69 src/usr.bin/xlint/lint1/func.c:1.70
--- src/usr.bin/xlint/lint1/func.c:1.69	Fri Feb 19 21:35:44 2021
+++ src/usr.bin/xlint/lint1/func.c	Fri Feb 19 22:20:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.69 2021/02/19 21:35:44 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.70 2021/02/19 22:20:18 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.69 2021/02/19 21:35:44 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.70 2021/02/19 22:20:18 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -674,7 +674,7 @@ switch2(void)
 	if (cstmt->c_swtype->t_isenum) {
 		nenum = nclab = 0;
 		lint_assert(cstmt->c_swtype->t_enum != NULL);
-		for (esym = cstmt->c_swtype->t_enum->elem;
+		for (esym = cstmt->c_swtype->t_enum->en_first_enumerator;
 		     esym != NULL; esym = esym->s_next) {
 			nenum++;
 		}

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.62 src/usr.bin/xlint/lint1/lint1.h:1.63
--- src/usr.bin/xlint/lint1/lint1.h:1.62	Fri Feb 19 22:16:12 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Fri Feb 19 22:20:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.62 2021/02/19 22:16:12 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.63 2021/02/19 22:20:18 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -138,11 +138,11 @@ typedef	struct {
  * same as above for enums
  */
 typedef	struct {
-	bool	eincompl : 1;	/* incomplete enum type */
-	struct	sym *elem;	/* list of enumerators */
-	struct	sym *etag;	/* symbol table entry of tag */
-	struct	sym *etdef;	/* symbol table entry of first typename */
-} tenum_t;
+	bool	en_incomplete : 1;
+	struct	sym *en_first_enumerator;
+	struct	sym *en_tag;
+	struct	sym *en_first_typedef;
+} enumeration;
 
 /*
  * Types are represented by concatenation of structures of type type_t
@@ -161,8 +161,8 @@ struct type {
 	bool	t_packed : 1;
 	union {
 		int	_t_dim;		/* dimension */
-		struct_or_union	*_t_str;	/* struct/union tag */
-		tenum_t	*_t_enum;	/* enum tag */
+		struct_or_union	*_t_str;
+		enumeration	*_t_enum;
 		struct	sym *_t_args;	/* arguments (if t_proto) */
 	} t_u;
 	struct {
@@ -247,7 +247,7 @@ typedef	struct sym {
 	val_t	s_value;	/* value (if enum or bool constant) */
 	union {
 		struct_or_union	*_s_st;
-		tenum_t	*_s_et;	/* tag, if it is an enumerator */
+		enumeration	*_s_et;
 		tspec_t	_s_tsp;	/* type (only for keywords) */
 		tqual_t	_s_tqu;	/* qualifier (only for keywords) */
 		struct	sym *_s_args; /* arguments in old style function

Reply via email to