tests/lint: add test for struct initialization in traditional C

This commit is contained in:
rillig 2021-03-28 15:12:20 +00:00
parent 60c74c06b2
commit 7261c8f667
2 changed files with 30 additions and 5 deletions

View File

@ -1,7 +1,25 @@
/* $NetBSD: msg_188.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
/* $NetBSD: msg_188.c,v 1.3 2021/03/28 15:12:20 rillig Exp $ */
# 3 "msg_188.c"
// Test for message: no automatic aggregate initialization in traditional C [188]
/* Test for message: no automatic aggregate initialization in traditional C [188] */
TODO: "Add example code that triggers the above message." /* expect: 249 */
TODO: "Add example code that almost triggers the above message."
/* lint1-flags: -tw */
struct point {
int x;
int y;
};
struct point global = {
3,
4,
};
void
function()
{
struct point local = { /* expect: 188 */
3,
4,
};
}

View File

@ -1 +1,8 @@
msg_188.c(6): error: syntax error ':' [249]
(1): warning: 'long double' is illegal in traditional C [266]
(1): warning: function prototypes are illegal in traditional C [270]
(2): warning: 'long double' is illegal in traditional C [266]
(2): warning: function prototypes are illegal in traditional C [270]
(3): warning: 'long double' is illegal in traditional C [266]
(3): warning: 'long double' is illegal in traditional C [266]
(3): warning: function prototypes are illegal in traditional C [270]
msg_188.c(21): warning: no automatic aggregate initialization in traditional C [188]