xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_102.c (revision a89419496ccb82ce1bff984f79f626ab7d0ff245)
1 /*	$NetBSD: msg_102.c,v 1.4 2022/06/19 12:14:34 rillig Exp $	*/
2 # 3 "msg_102.c"
3 
4 // Test for message: illegal use of member '%s' [102]
5 
6 // Anonymous members are defined in C11 6.7.2.1p2.
7 
8 struct bit_fields_and_bits {
9 	union {
10 		struct {
11 			unsigned bit_0:1;
12 			unsigned bit_1:1;
13 		};
14 		unsigned bits;
15 	};
16 };
17 
18 static inline _Bool
19 eq(const struct bit_fields_and_bits *a, const struct bit_fields_and_bits *b)
20 {
21 	/*
22 	 * TODO: Once this is fixed, enable lint in
23 	 * external/mit/xorg/lib/dri.old/Makefile again.
24 	 */
25 	/* TODO: Add support for C11 anonymous struct and union members. */
26 	/* expect+2: error: illegal use of member 'bits' [102] */
27 	/* expect+1: error: illegal use of member 'bits' [102] */
28 	return a->bits == b->bits;
29 }
30