Home | History | Annotate | Line # | Download | only in lint1
gcc_attribute_label.c revision 1.1
      1 /*	$NetBSD: gcc_attribute_label.c,v 1.1 2021/07/06 17:33:07 rillig Exp $	*/
      2 # 3 "gcc_attribute_label.c"
      3 
      4 /*
      5  * Tests for the GCC __attribute__ for labels.
      6  *
      7  * https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html
      8  */
      9 
     10 void dead(void);
     11 
     12 void
     13 test(int i)
     14 {
     15 	if (i < 1000)
     16 		goto hot;
     17 	/* TODO: add quotes to message 232 */
     18 	/*FIXME*//* expect+1: warning: label error unused in function test [232] */
     19 error:
     20 	__attribute__((__cold__));
     21 	dead();
     22 
     23 hot:
     24 	/* expect+1: error: syntax error '__hot__' [249] */
     25 	__attribute__((__hot__));
     26 	/*FIXME*//* expect+1: error: 'i' undefined [99] */
     27 	if (i < 0)
     28 		/* TODO: add quotes to message 23 */
     29 		/* expect+1: warning: undefined label error [23] */
     30 		goto error;
     31 }
     32