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: fix lint warning on platforms wher...



details:   https://anonhg.NetBSD.org/src/rev/e6c845338a72
branches:  trunk
changeset: 365211:e6c845338a72
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Apr 13 22:20:42 2022 +0000

description:
lint: fix lint warning on platforms where size_t == unsigned int

lex.c(1451): warning: argument #1 is converted from 'int' to
    'unsigned int' due to prototype [259]

A more thorough fix would be to change the type of block_level from int
to size_t, to match mem_block_level, but that change would generate
further signedness warnings because the type of sym_t.s_block_level
would have to be changed from int to size_t as well, but some symbols
have s_block_level == -1, so that's a larger and more error-prone
change.  Leave that for later.

Whether message 259 makes sense at all in C99 mode is an entirely
different question that needs to be answered separately.

No functional change.

diffstat:

 usr.bin/xlint/lint1/lex.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 82532f862250 -r e6c845338a72 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Wed Apr 13 19:17:09 2022 +0000
+++ b/usr.bin/xlint/lint1/lex.c Wed Apr 13 22:20:42 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.118 2022/04/09 23:41:22 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.119 2022/04/13 22:20:42 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.118 2022/04/09 23:41:22 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.119 2022/04/13 22:20:42 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -1448,7 +1448,7 @@
 mktempsym(type_t *tp)
 {
        static unsigned n = 0;
-       char *s = level_zero_alloc(block_level, 64);
+       char *s = level_zero_alloc((size_t)block_level, 64);
        sym_t *sym = block_zero_alloc(sizeof(*sym));
        scl_t scl;
 



Home | Main Index | Thread Index | Old Index