Module Name: src Committed By: rillig Date: Thu Feb 4 06:55:00 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: d_constant_conv2.exp d_gcc_extension.exp d_type_conv1.exp d_type_conv2.exp d_type_conv3.exp msg_259.c msg_259.exp src/usr.bin/xlint/lint1: err.c tree.c Log Message: lint: add back "due to prototype" to message 259 That message is only supposed to warn about compatibility to traditional C, in case the function should ever be compiled without its prototype being in effect. All other type checks are supposed to be in another function, as documented, but that type check misses to report a few error-prone type combinations (long to char, long to int). 30 years after the introduction of prototypes with C90, almost all existing code uses prototypes. The warning has thus lost most of its usefulness and can rather be confusing since a conversion from 'char' to 'long' is not problematic with prototypes in action, and the probability of the code being backported to a pre-C90 compiler is diminishingly small. The words "due to prototype" now serve as a hint again. The proper fix could be to suppress this warning in C99 mode since that's far enough from traditional C. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/d_constant_conv2.exp \ src/tests/usr.bin/xlint/lint1/d_type_conv1.exp \ src/tests/usr.bin/xlint/lint1/d_type_conv2.exp \ src/tests/usr.bin/xlint/lint1/d_type_conv3.exp \ src/tests/usr.bin/xlint/lint1/msg_259.c \ src/tests/usr.bin/xlint/lint1/msg_259.exp cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/d_gcc_extension.exp cvs rdiff -u -r1.77 -r1.78 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.204 -r1.205 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/tests/usr.bin/xlint/lint1/d_constant_conv2.exp diff -u src/tests/usr.bin/xlint/lint1/d_constant_conv2.exp:1.4 src/tests/usr.bin/xlint/lint1/d_constant_conv2.exp:1.5 --- src/tests/usr.bin/xlint/lint1/d_constant_conv2.exp:1.4 Sun Jan 31 14:39:31 2021 +++ src/tests/usr.bin/xlint/lint1/d_constant_conv2.exp Thu Feb 4 06:55:00 2021 @@ -1 +1 @@ -d_constant_conv2.c(11): warning: argument #1 is converted from 'double' to 'unsigned int' [259] +d_constant_conv2.c(11): warning: argument #1 is converted from 'double' to 'unsigned int' due to prototype [259] Index: src/tests/usr.bin/xlint/lint1/d_type_conv1.exp diff -u src/tests/usr.bin/xlint/lint1/d_type_conv1.exp:1.4 src/tests/usr.bin/xlint/lint1/d_type_conv1.exp:1.5 --- src/tests/usr.bin/xlint/lint1/d_type_conv1.exp:1.4 Sun Jan 31 14:39:31 2021 +++ src/tests/usr.bin/xlint/lint1/d_type_conv1.exp Thu Feb 4 06:55:00 2021 @@ -1 +1 @@ -d_type_conv1.c(13): warning: argument #1 is converted from 'long long' to 'unsigned int' [259] +d_type_conv1.c(13): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259] Index: src/tests/usr.bin/xlint/lint1/d_type_conv2.exp diff -u src/tests/usr.bin/xlint/lint1/d_type_conv2.exp:1.4 src/tests/usr.bin/xlint/lint1/d_type_conv2.exp:1.5 --- src/tests/usr.bin/xlint/lint1/d_type_conv2.exp:1.4 Sun Jan 31 14:39:31 2021 +++ src/tests/usr.bin/xlint/lint1/d_type_conv2.exp Thu Feb 4 06:55:00 2021 @@ -1 +1 @@ -d_type_conv2.c(13): warning: argument #1 is converted from 'double' to 'float' [259] +d_type_conv2.c(13): warning: argument #1 is converted from 'double' to 'float' due to prototype [259] Index: src/tests/usr.bin/xlint/lint1/d_type_conv3.exp diff -u src/tests/usr.bin/xlint/lint1/d_type_conv3.exp:1.4 src/tests/usr.bin/xlint/lint1/d_type_conv3.exp:1.5 --- src/tests/usr.bin/xlint/lint1/d_type_conv3.exp:1.4 Sun Jan 31 14:39:31 2021 +++ src/tests/usr.bin/xlint/lint1/d_type_conv3.exp Thu Feb 4 06:55:00 2021 @@ -1,2 +1,2 @@ -d_type_conv3.c(12): warning: argument #1 is converted from 'long long' to 'unsigned int' [259] +d_type_conv3.c(12): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259] d_type_conv3.c(12): warning: conversion of 'long long' to 'unsigned int' is out of range, arg #1 [295] Index: src/tests/usr.bin/xlint/lint1/msg_259.c diff -u src/tests/usr.bin/xlint/lint1/msg_259.c:1.4 src/tests/usr.bin/xlint/lint1/msg_259.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_259.c:1.4 Sun Jan 31 14:05:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_259.c Thu Feb 4 06:55:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_259.c,v 1.4 2021/01/31 14:05:00 rillig Exp $ */ +/* $NetBSD: msg_259.c,v 1.5 2021/02/04 06:55:00 rillig Exp $ */ # 3 "msg_259.c" // Test for message: argument #%d is converted from '%s' to '%s' [259] @@ -14,10 +14,10 @@ example(char c, int i, long l) { farg_char(c); farg_int(c); - farg_long(c); + farg_long(c); /* XXX: 259 on ILP32 but not LP64 */ farg_char(i); /* XXX: why no warning? */ farg_int(i); - farg_long(i); + farg_long(i); /* XXX: 259 on ILP32 but not LP64 */ farg_char(l); /* XXX: why no warning? */ farg_int(l); /* expect: 259 */ farg_long(l); Index: src/tests/usr.bin/xlint/lint1/msg_259.exp diff -u src/tests/usr.bin/xlint/lint1/msg_259.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_259.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_259.exp:1.4 Sun Jan 31 14:05:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_259.exp Thu Feb 4 06:55:00 2021 @@ -1 +1 @@ -msg_259.c(22): warning: argument #1 is converted from 'long' to 'int' [259] +msg_259.c(22): warning: argument #1 is converted from 'long' to 'int' due to prototype [259] Index: src/tests/usr.bin/xlint/lint1/d_gcc_extension.exp diff -u src/tests/usr.bin/xlint/lint1/d_gcc_extension.exp:1.5 src/tests/usr.bin/xlint/lint1/d_gcc_extension.exp:1.6 --- src/tests/usr.bin/xlint/lint1/d_gcc_extension.exp:1.5 Sun Jan 31 14:57:28 2021 +++ src/tests/usr.bin/xlint/lint1/d_gcc_extension.exp Thu Feb 4 06:55:00 2021 @@ -1,2 +1,2 @@ -d_gcc_extension.c(11): warning: argument #1 is converted from 'double' to 'long double' [259] -d_gcc_extension.c(11): warning: argument #1 is converted from 'double' to 'long double' [259] +d_gcc_extension.c(11): warning: argument #1 is converted from 'double' to 'long double' due to prototype [259] +d_gcc_extension.c(11): warning: argument #1 is converted from 'double' to 'long double' due to prototype [259] Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.77 src/usr.bin/xlint/lint1/err.c:1.78 --- src/usr.bin/xlint/lint1/err.c:1.77 Sun Jan 31 14:05:00 2021 +++ src/usr.bin/xlint/lint1/err.c Thu Feb 4 06:54:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.77 2021/01/31 14:05:00 rillig Exp $ */ +/* $NetBSD: err.c,v 1.78 2021/02/04 06:54:59 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.77 2021/01/31 14:05:00 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.78 2021/02/04 06:54:59 rillig Exp $"); #endif #include <sys/types.h> @@ -318,7 +318,7 @@ const char *msgs[] = { "unterminated comment", /* 256 */ "extra characters in lint comment", /* 257 */ "unterminated string constant", /* 258 */ - "argument #%d is converted from '%s' to '%s'", /* 259 */ + "argument #%d is converted from '%s' to '%s' due to prototype", /* 259 */ "previous declaration of %s", /* 260 */ "previous definition of %s", /* 261 */ "\\\" inside character constants undefined in traditional C", /* 262 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.204 src/usr.bin/xlint/lint1/tree.c:1.205 --- src/usr.bin/xlint/lint1/tree.c:1.204 Sun Jan 31 14:05:00 2021 +++ src/usr.bin/xlint/lint1/tree.c Thu Feb 4 06:54:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.204 2021/01/31 14:05:00 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.205 2021/02/04 06:54:59 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.204 2021/01/31 14:05:00 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.205 2021/02/04 06:54:59 rillig Exp $"); #endif #include <float.h> @@ -2101,7 +2101,7 @@ check_prototype_conversion(int arg, tspe psize(nt) != psize(ot)) { /* representation and/or width change */ if (!is_integer(ot) || psize(ot) > psize(INT)) { - /* argument #%d is converted from '%s' to '%s' */ + /* argument #%d is converted from '%s' to '%s' ... */ warning(259, arg, type_name(tn->tn_type), type_name(tp)); } @@ -2118,7 +2118,7 @@ check_prototype_conversion(int arg, tspe msb(ptn->tn_val->v_quad, ot, -1) == 0) { /* ok */ } else { - /* argument #%d is converted from '%s' to '%s' */ + /* argument #%d is converted from '%s' to '%s' ... */ warning(259, arg, type_name(tn->tn_type), type_name(tp)); }