lint: add tests for some messages

This commit is contained in:
rillig 2021-01-07 18:37:41 +00:00
parent 3abd1687f2
commit d8ecd506c6
16 changed files with 88 additions and 32 deletions

View File

@ -1,7 +1,7 @@
/* $NetBSD: msg_006.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
/* $NetBSD: msg_006.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_006.c"
// Test for message: use 'double' instead of 'long float' [6]
TODO: "Add example code that triggers the above message."
TODO: "Add example code that almost triggers the above message."
long float x;
double x;

View File

@ -1 +1,2 @@
msg_006.c(6): syntax error ':' [249]
msg_006.c(6): warning: use 'double' instead of 'long float' [6]
msg_006.c(6): illegal type combination [4]

View File

@ -1,7 +1,7 @@
/* $NetBSD: msg_007.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
/* $NetBSD: msg_007.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_007.c"
// Test for message: only one storage class allowed [7]
TODO: "Add example code that triggers the above message."
TODO: "Add example code that almost triggers the above message."
extern static void example(void);
extern extern_function(void);

View File

@ -1 +1 @@
msg_007.c(6): syntax error ':' [249]
msg_007.c(6): only one storage class allowed [7]

View File

@ -1,7 +1,9 @@
/* $NetBSD: msg_008.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
/* $NetBSD: msg_008.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_008.c"
// Test for message: illegal storage class [8]
TODO: "Add example code that triggers the above message."
TODO: "Add example code that almost triggers the above message."
typedef void
example(void)
{
}

View File

@ -1 +1 @@
msg_008.c(6): syntax error ':' [249]
msg_008.c(8): illegal storage class [8]

View File

@ -1,7 +1,9 @@
/* $NetBSD: msg_009.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
/* $NetBSD: msg_009.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_009.c"
// Test for message: only register valid as formal parameter storage class [9]
TODO: "Add example code that triggers the above message."
TODO: "Add example code that almost triggers the above message."
extern void typedef_example(typedef int param);
extern void auto_example(auto int param);
extern void static_example(static int param);
extern void extern_example(extern int param);

View File

@ -1 +1,4 @@
msg_009.c(6): syntax error ':' [249]
msg_009.c(6): only register valid as formal parameter storage class [9]
msg_009.c(7): only register valid as formal parameter storage class [9]
msg_009.c(8): only register valid as formal parameter storage class [9]
msg_009.c(9): only register valid as formal parameter storage class [9]

View File

@ -1,7 +1,21 @@
/* $NetBSD: msg_010.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
/* $NetBSD: msg_010.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_010.c"
// Test for message: duplicate '%s' [10]
TODO: "Add example code that triggers the above message."
TODO: "Add example code that almost triggers the above message."
inline inline void
double_inline(void)
{
}
const const int
double_const(void)
{
return 0;
}
volatile volatile int
double_volatile(void)
{
return 0;
}

View File

@ -1 +1,3 @@
msg_010.c(6): syntax error ':' [249]
msg_010.c(6): warning: duplicate 'inline' [10]
msg_010.c(11): warning: duplicate 'const' [10]
msg_010.c(17): warning: duplicate 'volatile' [10]

View File

@ -1,7 +1,24 @@
/* $NetBSD: msg_011.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
/* $NetBSD: msg_011.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_011.c"
// Test for message: bit-field initializer out of range [11]
TODO: "Add example code that triggers the above message."
TODO: "Add example code that almost triggers the above message."
struct example {
int bit_field: 4;
} example_var[] = {
{ 2 },
{ 1 + 1 },
{ 1ULL << 40 },
{ 1LL << 40 },
{ -16 - 1 },
};
struct example_u {
unsigned int bit_field: 4;
} example_var_u[] = {
{ 2 },
{ 1 + 1 },
{ 1ULL << 40 },
{ 1LL << 40 },
{ -16 - 1 },
};

View File

@ -1 +1,6 @@
msg_011.c(6): syntax error ':' [249]
msg_011.c(11): warning: bit-field initializer does not fit [180]
msg_011.c(12): warning: bit-field initializer does not fit [180]
msg_011.c(13): warning: bit-field initializer does not fit [180]
msg_011.c(21): warning: bit-field initializer does not fit [180]
msg_011.c(22): warning: bit-field initializer does not fit [180]
msg_011.c(23): warning: initialisation of unsigned with negative constant [221]

View File

@ -1,7 +1,12 @@
/* $NetBSD: msg_180.c,v 1.1 2021/01/02 10:22:43 rillig Exp $ */
/* $NetBSD: msg_180.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_180.c"
// Test for message: bit-field initializer does not fit [180]
TODO: "Add example code that triggers the above message."
TODO: "Add example code that almost triggers the above message."
struct example {
unsigned int a: 5;
unsigned int b: 5;
} example_var = {
32,
31
};

View File

@ -1 +1 @@
msg_180.c(6): syntax error ':' [249]
msg_180.c(10): warning: bit-field initializer does not fit [180]

View File

@ -1,7 +1,12 @@
/* $NetBSD: msg_221.c,v 1.1 2021/01/02 10:22:44 rillig Exp $ */
/* $NetBSD: msg_221.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_221.c"
// Test for message: initialisation of unsigned with negative constant [221]
TODO: "Add example code that triggers the above message."
TODO: "Add example code that almost triggers the above message."
struct example {
unsigned int a: 5;
unsigned int b: 5;
} example_var = {
-1,
31
};

View File

@ -1 +1 @@
msg_221.c(6): syntax error ':' [249]
msg_221.c(10): warning: initialisation of unsigned with negative constant [221]