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: inline an expression, clean up com...



details:   https://anonhg.NetBSD.org/src/rev/93817e46ac62
branches:  trunk
changeset: 373277:93817e46ac62
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 29 13:57:35 2023 +0000

description:
lint: inline an expression, clean up comments

No functional change.

diffstat:

 usr.bin/xlint/lint1/lex.c  |   9 ++++-----
 usr.bin/xlint/lint1/tree.c |  12 +++++-------
 2 files changed, 9 insertions(+), 12 deletions(-)

diffs (83 lines):

diff -r fed5b9c6c381 -r 93817e46ac62 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Jan 29 13:47:16 2023 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Jan 29 13:57:35 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.146 2023/01/22 17:04:30 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.147 2023/01/29 13:57:35 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.146 2023/01/22 17:04:30 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.147 2023/01/29 13:57:35 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -99,8 +99,8 @@
        const   char *kw_name;
        int     kw_token;       /* token returned by yylex() */
        scl_t   kw_scl;         /* storage class if kw_token is T_SCLASS */
-       tspec_t kw_tspec;       /* type spec if kw_token is
-                                * T_TYPE or T_STRUCT_OR_UNION */
+       tspec_t kw_tspec;       /* type specifier if kw_token is T_TYPE or
+                                * T_STRUCT_OR_UNION */
        tqual_t kw_tqual;       /* type qualifier if kw_token is T_QUAL */
        bool    kw_c90:1;       /* available in C90 mode */
        bool    kw_c99_or_c11:1; /* available in C99 or C11 mode */
@@ -461,7 +461,6 @@
        (void)memcpy(name, yytext, yyleng + 1);
        sb->sb_name = name;
        return T_NAME;
-
 }
 
 int
diff -r fed5b9c6c381 -r 93817e46ac62 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jan 29 13:47:16 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jan 29 13:57:35 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.500 2023/01/29 13:47:16 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.501 2023/01/29 13:57:35 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.500 2023/01/29 13:47:16 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.501 2023/01/29 13:57:35 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2198,15 +2198,15 @@
 usual_arithmetic_conversion_trad(tspec_t lt, tspec_t rt)
 {
 
-       bool u = is_uinteger(lt) || is_uinteger(rt);
        size_t i;
        for (i = 0; arith_rank[i] != INT; i++)
                if (lt == arith_rank[i] || rt == arith_rank[i])
                        break;
 
        tspec_t t = arith_rank[i];
-       if (u && is_integer(t) && !is_uinteger(t))
-               return unsigned_type(t);
+       if (is_uinteger(lt) || is_uinteger(rt))
+               if (is_integer(t) && !is_uinteger(t))
+                       return unsigned_type(t);
        return t;
 }
 
@@ -2430,8 +2430,6 @@
  * When converting a large integer type to a small integer type, in some
  * cases the value of the actual expression is further restricted than the
  * type bounds, such as in (expr & 0xFF) or (expr % 100) or (expr >> 24).
- *
- * See new_tnode, the '#if 0' code for SHR.
  */
 static bool
 can_represent(const type_t *tp, const tnode_t *tn)



Home | Main Index | Thread Index | Old Index