lint: reword message about bit-field in a union

There is nothing illegal about a bit-field in a union, it is allowed by
C90, C99 and C11.

Fixes PR toolchain/53219.
This commit is contained in:
rillig 2022-02-07 02:44:49 +00:00
parent cdc3b2d88e
commit a3b73aeb65
4 changed files with 10 additions and 10 deletions

View File

@ -1,10 +1,10 @@
/* $NetBSD: msg_041.c,v 1.3 2022/02/07 02:39:10 rillig Exp $ */
/* $NetBSD: msg_041.c,v 1.4 2022/02/07 02:44:49 rillig Exp $ */
# 3 "msg_041.c"
// Test for message: illegal use of bit-field [41]
// Test for message: bit-field in union is very unusual [41]
union u {
int member;
/* expect+1: illegal use of bit-field [41] */
/* expect+1: bit-field in union is very unusual [41] */
unsigned bit_field : 7;
};

View File

@ -1 +1 @@
msg_041.c(9): warning: illegal use of bit-field [41]
msg_041.c(9): warning: bit-field in union is very unusual [41]

View File

@ -1,4 +1,4 @@
/* $NetBSD: decl.c,v 1.243 2021/12/22 14:25:35 rillig Exp $ */
/* $NetBSD: decl.c,v 1.244 2022/02/07 02:44:49 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.243 2021/12/22 14:25:35 rillig Exp $");
__RCSID("$NetBSD: decl.c,v 1.244 2022/02/07 02:44:49 rillig Exp $");
#endif
#include <sys/param.h>
@ -1134,7 +1134,7 @@ declare_bit_field(sym_t *dsym, tspec_t *inout_t, type_t **const inout_tp)
tp->t_flen = size_in_bits(t);
}
if (dsym->s_scl == MOU) {
/* illegal use of bit-field */
/* bit-field in union is very unusual */
warning(41);
dsym->s_type->t_bitfield = false;
dsym->s_bitfield = false;

View File

@ -1,4 +1,4 @@
/* $NetBSD: err.c,v 1.151 2021/12/22 14:25:35 rillig Exp $ */
/* $NetBSD: err.c,v 1.152 2022/02/07 02:44:49 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.151 2021/12/22 14:25:35 rillig Exp $");
__RCSID("$NetBSD: err.c,v 1.152 2022/02/07 02:44:49 rillig Exp $");
#endif
#include <sys/types.h>
@ -95,7 +95,7 @@ const char *const msgs[] = {
"function illegal in structure or union", /* 38 */
"zero sized array in struct is a C99 extension: %s", /* 39 */
"unknown size: %s", /* 40 */
"illegal use of bit-field", /* 41 */
"bit-field in union is very unusual", /* 41 */
"forward reference to enum type", /* 42 */
"redefinition hides earlier one: %s", /* 43 */
"declaration introduces new type in ANSI C: %s %s", /* 44 */