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 'quad' to 'signed int' or '...



details:   https://anonhg.NetBSD.org/src/rev/fc7e413795f1
branches:  trunk
changeset: 377235:fc7e413795f1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 02 18:14:44 2023 +0000

description:
lint: rename 'quad' to 'signed int' or 'unsigned int'

No functional change.

diffstat:

 tests/usr.bin/xlint/lint1/expr_fold.c |    4 +-
 tests/usr.bin/xlint/lint1/msg_252.c   |    6 +-
 usr.bin/xlint/lint1/ckbool.c          |    6 +-
 usr.bin/xlint/lint1/debug.c           |   12 +-
 usr.bin/xlint/lint1/decl.c            |    8 +-
 usr.bin/xlint/lint1/emit1.c           |   10 +-
 usr.bin/xlint/lint1/externs1.h        |    4 +-
 usr.bin/xlint/lint1/func.c            |   20 +-
 usr.bin/xlint/lint1/lex.c             |   52 +++---
 usr.bin/xlint/lint1/lint1.h           |   19 +-
 usr.bin/xlint/lint1/tree.c            |  264 +++++++++++++++++-----------------
 11 files changed, 201 insertions(+), 204 deletions(-)

diffs (truncated from 1202 to 300 lines):

diff -r 8893f6ddceeb -r fc7e413795f1 tests/usr.bin/xlint/lint1/expr_fold.c
--- a/tests/usr.bin/xlint/lint1/expr_fold.c     Sun Jul 02 17:41:30 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_fold.c     Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expr_fold.c,v 1.8 2023/03/28 14:44:34 rillig Exp $     */
+/*     $NetBSD: expr_fold.c,v 1.9 2023/07/02 18:14:44 rillig Exp $     */
 # 3 "expr_fold.c"
 
 /*
@@ -291,7 +291,7 @@ struct ctassert5_struct {
 /*
  * Since Makefile.inc 1.21 from 2022-04-08 (which added -ftrapv) and before
  * tree.c 1.436 from 2022-04-20, lint crashed with an integer overflow when
- * calculating '-(uint64_t)INT64_MIN' in val_t.v_quad.
+ * calculating '-(uint64_t)INT64_MIN' in val_t.u.integer.
  */
 void
 unary_minus_overflow(unsigned long long val)
diff -r 8893f6ddceeb -r fc7e413795f1 tests/usr.bin/xlint/lint1/msg_252.c
--- a/tests/usr.bin/xlint/lint1/msg_252.c       Sun Jul 02 17:41:30 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_252.c       Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_252.c,v 1.5 2023/03/28 14:44:35 rillig Exp $       */
+/*     $NetBSD: msg_252.c,v 1.6 2023/07/02 18:14:44 rillig Exp $       */
 # 3 "msg_252.c"
 
 // Test for message: integer constant out of range [252]
@@ -13,8 +13,8 @@
  * This number is passed to convert_constant, which calls convert_integer,
  * which sign-extends the number to 'INT 0xffff_ffff_ffff_ffff'.  This
  * converted number is passed to convert_constant_check_range, and at this
- * point, v->v_quad != nv->v_quad, due to the sign extension.  This triggers
- * an additional warning 119.
+ * point, v->u.integer != nv->u.integer, due to the sign extension.  This
+ * triggers an additional warning 119.
  *
  * On a 64-bit platform, lex_integer_constant stores the number as
  * 'ULONG 0xffff_ffff_ffff_ffff', which has the same representation as the
diff -r 8893f6ddceeb -r fc7e413795f1 usr.bin/xlint/lint1/ckbool.c
--- a/usr.bin/xlint/lint1/ckbool.c      Sun Jul 02 17:41:30 2023 +0000
+++ b/usr.bin/xlint/lint1/ckbool.c      Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.22 2023/06/24 20:50:54 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.23 2023/07/02 18:14:44 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 
 #if defined(__RCSID)
-__RCSID("$NetBSD: ckbool.c,v 1.22 2023/06/24 20:50:54 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.23 2023/07/02 18:14:44 rillig Exp $");
 #endif
 
 #include <string.h>
@@ -79,7 +79,7 @@ is_symmetric_bool_or_other(op_t op)
 static bool
 is_int_constant_zero(const tnode_t *tn, tspec_t t)
 {
-       return t == INT && tn->tn_op == CON && tn->tn_val.v_quad == 0;
+       return t == INT && tn->tn_op == CON && tn->tn_val.u.integer == 0;
 }
 
 static bool
diff -r 8893f6ddceeb -r fc7e413795f1 usr.bin/xlint/lint1/debug.c
--- a/usr.bin/xlint/lint1/debug.c       Sun Jul 02 17:41:30 2023 +0000
+++ b/usr.bin/xlint/lint1/debug.c       Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.44 2023/07/02 17:41:30 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.45 2023/07/02 18:14:44 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.44 2023/07/02 17:41:30 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.45 2023/07/02 18:14:44 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -188,17 +188,17 @@ debug_node(const tnode_t *tn) // NOLINT(
                break;
        case CON:
                if (is_floating(tn->tn_type->t_tspec))
-                       debug_printf(", value %Lg", tn->tn_val.v_ldbl);
+                       debug_printf(", value %Lg", tn->tn_val.u.floating);
                else if (is_uinteger(tn->tn_type->t_tspec))
                        debug_printf(", value %llu",
-                           (unsigned long long)tn->tn_val.v_quad);
+                           (unsigned long long)tn->tn_val.u.integer);
                else if (is_integer(tn->tn_type->t_tspec))
                        debug_printf(", value %lld",
-                           (long long)tn->tn_val.v_quad);
+                           (long long)tn->tn_val.u.integer);
                else {
                        lint_assert(tn->tn_type->t_tspec == BOOL);
                        debug_printf(", value %s",
-                           tn->tn_val.v_quad != 0 ? "true" : "false");
+                           tn->tn_val.u.integer != 0 ? "true" : "false");
                }
                if (tn->tn_val.v_unsigned_since_c90)
                        debug_printf(", unsigned_since_c90");
diff -r 8893f6ddceeb -r fc7e413795f1 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sun Jul 02 17:41:30 2023 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.336 2023/07/02 17:41:30 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.337 2023/07/02 18:14:44 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.336 2023/07/02 17:41:30 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.337 2023/07/02 18:14:44 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -294,7 +294,7 @@ dcs_add_type(type_t *tp)
                /* "long long" or "long ... long" */
                t = QUAD;
                dcs->d_rank_mod = NO_TSPEC;
-               if (!quadflg)
+               if (!long_long_flag)
                        /* %s does not support 'long long' */
                        c99ism(265, allow_c90 ? "C90" : "traditional C");
        }
@@ -3199,7 +3199,7 @@ to_int_constant(tnode_t *tn, bool requir
 
        val_t *v = integer_constant(tn, required);
        bool is_unsigned = is_uinteger(v->v_tspec);
-       int64_t val = v->v_quad;
+       int64_t val = v->u.integer;
        free(v);
 
        /*
diff -r 8893f6ddceeb -r fc7e413795f1 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c       Sun Jul 02 17:41:30 2023 +0000
+++ b/usr.bin/xlint/lint1/emit1.c       Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.70 2023/06/29 10:31:33 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.71 2023/07/02 18:14:44 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: emit1.c,v 1.70 2023/06/29 10:31:33 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.71 2023/07/02 18:14:44 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -339,7 +339,6 @@ outcall(const tnode_t *tn, bool retval_u
 {
        tnode_t *args, *arg;
        int narg, n, i;
-       int64_t q;
        tspec_t t;
 
        /* reset buffer */
@@ -372,10 +371,11 @@ outcall(const tnode_t *tn, bool retval_u
                                 * XXX it would probably be better to
                                 * explicitly test the sign
                                 */
-                               if ((q = arg->tn_val.v_quad) == 0) {
+                               int64_t si = arg->tn_val.u.integer;
+                               if (si == 0) {
                                        /* zero constant */
                                        outchar('z');
-                               } else if (!msb(q, t)) {
+                               } else if (!msb(si, t)) {
                                        /* positive if cast to signed */
                                        outchar('p');
                                } else {
diff -r 8893f6ddceeb -r fc7e413795f1 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h    Sun Jul 02 17:41:30 2023 +0000
+++ b/usr.bin/xlint/lint1/externs1.h    Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs1.h,v 1.186 2023/07/02 10:20:45 rillig Exp $    */
+/*     $NetBSD: externs1.h,v 1.187 2023/07/02 18:14:44 rillig Exp $    */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -301,7 +301,7 @@ extern      bool    llibflg;
 extern int     lwarn;
 extern bool    bitfieldtype_ok;
 extern bool    plibflg;
-extern bool    quadflg;
+extern bool    long_long_flag;
 
 void   begin_control_statement(control_statement_kind);
 void   end_control_statement(control_statement_kind);
diff -r 8893f6ddceeb -r fc7e413795f1 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Sun Jul 02 17:41:30 2023 +0000
+++ b/usr.bin/xlint/lint1/func.c        Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.162 2023/07/02 10:20:45 rillig Exp $        */
+/*     $NetBSD: func.c,v 1.163 2023/07/02 18:14:44 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: func.c,v 1.162 2023/07/02 10:20:45 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.163 2023/07/02 18:14:44 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -148,7 +148,7 @@ bool        bitfieldtype_ok;
  * Whether complaints about use of "long long" are suppressed in
  * the next statement or declaration.
  */
-bool   quadflg;
+bool   long_long_flag;
 
 void
 begin_control_statement(control_statement_kind kind)
@@ -454,8 +454,8 @@ check_case_label_bitand(const tnode_t *c
                return;
 
        lint_assert(case_expr->tn_op == CON);
-       case_value = case_expr->tn_val.v_quad;
-       mask = switch_expr->tn_right->tn_val.v_quad;
+       case_value = case_expr->tn_val.u.integer;
+       mask = switch_expr->tn_right->tn_val.u.integer;
 
        if ((case_value & ~mask) != 0) {
                /* statement not reached */
@@ -540,17 +540,17 @@ check_case_label(tnode_t *tn, control_st
 
        /* look if we had this value already */
        for (cl = cs->c_case_labels; cl != NULL; cl = cl->cl_next) {
-               if (cl->cl_val.v_quad == nv.v_quad)
+               if (cl->cl_val.u.integer == nv.u.integer)
                        break;
        }
        if (cl != NULL && is_uinteger(nv.v_tspec)) {
                /* duplicate case in switch: %lu */
-               error(200, (unsigned long)nv.v_quad);
+               error(200, (unsigned long)nv.u.integer);
        } else if (cl != NULL) {
                /* duplicate case in switch: %ld */
-               error(199, (long)nv.v_quad);
+               error(199, (long)nv.u.integer);
        } else {
-               check_getopt_case_label(nv.v_quad);
+               check_getopt_case_label(nv.u.integer);
 
                /* append the value to the list of case values */
                cl = xcalloc(1, sizeof(*cl));
@@ -1331,5 +1331,5 @@ void
 longlong(int n)
 {
 
-       quadflg = true;
+       long_long_flag = true;
 }
diff -r 8893f6ddceeb -r fc7e413795f1 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Jul 02 17:41:30 2023 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Jul 02 18:14:44 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.165 2023/07/02 10:20:45 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.166 2023/07/02 18:14:44 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.165 2023/07/02 10:20:45 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.166 2023/07/02 18:14:44 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -506,7 +506,7 @@ lex_integer_constant(const char *yytext,
        bool warned = false;
        errno = 0;
        char *eptr;
-       uint64_t uq = (uint64_t)strtoull(cp, &eptr, base);
+       uint64_t ui = (uint64_t)strtoull(cp, &eptr, base);
        lint_assert(eptr == cp + len);
        if (errno != 0) {
                /* integer constant out of range */
@@ -514,7 +514,7 @@ lex_integer_constant(const char *yytext,
                warned = true;
        }
 
-       if (any_query_enabled && base == 8 && uq != 0) {
+       if (any_query_enabled && base == 8 && ui != 0) {
                /* octal number '%.*s' */



Home | Main Index | Thread Index | Old Index