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 type warnings in emit1.c



details:   https://anonhg.NetBSD.org/src/rev/42a3d3ecb940
branches:  trunk
changeset: 1022128:42a3d3ecb940
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 05 19:39:12 2021 +0000

description:
lint: fix type warnings in emit1.c

The plain character strings in strg_t are saved as an array of unsigned
char.  When such a character is passed to ch_isdigit, it requires a
cast.  This is exactly the situation that ch_isdigit tried to avoid in
the first place.

No functional change.

diffstat:

 usr.bin/xlint/lint1/emit1.c |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (58 lines):

diff -r 31a13f03b052 -r 42a3d3ecb940 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c       Mon Jul 05 19:02:14 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c       Mon Jul 05 19:39:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.44 2021/04/18 20:02:56 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.45 2021/07/05 19:39:12 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,11 +38,9 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.44 2021/04/18 20:02:56 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.45 2021/07/05 19:39:12 rillig Exp $");
 #endif
 
-#include <ctype.h>
-
 #include "lint1.h"
 
 static void    outtt(sym_t *, sym_t *);
@@ -146,7 +144,7 @@
                } else if (ts == FUNC && tp->t_proto) {
                        na = 0;
                        for (arg = tp->t_args; arg != NULL; arg = arg->s_next)
-                                       na++;
+                               na++;
                        if (tp->t_vararg)
                                na++;
                        outint(na);
@@ -495,7 +493,7 @@
 static void
 outfstrg(strg_t *strg)
 {
-       int     c, oc;
+       unsigned char c, oc;
        bool    first;
        u_char  *cp;
 
@@ -525,7 +523,7 @@
                }
 
                /* numeric field width */
-               while (c != '\0' && ch_isdigit(c)) {
+               while (c != '\0' && ch_isdigit((char)c)) {
                        outqchar(c);
                        c = *cp++;
                }
@@ -537,7 +535,7 @@
                                outqchar(c);
                                c = *cp++;
                        } else {
-                               while (c != '\0' && ch_isdigit(c)) {
+                               while (c != '\0' && ch_isdigit((char)c)) {
                                        outqchar(c);
                                        c = *cp++;
                                }



Home | Main Index | Thread Index | Old Index