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: rename val_t.v_ansiu to v_unsigned



details:   https://anonhg.NetBSD.org/src/rev/cdff1d973565
branches:  trunk
changeset: 1021843:cdff1d973565
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jun 20 19:04:50 2021 +0000

description:
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.

diffstat:

 usr.bin/xlint/lint1/ckbool.c |   8 ++++----
 usr.bin/xlint/lint1/lex.c    |   6 +++---
 usr.bin/xlint/lint1/lint1.h  |  10 ++++------
 usr.bin/xlint/lint1/print.c  |   9 +++++----
 usr.bin/xlint/lint1/tree.c   |  24 ++++++++++++------------
 5 files changed, 28 insertions(+), 29 deletions(-)

diffs (202 lines):

diff -r c8a6a36c6940 -r cdff1d973565 usr.bin/xlint/lint1/ckbool.c
--- a/usr.bin/xlint/lint1/ckbool.c      Sun Jun 20 18:51:50 2021 +0000
+++ b/usr.bin/xlint/lint1/ckbool.c      Sun Jun 20 19:04:50 2021 +0000
@@ -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 @@
                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 @@
                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;
        }
diff -r c8a6a36c6940 -r cdff1d973565 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Jun 20 18:51:50 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Jun 20 19:04:50 2021 +0000
@@ -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 @@
 
        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;
diff -r c8a6a36c6940 -r cdff1d973565 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sun Jun 20 18:51:50 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sun Jun 20 19:04:50 2021 +0000
@@ -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 @@
        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 */
diff -r c8a6a36c6940 -r cdff1d973565 usr.bin/xlint/lint1/print.c
--- a/usr.bin/xlint/lint1/print.c       Sun Jun 20 18:51:50 2021 +0000
+++ b/usr.bin/xlint/lint1/print.c       Sun Jun 20 19:04:50 2021 +0000
@@ -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 @@
                        (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;
diff -r c8a6a36c6940 -r cdff1d973565 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jun 20 18:51:50 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jun 20 19:04:50 2021 +0000
@@ -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 @@
        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 @@
         * 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 @@
        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 @@
                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 @@
        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;
                }



Home | Main Index | Thread Index | Old Index