tests/lint: demonstrate wrong 'syntax error' for unused argument

Seen in pam_chroot.c:60.
This commit is contained in:
rillig 2021-08-11 05:08:35 +00:00
parent 36ba98046c
commit a8ba6cc958
2 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: gcc_attribute_var.c,v 1.3 2021/07/11 15:07:39 rillig Exp $ */
/* $NetBSD: gcc_attribute_var.c,v 1.4 2021/08/11 05:08:35 rillig Exp $ */
# 3 "gcc_attribute_var.c"
/*
@ -63,6 +63,15 @@ ambiguity_for_attribute(void)
}
}
void
attribute_after_array_brackets(
/* FIXME: GCC accepts this */
/* expect+1: error: syntax error '__attribute__' [249] */
const char *argv[] __attribute__((__unused__))
)
{
}
/* just to trigger _some_ error, to keep the .exp file */
/* expect+1: error: syntax error 'syntax_error' [249] */
__attribute__((syntax_error));

View File

@ -1,2 +1,3 @@
gcc_attribute_var.c(59): warning: 'var2' unused in function 'ambiguity_for_attribute' [192]
gcc_attribute_var.c(68): error: syntax error 'syntax_error' [249]
gcc_attribute_var.c(70): error: syntax error '__attribute__' [249]
gcc_attribute_var.c(77): error: syntax error 'syntax_error' [249]