tests/lint: add test for GCC unused statement
Seen in xsrc/LRGB.c:799. Even though it looks like this lint error may have been introduced by cgram.y 1.400 from 2022-04-24 (since LRGB.c has been unchanged for a month), earlier versions of lint produce the same parse errors.
This commit is contained in:
parent
5082768d7f
commit
92985015bc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: gcc_attribute_stmt.c,v 1.1 2021/07/06 17:33:07 rillig Exp $ */
|
||||
/* $NetBSD: gcc_attribute_stmt.c,v 1.2 2022/04/28 07:10:39 rillig Exp $ */
|
||||
# 3 "gcc_attribute_stmt.c"
|
||||
|
||||
/*
|
||||
|
@ -34,3 +34,24 @@ attribute_fallthrough(int i)
|
|||
__attribute__((__fallthrough__));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Despite being undocumented, GCC 10 accepts __attribute__((__unused__))
|
||||
* at the beginning of a statement.
|
||||
*/
|
||||
void
|
||||
unused_statements(int x)
|
||||
{
|
||||
switch (x) {
|
||||
case 3:
|
||||
__attribute__((__unused__))
|
||||
/* expect+1: error: syntax error 'break' [249] */
|
||||
break;
|
||||
case 4:
|
||||
goto label;
|
||||
label:
|
||||
__attribute__((__unused__))
|
||||
/* expect+1: error: syntax error 'return' [249] */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
gcc_attribute_stmt.c(34): error: syntax error '__attribute__' [249]
|
||||
gcc_attribute_stmt.c(49): error: syntax error 'break' [249]
|
||||
gcc_attribute_stmt.c(55): error: syntax error 'return' [249]
|
||||
|
|
Loading…
Reference in New Issue