msg_130.c revision 1.4
11.4Srillig/*	$NetBSD: msg_130.c,v 1.4 2021/02/27 13:43:36 rillig Exp $	*/
21.1Srillig# 3 "msg_130.c"
31.1Srillig
41.1Srillig// Test for message: enum type mismatch, op %s [130]
51.1Srillig
61.2Srilligenum color {
71.4Srillig	RED	= 1 << 0,
81.4Srillig	GREEN	= 1 << 1,
91.4Srillig	BLUE	= 1 << 2
101.4Srillig};
111.4Srillig
121.4Srilligenum size {
131.4Srillig	SMALL,
141.4Srillig	MEDIUM,
151.4Srillig	LARGE
161.2Srillig};
171.2Srillig
181.2Srilligenum daytime {
191.2Srillig	NIGHT, MORNING, NOON, EVENING
201.2Srillig};
211.2Srillig
221.4Srilligvoid sink(_Bool);
231.4Srillig
241.4Srilligvoid
251.4Srilligexample(_Bool cond, enum color c, enum size s)
261.2Srillig{
271.4Srillig	sink(cond ? GREEN : MORNING);	/* expect: 130 */
281.4Srillig
291.4Srillig	sink(c != s);			/* expect: 130 */
301.4Srillig	sink(c == s);			/* expect: 130 */
311.4Srillig	sink((c & MEDIUM) != 0);	/* might be useful to warn about */
321.4Srillig	sink((c | MEDIUM) != 0);	/* might be useful to warn about */
331.4Srillig
341.4Srillig	c |= MEDIUM;			/* might be useful to warn about */
351.4Srillig	c &= MEDIUM;			/* might be useful to warn about */
361.4Srillig
371.4Srillig	/* The cast to unsigned is required by GCC at WARNS=6. */
381.4Srillig	c &= ~(unsigned)MEDIUM;		/* might be useful to warn about */
391.2Srillig}
40