Module Name: src Committed By: rillig Date: Sun Feb 28 02:45:37 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_035.c msg_035.exp src/usr.bin/xlint/lint1: decl.c err.c Log Message: lint: add type information to 'illegal bit-field type' To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_035.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_035.exp cvs rdiff -u -r1.139 -r1.140 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.85 -r1.86 src/usr.bin/xlint/lint1/err.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/msg_035.c diff -u src/tests/usr.bin/xlint/lint1/msg_035.c:1.6 src/tests/usr.bin/xlint/lint1/msg_035.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_035.c:1.6 Sun Jan 31 11:12:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.c Sun Feb 28 02:45:37 2021 @@ -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. Index: src/tests/usr.bin/xlint/lint1/msg_035.exp diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.7 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.8 --- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.7 Sun Jan 31 11:23:01 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.exp Sun Feb 28 02:45:37 2021 @@ -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] Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.139 src/usr.bin/xlint/lint1/decl.c:1.140 --- src/usr.bin/xlint/lint1/decl.c:1.139 Sun Feb 28 00:23:55 2021 +++ src/usr.bin/xlint/lint1/decl.c Sun Feb 28 02:45:37 2021 @@ -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 @@ declarator_1_struct_union(sym_t *dsym) * 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)) Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.85 src/usr.bin/xlint/lint1/err.c:1.86 --- src/usr.bin/xlint/lint1/err.c:1.85 Sun Feb 28 02:00:05 2021 +++ src/usr.bin/xlint/lint1/err.c Sun Feb 28 02:45:37 2021 @@ -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 @@ const char *msgs[] = { "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 */