Module Name:    src
Committed By:   rillig
Date:           Sun Jun 20 19:04:50 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: ckbool.c lex.c lint1.h print.c tree.c

Log Message:
lint: rename val_t.v_ansiu to v_unsigned

When lint was written in 1995, traditional C was still nearby since C90
had been around for only 5 years.  26 years later, almost all code
adheres to C90 or even C99 or C11, therefore "C90 or later" can safely
be assumed as the default.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/print.c
cvs rdiff -u -r1.287 -r1.288 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/ckbool.c
diff -u src/usr.bin/xlint/lint1/ckbool.c:1.1 src/usr.bin/xlint/lint1/ckbool.c:1.2
--- src/usr.bin/xlint/lint1/ckbool.c:1.1	Tue Apr  6 13:17:04 2021
+++ src/usr.bin/xlint/lint1/ckbool.c	Sun Jun 20 19:04:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.1 2021/04/06 13:17:04 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.2 2021/06/20 19:04:50 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: ckbool.c,v 1.1 2021/04/06 13:17:04 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.2 2021/06/20 19:04:50 rillig Exp $");
 #endif
 
 #include <string.h>
@@ -252,7 +252,7 @@ fallback_symbol_strict_bool(sym_t *sym)
 		sym->s_scl = CTCONST; /* close enough */
 		sym->s_type = gettyp(BOOL);
 		sym->s_value.v_tspec = BOOL;
-		sym->s_value.v_ansiu = false;
+		sym->s_value.v_unsigned = false;
 		sym->s_value.v_quad = 0;
 		return true;
 	}
@@ -261,7 +261,7 @@ fallback_symbol_strict_bool(sym_t *sym)
 		sym->s_scl = CTCONST; /* close enough */
 		sym->s_type = gettyp(BOOL);
 		sym->s_value.v_tspec = BOOL;
-		sym->s_value.v_ansiu = false;
+		sym->s_value.v_unsigned = false;
 		sym->s_value.v_quad = 1;
 		return true;
 	}

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.44 src/usr.bin/xlint/lint1/lex.c:1.45
--- src/usr.bin/xlint/lint1/lex.c:1.44	Sun Jun 20 18:44:48 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sun Jun 20 19:04:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.44 2021/06/20 18:44:48 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.45 2021/06/20 19:04:50 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: lex.c,v 1.44 2021/06/20 18:44:48 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.45 2021/06/20 19:04:50 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -672,7 +672,7 @@ lex_integer_constant(const char *yytext,
 
 	yylval.y_val = xcalloc(1, sizeof(*yylval.y_val));
 	yylval.y_val->v_tspec = typ;
-	yylval.y_val->v_ansiu = ansiu;
+	yylval.y_val->v_unsigned = ansiu;
 	yylval.y_val->v_quad = (int64_t)uq;
 
 	return T_CON;

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.103 src/usr.bin/xlint/lint1/lint1.h:1.104
--- src/usr.bin/xlint/lint1/lint1.h:1.103	Sat Jun 19 15:23:57 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Jun 20 19:04:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.103 2021/06/19 15:23:57 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.104 2021/06/20 19:04:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -104,13 +104,11 @@ typedef enum {
 	CONST, VOLATILE, RESTRICT, THREAD
 } tqual_t;
 
-/*
- * Integer and floating point values are stored in this structure
- */
+/* An integer or floating-point value. */
 typedef struct {
 	tspec_t	v_tspec;
-	bool	v_ansiu;		/* set if an integer constant is
-					   unsigned in ANSI C */
+	bool	v_unsigned;		/* set if an integer constant is
+					   unsigned in C90 and later */
 	union {
 		int64_t	_v_quad;	/* integers */
 		ldbl_t	_v_ldbl;	/* floats */

Index: src/usr.bin/xlint/lint1/print.c
diff -u src/usr.bin/xlint/lint1/print.c:1.12 src/usr.bin/xlint/lint1/print.c:1.13
--- src/usr.bin/xlint/lint1/print.c:1.12	Sat Jun 19 14:08:45 2021
+++ src/usr.bin/xlint/lint1/print.c	Sun Jun 20 19:04:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.12 2021/06/19 14:08:45 rillig Exp $	*/
+/*	$NetBSD: print.c,v 1.13 2021/06/20 19:04:50 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: print.c,v 1.12 2021/06/19 14:08:45 rillig Exp $");
+__RCSID("$NetBSD: print.c,v 1.13 2021/06/20 19:04:50 rillig Exp $");
 #endif
 
 #include <stdio.h>
@@ -62,8 +62,9 @@ print_tnode(char *buf, size_t bufsiz, co
 			(void)snprintf(buf, bufsiz, "%Lg", v->v_ldbl);
 			break;
 		default:
-			(void)snprintf(buf, bufsiz, v->v_ansiu ? "%llu" :
-			    "%lld", (unsigned long long)v->v_quad);
+			(void)snprintf(buf, bufsiz,
+			    v->v_unsigned ? "%llu" : "%lld",
+			    (unsigned long long)v->v_quad);
 			break;
 		}
 		break;

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.287 src/usr.bin/xlint/lint1/tree.c:1.288
--- src/usr.bin/xlint/lint1/tree.c:1.287	Tue Jun 15 20:46:45 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jun 20 19:04:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.287 2021/06/15 20:46:45 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.288 2021/06/20 19:04:50 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.287 2021/06/15 20:46:45 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.288 2021/06/20 19:04:50 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -183,7 +183,7 @@ expr_new_constant(type_t *tp, val_t *v)
 	n->tn_type = tp;
 	n->tn_val = expr_zalloc(sizeof(*n->tn_val));
 	n->tn_val->v_tspec = tp->t_tspec;
-	n->tn_val->v_ansiu = v->v_ansiu;
+	n->tn_val->v_unsigned = v->v_unsigned;
 	n->tn_val->v_u = v->v_u;
 	free(v);
 	return n;
@@ -532,16 +532,16 @@ build(op_t op, tnode_t *ln, tnode_t *rn)
 	 * ANSI C, print a warning.
 	 */
 	if (mp->m_warn_if_left_unsigned_in_c90 &&
-	    ln->tn_op == CON && ln->tn_val->v_ansiu) {
+	    ln->tn_op == CON && ln->tn_val->v_unsigned) {
 		/* ANSI C treats constant as unsigned, op %s */
 		warning(218, mp->m_name);
-		ln->tn_val->v_ansiu = false;
+		ln->tn_val->v_unsigned = false;
 	}
 	if (mp->m_warn_if_right_unsigned_in_c90 &&
-	    rn->tn_op == CON && rn->tn_val->v_ansiu) {
+	    rn->tn_op == CON && rn->tn_val->v_unsigned) {
 		/* ANSI C treats constant as unsigned, op %s */
 		warning(218, mp->m_name);
-		rn->tn_val->v_ansiu = false;
+		rn->tn_val->v_unsigned = false;
 	}
 
 	/* Make sure both operands are of the same type */
@@ -2364,7 +2364,7 @@ convert_constant(op_t op, int arg, const
 	range_check = false;
 
 	if (nt == BOOL) {	/* C99 6.3.1.2 */
-		nv->v_ansiu = false;
+		nv->v_unsigned = false;
 		nv->v_quad = is_nonzero_val(v) ? 1 : 0;
 		return;
 	}
@@ -2376,13 +2376,13 @@ convert_constant(op_t op, int arg, const
 		nv->v_quad = v->v_quad;
 	}
 
-	if ((v->v_ansiu && is_floating(nt)) ||
-	    (v->v_ansiu && (is_integer(nt) && !is_uinteger(nt) &&
+	if ((v->v_unsigned && is_floating(nt)) ||
+	    (v->v_unsigned && (is_integer(nt) && !is_uinteger(nt) &&
 			    portable_size_in_bits(nt) >
 			    portable_size_in_bits(ot)))) {
 		/* ANSI C treats constant as unsigned */
 		warning(157);
-		v->v_ansiu = false;
+		v->v_unsigned = false;
 	}
 
 	switch (nt) {
@@ -3618,7 +3618,7 @@ constant(tnode_t *tn, bool required)
 	if (tn->tn_op == CON) {
 		lint_assert(tn->tn_type->t_tspec == tn->tn_val->v_tspec);
 		if (is_integer(tn->tn_val->v_tspec)) {
-			v->v_ansiu = tn->tn_val->v_ansiu;
+			v->v_unsigned = tn->tn_val->v_unsigned;
 			v->v_quad = tn->tn_val->v_quad;
 			return v;
 		}

Reply via email to