Module Name:    src
Committed By:   rillig
Date:           Sun Jan 29 13:57:35 UTC 2023

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

Log Message:
lint: inline an expression, clean up comments

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.500 -r1.501 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/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.146 src/usr.bin/xlint/lint1/lex.c:1.147
--- src/usr.bin/xlint/lint1/lex.c:1.146	Sun Jan 22 17:04:30 2023
+++ src/usr.bin/xlint/lint1/lex.c	Sun Jan 29 13:57:35 2023
@@ -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 @@ static const struct keyword {
 	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 @@ lex_name(const char *yytext, size_t yyle
 	(void)memcpy(name, yytext, yyleng + 1);
 	sb->sb_name = name;
 	return T_NAME;
-
 }
 
 int

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.500 src/usr.bin/xlint/lint1/tree.c:1.501
--- src/usr.bin/xlint/lint1/tree.c:1.500	Sun Jan 29 13:47:16 2023
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jan 29 13:57:35 2023
@@ -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 @@ static tspec_t
 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 @@ check_prototype_conversion(int arg, tspe
  * 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)

Reply via email to