11.4Srillig/*	$NetBSD: gcc_attribute_stmt.c,v 1.4 2023/03/28 14:44:34 rillig Exp $	*/
21.1Srillig# 3 "gcc_attribute_stmt.c"
31.1Srillig
41.1Srillig/*
51.1Srillig * Tests for the GCC __attribute__ for statements.
61.1Srillig *
71.1Srillig * https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
81.1Srillig */
91.1Srillig
101.4Srillig/* lint1-extra-flags: -X 351 */
111.4Srillig
121.1Srilligvoid println(const char *);
131.1Srillig
141.1Srilligvoid
151.1Srilligattribute_fallthrough(int i)
161.1Srillig{
171.1Srillig	switch (i) {
181.1Srillig	case 5:
191.1Srillig		/*
201.1Srillig		 * The attribute 'fallthrough' is only valid after a
211.1Srillig		 * preceding statement. This is already caught by GCC, so
221.1Srillig		 * lint does not need to care.
231.1Srillig		 */
241.1Srillig		__attribute__((__fallthrough__));
251.1Srillig	case 3:
261.1Srillig		println("odd");
271.1Srillig		__attribute__((__fallthrough__));
281.1Srillig	case 2:
291.1Srillig		/*
301.1Srillig		 * Only the null statement can have the attribute
311.1Srillig		 * 'fallthrough'. This is already caught by GCC, so
321.1Srillig		 * lint does not need to care.
331.1Srillig		 */
341.1Srillig		/* expect+2: error: syntax error '__attribute__' [249] */
351.1Srillig		println("prime")
361.1Srillig		    __attribute__((__fallthrough__));
371.1Srillig	}
381.1Srillig}
39