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: make warning about function argume...
details: https://anonhg.NetBSD.org/src/rev/8db7104f9e52
branches: trunk
changeset: 1018354:8db7104f9e52
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 31 13:56:14 2021 +0000
description:
lint: make warning about function argument conversion more detailed
For every conversion it is useful to know both the source and the target
type since these are not always obvious from the code.
The only surprise is the warning in d_gcc_extension. The conversion
there is from 'double' to 'long double', which is a lossless conversion.
This may be a bug in lint.
diffstat:
tests/usr.bin/xlint/lint1/d_constant_conv2.exp | 2 +-
tests/usr.bin/xlint/lint1/d_gcc_extension.exp | 4 ++--
tests/usr.bin/xlint/lint1/d_type_conv1.exp | 2 +-
tests/usr.bin/xlint/lint1/d_type_conv2.exp | 2 +-
tests/usr.bin/xlint/lint1/d_type_conv3.exp | 2 +-
tests/usr.bin/xlint/lint1/msg_259.c | 4 ++--
tests/usr.bin/xlint/lint1/msg_259.exp | 2 +-
usr.bin/xlint/lint1/err.c | 6 +++---
usr.bin/xlint/lint1/tree.c | 14 ++++++++------
9 files changed, 20 insertions(+), 18 deletions(-)
diffs (121 lines):
diff -r 7731f6de1d73 -r 8db7104f9e52 tests/usr.bin/xlint/lint1/d_constant_conv2.exp
--- a/tests/usr.bin/xlint/lint1/d_constant_conv2.exp Sun Jan 31 13:33:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_constant_conv2.exp Sun Jan 31 13:56:14 2021 +0000
@@ -1,1 +1,1 @@
-(11): warning: conversion to 'unsigned int' due to prototype, arg #1 [259]
+(11): warning: conversion from 'double' to 'unsigned int' due to prototype, arg #1 [259]
diff -r 7731f6de1d73 -r 8db7104f9e52 tests/usr.bin/xlint/lint1/d_gcc_extension.exp
--- a/tests/usr.bin/xlint/lint1/d_gcc_extension.exp Sun Jan 31 13:33:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_gcc_extension.exp Sun Jan 31 13:56:14 2021 +0000
@@ -1,2 +1,2 @@
-(7): warning: conversion to 'long double' due to prototype, arg #1 [259]
-(7): warning: conversion to 'long double' due to prototype, arg #1 [259]
+(7): warning: conversion from 'double' to 'long double' due to prototype, arg #1 [259]
+(7): warning: conversion from 'double' to 'long double' due to prototype, arg #1 [259]
diff -r 7731f6de1d73 -r 8db7104f9e52 tests/usr.bin/xlint/lint1/d_type_conv1.exp
--- a/tests/usr.bin/xlint/lint1/d_type_conv1.exp Sun Jan 31 13:33:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_type_conv1.exp Sun Jan 31 13:56:14 2021 +0000
@@ -1,1 +1,1 @@
-(13): warning: conversion to 'unsigned int' due to prototype, arg #1 [259]
+(13): warning: conversion from 'long long' to 'unsigned int' due to prototype, arg #1 [259]
diff -r 7731f6de1d73 -r 8db7104f9e52 tests/usr.bin/xlint/lint1/d_type_conv2.exp
--- a/tests/usr.bin/xlint/lint1/d_type_conv2.exp Sun Jan 31 13:33:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_type_conv2.exp Sun Jan 31 13:56:14 2021 +0000
@@ -1,1 +1,1 @@
-(13): warning: conversion to 'float' due to prototype, arg #1 [259]
+(13): warning: conversion from 'double' to 'float' due to prototype, arg #1 [259]
diff -r 7731f6de1d73 -r 8db7104f9e52 tests/usr.bin/xlint/lint1/d_type_conv3.exp
--- a/tests/usr.bin/xlint/lint1/d_type_conv3.exp Sun Jan 31 13:33:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_type_conv3.exp Sun Jan 31 13:56:14 2021 +0000
@@ -1,2 +1,2 @@
-(12): warning: conversion to 'unsigned int' due to prototype, arg #1 [259]
+(12): warning: conversion from 'long long' to 'unsigned int' due to prototype, arg #1 [259]
(12): warning: conversion of 'long long' to 'unsigned int' is out of range, arg #1 [295]
diff -r 7731f6de1d73 -r 8db7104f9e52 tests/usr.bin/xlint/lint1/msg_259.c
--- a/tests/usr.bin/xlint/lint1/msg_259.c Sun Jan 31 13:33:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_259.c Sun Jan 31 13:56:14 2021 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_259.c,v 1.2 2021/01/30 22:07:31 rillig Exp $ */
+/* $NetBSD: msg_259.c,v 1.3 2021/01/31 13:56:14 rillig Exp $ */
# 3 "msg_259.c"
-// Test for message: conversion to '%s' due to prototype, arg #%d [259]
+// Test for message: conversion from '%s' to '%s' due to prototype, arg #%d [259]
/* lint1-extra-flags: -h */
diff -r 7731f6de1d73 -r 8db7104f9e52 tests/usr.bin/xlint/lint1/msg_259.exp
--- a/tests/usr.bin/xlint/lint1/msg_259.exp Sun Jan 31 13:33:10 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_259.exp Sun Jan 31 13:56:14 2021 +0000
@@ -1,1 +1,1 @@
-msg_259.c(22): warning: conversion to 'int' due to prototype, arg #1 [259]
+msg_259.c(22): warning: conversion from 'long' to 'int' due to prototype, arg #1 [259]
diff -r 7731f6de1d73 -r 8db7104f9e52 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sun Jan 31 13:33:10 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sun Jan 31 13:56:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.75 2021/01/31 11:44:48 rillig Exp $ */
+/* $NetBSD: err.c,v 1.76 2021/01/31 13:56:14 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.75 2021/01/31 11:44:48 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.76 2021/01/31 13:56:14 rillig Exp $");
#endif
#include <sys/types.h>
@@ -318,7 +318,7 @@
"unterminated comment", /* 256 */
"extra characters in lint comment", /* 257 */
"unterminated string constant", /* 258 */
- "conversion to '%s' due to prototype, arg #%d", /* 259 */
+ "conversion from '%s' to '%s' due to prototype, arg #%d", /* 259 */
"previous declaration of %s", /* 260 */
"previous definition of %s", /* 261 */
"\\\" inside character constants undefined in traditional C", /* 262 */
diff -r 7731f6de1d73 -r 8db7104f9e52 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sun Jan 31 13:33:10 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sun Jan 31 13:56:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.202 2021/01/31 12:44:34 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.203 2021/01/31 13:56:14 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.202 2021/01/31 12:44:34 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.203 2021/01/31 13:56:14 rillig Exp $");
#endif
#include <float.h>
@@ -2101,8 +2101,9 @@
psize(nt) != psize(ot)) {
/* representation and/or width change */
if (!is_integer(ot) || psize(ot) > psize(INT)) {
- /* conversion to '%s' due to prototype, arg #%d */
- warning(259, type_name(tp), arg);
+ /* conv. from '%s' to '%s' due to prototype, arg #%d */
+ warning(259,
+ type_name(tn->tn_type), type_name(tp), arg);
}
} else if (hflag) {
/*
@@ -2117,8 +2118,9 @@
msb(ptn->tn_val->v_quad, ot, -1) == 0) {
/* ok */
} else {
- /* conversion to '%s' due to prototype, arg #%d */
- warning(259, type_name(tp), arg);
+ /* conv. from '%s' to '%s' due to prototype, arg #%d */
+ warning(259,
+ type_name(tn->tn_type), type_name(tp), arg);
}
}
}
Home |
Main Index |
Thread Index |
Old Index