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: add type information to unportable...
details: https://anonhg.NetBSD.org/src/rev/6f85f0cf2e11
branches: trunk
changeset: 1021201:6f85f0cf2e11
user: rillig <rillig%NetBSD.org@localhost>
date: Sun May 16 10:34:19 2021 +0000
description:
lint: add type information to unportable bit-field type
Seeing the message "unportable bit-field type 'int'" may sound strange
at first, but that's a strict interpretation of the wording in C99
6.7.2.1p4, which requires that the bit-field type is "'_Bool', 'unsigned
int' or 'signed int', or some other implementation-defined type".
The rationale for C99 6.7.2.1 explicitly lists plain 'int' among the
allowed types for bit-fields, regardless of any additional
implementation-defined types. This means that lint had interpreted this
paragraph wrong, and it should be fixed to allow plain int as well.
diffstat:
tests/usr.bin/xlint/lint1/msg_034.c | 4 ++--
tests/usr.bin/xlint/lint1/msg_034.exp | 2 +-
tests/usr.bin/xlint/lint1/msg_166.exp | 4 ++--
usr.bin/xlint/lint1/decl.c | 12 ++++++------
usr.bin/xlint/lint1/err.c | 6 +++---
5 files changed, 14 insertions(+), 14 deletions(-)
diffs (94 lines):
diff -r 6bb750c30a21 -r 6f85f0cf2e11 tests/usr.bin/xlint/lint1/msg_034.c
--- a/tests/usr.bin/xlint/lint1/msg_034.c Sun May 16 10:18:24 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_034.c Sun May 16 10:34:19 2021 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_034.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */
+/* $NetBSD: msg_034.c,v 1.4 2021/05/16 10:34:19 rillig Exp $ */
# 3 "msg_034.c"
-// Test for message: nonportable bit-field type [34]
+// Test for message: nonportable bit-field type '%s' [34]
/* lint1-flags: -S -g -p -w */
diff -r 6bb750c30a21 -r 6f85f0cf2e11 tests/usr.bin/xlint/lint1/msg_034.exp
--- a/tests/usr.bin/xlint/lint1/msg_034.exp Sun May 16 10:18:24 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_034.exp Sun May 16 10:34:19 2021 +0000
@@ -1,1 +1,1 @@
-msg_034.c(9): warning: nonportable bit-field type [34]
+msg_034.c(9): warning: nonportable bit-field type 'int' [34]
diff -r 6bb750c30a21 -r 6f85f0cf2e11 tests/usr.bin/xlint/lint1/msg_166.exp
--- a/tests/usr.bin/xlint/lint1/msg_166.exp Sun May 16 10:18:24 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_166.exp Sun May 16 10:34:19 2021 +0000
@@ -1,5 +1,5 @@
-msg_166.c(25): warning: nonportable bit-field type [34]
-msg_166.c(26): warning: nonportable bit-field type [34]
+msg_166.c(25): warning: nonportable bit-field type 'int' [34]
+msg_166.c(26): warning: nonportable bit-field type 'int' [34]
msg_166.c(35): warning: precision lost in bit-field assignment [166]
msg_166.c(38): warning: precision lost in bit-field assignment [166]
msg_166.c(39): warning: precision lost in bit-field assignment [166]
diff -r 6bb750c30a21 -r 6f85f0cf2e11 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun May 16 10:18:24 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun May 16 10:34:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.180 2021/05/02 22:07:49 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.181 2021/05/16 10:34:19 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: decl.c,v 1.180 2021/05/02 22:07:49 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.181 2021/05/16 10:34:19 rillig Exp $");
#endif
#include <sys/param.h>
@@ -1106,14 +1106,14 @@
/* bit-field type '%s' invalid in ANSI C */
warning(273, type_name(tp));
} else if (pflag) {
- /* nonportable bit-field type */
- warning(34);
+ /* nonportable bit-field type '%s' */
+ warning(34, type_name(tp));
}
}
} else if (t == INT && dcs->d_sign_mod == NOTSPEC) {
if (pflag && !bitfieldtype_ok) {
- /* nonportable bit-field type */
- warning(34);
+ /* nonportable bit-field type '%s' */
+ warning(34, type_name(tp));
}
} else if (t != INT && t != UINT && t != BOOL) {
/*
diff -r 6bb750c30a21 -r 6f85f0cf2e11 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sun May 16 10:18:24 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sun May 16 10:34:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.117 2021/05/16 10:18:24 rillig Exp $ */
+/* $NetBSD: err.c,v 1.118 2021/05/16 10:34:19 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.117 2021/05/16 10:18:24 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.118 2021/05/16 10:34:19 rillig Exp $");
#endif
#include <sys/types.h>
@@ -88,7 +88,7 @@
"incomplete structure or union %s: %s", /* 31 */
"argument type defaults to 'int': %s", /* 32 */
"duplicate member name: %s", /* 33 */
- "nonportable bit-field type", /* 34 */
+ "nonportable bit-field type '%s'", /* 34 */
"illegal bit-field type '%s'", /* 35 */
"illegal bit-field size: %d", /* 36 */
"zero size bit-field", /* 37 */
Home |
Main Index |
Thread Index |
Old Index