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 unintended warning for convert...



details:   https://anonhg.NetBSD.org/src/rev/88d9ac05e7d8
branches:  trunk
changeset: 985641:88d9ac05e7d8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Sep 02 17:29:19 2021 +0000

description:
lint: fix unintended warning for converting long long to signed char

diffstat:

 tests/usr.bin/xlint/lint1/msg_259.c   |   4 +--
 tests/usr.bin/xlint/lint1/msg_259.exp |  48 ++++++++++++++++------------------
 usr.bin/xlint/lint1/tree.c            |   8 ++--
 3 files changed, 28 insertions(+), 32 deletions(-)

diffs (101 lines):

diff -r f9005113c46a -r 88d9ac05e7d8 tests/usr.bin/xlint/lint1/msg_259.c
--- a/tests/usr.bin/xlint/lint1/msg_259.c       Thu Sep 02 17:26:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_259.c       Thu Sep 02 17:29:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_259.c,v 1.17 2021/09/02 17:26:43 rillig Exp $      */
+/*     $NetBSD: msg_259.c,v 1.18 2021/09/02 17:29:19 rillig Exp $      */
 # 3 "msg_259.c"
 
 // Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
@@ -74,9 +74,7 @@
        signed_char(us);
        signed_char(si);
        signed_char(ui);
-       /* expect+1: warning: argument #1 is converted from 'long long' to 'signed char' due to prototype [259] */
        signed_char(sll);
-       /* expect+1: warning: argument #1 is converted from 'unsigned long long' to 'signed char' due to prototype [259] */
        signed_char(ull);
 
        unsigned_char(c);
diff -r f9005113c46a -r 88d9ac05e7d8 tests/usr.bin/xlint/lint1/msg_259.exp
--- a/tests/usr.bin/xlint/lint1/msg_259.exp     Thu Sep 02 17:26:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_259.exp     Thu Sep 02 17:29:19 2021 +0000
@@ -1,26 +1,24 @@
 msg_259.c(41): warning: argument #1 is converted from 'long' to 'int' due to prototype [259]
-msg_259.c(78): warning: argument #1 is converted from 'long long' to 'signed char' due to prototype [259]
-msg_259.c(80): warning: argument #1 is converted from 'unsigned long long' to 'signed char' due to prototype [259]
-msg_259.c(129): warning: argument #1 is converted from 'int' to 'unsigned int' due to prototype [259]
-msg_259.c(132): warning: argument #1 is converted from 'long' to 'unsigned int' due to prototype [259]
-msg_259.c(135): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259]
-msg_259.c(144): warning: argument #1 is converted from 'long' to 'unsigned long' due to prototype [259]
-msg_259.c(146): warning: argument #1 is converted from 'long long' to 'unsigned long' due to prototype [259]
-msg_259.c(155): warning: argument #1 is converted from 'long' to 'unsigned long long' due to prototype [259]
-msg_259.c(158): warning: argument #1 is converted from 'long long' to 'unsigned long long' due to prototype [259]
-msg_259.c(165): warning: argument #1 is converted from 'unsigned int' to 'int' due to prototype [259]
-msg_259.c(167): warning: argument #1 is converted from 'unsigned long' to 'int' due to prototype [259]
-msg_259.c(169): warning: argument #1 is converted from 'unsigned long long' to 'int' due to prototype [259]
-msg_259.c(172): warning: argument #1 is converted from 'unsigned long' to 'long' due to prototype [259]
-msg_259.c(174): warning: argument #1 is converted from 'unsigned long long' to 'long' due to prototype [259]
-msg_259.c(177): warning: argument #1 is converted from 'unsigned long' to 'long long' due to prototype [259]
-msg_259.c(179): warning: argument #1 is converted from 'unsigned long long' to 'long long' due to prototype [259]
-msg_259.c(187): warning: argument #1 is converted from 'long' to 'int' due to prototype [259]
-msg_259.c(189): warning: argument #1 is converted from 'long long' to 'int' due to prototype [259]
-msg_259.c(193): warning: argument #1 is converted from 'long long' to 'long' due to prototype [259]
-msg_259.c(196): warning: argument #1 is converted from 'long' to 'long long' due to prototype [259]
-msg_259.c(205): warning: argument #1 is converted from 'unsigned long' to 'unsigned int' due to prototype [259]
-msg_259.c(207): warning: argument #1 is converted from 'unsigned long long' to 'unsigned int' due to prototype [259]
-msg_259.c(211): warning: argument #1 is converted from 'unsigned long long' to 'unsigned long' due to prototype [259]
-msg_259.c(214): warning: argument #1 is converted from 'unsigned long' to 'unsigned long long' due to prototype [259]
-msg_259.c(228): warning: argument #1 is converted from 'unsigned long' to 'unsigned int' due to prototype [259]
+msg_259.c(127): warning: argument #1 is converted from 'int' to 'unsigned int' due to prototype [259]
+msg_259.c(130): warning: argument #1 is converted from 'long' to 'unsigned int' due to prototype [259]
+msg_259.c(133): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259]
+msg_259.c(142): warning: argument #1 is converted from 'long' to 'unsigned long' due to prototype [259]
+msg_259.c(144): warning: argument #1 is converted from 'long long' to 'unsigned long' due to prototype [259]
+msg_259.c(153): warning: argument #1 is converted from 'long' to 'unsigned long long' due to prototype [259]
+msg_259.c(156): warning: argument #1 is converted from 'long long' to 'unsigned long long' due to prototype [259]
+msg_259.c(163): warning: argument #1 is converted from 'unsigned int' to 'int' due to prototype [259]
+msg_259.c(165): warning: argument #1 is converted from 'unsigned long' to 'int' due to prototype [259]
+msg_259.c(167): warning: argument #1 is converted from 'unsigned long long' to 'int' due to prototype [259]
+msg_259.c(170): warning: argument #1 is converted from 'unsigned long' to 'long' due to prototype [259]
+msg_259.c(172): warning: argument #1 is converted from 'unsigned long long' to 'long' due to prototype [259]
+msg_259.c(175): warning: argument #1 is converted from 'unsigned long' to 'long long' due to prototype [259]
+msg_259.c(177): warning: argument #1 is converted from 'unsigned long long' to 'long long' due to prototype [259]
+msg_259.c(185): warning: argument #1 is converted from 'long' to 'int' due to prototype [259]
+msg_259.c(187): warning: argument #1 is converted from 'long long' to 'int' due to prototype [259]
+msg_259.c(191): warning: argument #1 is converted from 'long long' to 'long' due to prototype [259]
+msg_259.c(194): warning: argument #1 is converted from 'long' to 'long long' due to prototype [259]
+msg_259.c(203): warning: argument #1 is converted from 'unsigned long' to 'unsigned int' due to prototype [259]
+msg_259.c(205): warning: argument #1 is converted from 'unsigned long long' to 'unsigned int' due to prototype [259]
+msg_259.c(209): warning: argument #1 is converted from 'unsigned long long' to 'unsigned long' due to prototype [259]
+msg_259.c(212): warning: argument #1 is converted from 'unsigned long' to 'unsigned long long' due to prototype [259]
+msg_259.c(226): warning: argument #1 is converted from 'unsigned long' to 'unsigned int' due to prototype [259]
diff -r f9005113c46a -r 88d9ac05e7d8 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Thu Sep 02 17:26:43 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Thu Sep 02 17:29:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.367 2021/09/02 16:31:01 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.368 2021/09/02 17:29:19 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.367 2021/09/02 16:31:01 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.368 2021/09/02 17:29:19 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2034,8 +2034,8 @@
         * would be useless, because functions declared the old style
         * can't expect char/short arguments.
         */
-       /* XXX: what about SCHAR? */
-       if (nt == CHAR || nt == UCHAR || nt == SHORT || nt == USHORT)
+       if (nt == CHAR || nt == SCHAR || nt == UCHAR ||
+           nt == SHORT || nt == USHORT)
                return;
 
        /* apply the default promotion */



Home | Main Index | Thread Index | Old Index