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 'illegal b...



details:   https://anonhg.NetBSD.org/src/rev/dc02513c18a5
branches:  trunk
changeset: 959890:dc02513c18a5
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 28 02:45:37 2021 +0000

description:
lint: add type information to 'illegal bit-field type'

diffstat:

 tests/usr.bin/xlint/lint1/msg_035.c   |   4 ++--
 tests/usr.bin/xlint/lint1/msg_035.exp |  32 ++++++++++++++++----------------
 usr.bin/xlint/lint1/decl.c            |   8 ++++----
 usr.bin/xlint/lint1/err.c             |   6 +++---
 4 files changed, 25 insertions(+), 25 deletions(-)

diffs (108 lines):

diff -r 5c3fe43a5237 -r dc02513c18a5 tests/usr.bin/xlint/lint1/msg_035.c
--- a/tests/usr.bin/xlint/lint1/msg_035.c       Sun Feb 28 02:39:15 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_035.c       Sun Feb 28 02:45:37 2021 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: msg_035.c,v 1.6 2021/01/31 11:12:07 rillig Exp $       */
+/*     $NetBSD: msg_035.c,v 1.7 2021/02/28 02:45:37 rillig Exp $       */
 # 3 "msg_035.c"
 
-// Test for message: illegal bit-field type [35]
+// Test for message: illegal bit-field type '%s' [35]
 
 /*
  * In traditional C, only unsigned int is a portable bit-field type.
diff -r 5c3fe43a5237 -r dc02513c18a5 tests/usr.bin/xlint/lint1/msg_035.exp
--- a/tests/usr.bin/xlint/lint1/msg_035.exp     Sun Feb 28 02:39:15 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_035.exp     Sun Feb 28 02:45:37 2021 +0000
@@ -1,19 +1,19 @@
-msg_035.c(41): warning: illegal bit-field type [35]
-msg_035.c(42): warning: illegal bit-field type [35]
-msg_035.c(43): warning: illegal bit-field type [35]
-msg_035.c(44): warning: illegal bit-field type [35]
-msg_035.c(47): warning: illegal bit-field type [35]
-msg_035.c(48): warning: illegal bit-field type [35]
-msg_035.c(49): warning: illegal bit-field type [35]
+msg_035.c(41): warning: illegal bit-field type 'long' [35]
+msg_035.c(42): warning: illegal bit-field type 'unsigned long' [35]
+msg_035.c(43): warning: illegal bit-field type 'long long' [35]
+msg_035.c(44): warning: illegal bit-field type 'unsigned long long' [35]
+msg_035.c(47): warning: illegal bit-field type 'float' [35]
+msg_035.c(48): warning: illegal bit-field type 'double' [35]
+msg_035.c(49): warning: illegal bit-field type 'long double' [35]
 msg_035.c(50): void type for 'void_flag' [19]
 msg_035.c(50): zero size bit-field [37]
-msg_035.c(51): warning: illegal bit-field type [35]
-msg_035.c(52): warning: illegal bit-field type [35]
-msg_035.c(54): warning: illegal bit-field type [35]
-msg_035.c(55): warning: illegal bit-field type [35]
-msg_035.c(56): warning: illegal bit-field type [35]
+msg_035.c(51): warning: illegal bit-field type 'struct typedef example_struct' [35]
+msg_035.c(52): warning: illegal bit-field type 'union typedef example_union' [35]
+msg_035.c(54): warning: illegal bit-field type 'pointer to void' [35]
+msg_035.c(55): warning: illegal bit-field type 'array of unsigned int[4]' [35]
+msg_035.c(56): warning: illegal bit-field type 'function(int, pointer to const char) returning void' [35]
 msg_035.c(57): invalid type for _Complex [308]
-msg_035.c(57): warning: illegal bit-field type [35]
-msg_035.c(58): warning: illegal bit-field type [35]
-msg_035.c(59): warning: illegal bit-field type [35]
-msg_035.c(60): warning: illegal bit-field type [35]
+msg_035.c(57): warning: illegal bit-field type 'double _Complex' [35]
+msg_035.c(58): warning: illegal bit-field type 'float _Complex' [35]
+msg_035.c(59): warning: illegal bit-field type 'double _Complex' [35]
+msg_035.c(60): warning: illegal bit-field type 'long double _Complex' [35]
diff -r 5c3fe43a5237 -r dc02513c18a5 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sun Feb 28 02:39:15 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sun Feb 28 02:45:37 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.139 2021/02/28 00:23:55 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.140 2021/02/28 02:45:37 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.139 2021/02/28 00:23:55 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.140 2021/02/28 02:45:37 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1128,8 +1128,8 @@
                         * okay only if BITFIELDTYPE is in effect.
                         */
                        if (!bitfieldtype_ok || !is_integer(t)) {
-                               /* illegal bit-field type */
-                               warning(35);
+                               /* illegal bit-field type '%s' */
+                               warning(35, type_name(tp));
                                sz = tp->t_flen;
                                dsym->s_type = tp = duptyp(gettyp(t = INT));
                                if ((tp->t_flen = sz) > size(t))
diff -r 5c3fe43a5237 -r dc02513c18a5 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sun Feb 28 02:39:15 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sun Feb 28 02:45:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.85 2021/02/28 02:00:05 rillig Exp $  */
+/*     $NetBSD: err.c,v 1.86 2021/02/28 02:45:37 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.85 2021/02/28 02:00:05 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.86 2021/02/28 02:45:37 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -94,7 +94,7 @@
        "argument type defaults to 'int': %s",                        /* 32 */
        "duplicate member name: %s",                                  /* 33 */
        "nonportable bit-field type",                                 /* 34 */
-       "illegal bit-field type",                                     /* 35 */
+       "illegal bit-field type '%s'",                                /* 35 */
        "illegal bit-field size: %d",                                 /* 36 */
        "zero size bit-field",                                        /* 37 */
        "function illegal in structure or union",                     /* 38 */



Home | Main Index | Thread Index | Old Index