Sparse currently fails on this test. Signed-off-by: Hannes Eder <hannes@xxxxxxxxxxxxxx> --- I discovered this while hunting down the sparse segfault when checking kernel/cred.c. When preprocessing the file with gcc, gcc remains silent, but sparse complains: include/linux/skbuff.h:381:9: error: expected preprocessor identifier include/linux/skbuff.h:381:9: error: expected preprocessor identifier include/linux/skbuff.h:381:9: error: garbage at end: ) include/linux/skbuff.h:381:9: error: expected preprocessor identifier include/linux/skbuff.h:381:9: error: expected preprocessor identifier include/linux/skbuff.h:381:9: error: garbage at end: ) this is covered by the test case in a more abstract form. Sparse further complains about this, which is not yet covered in a test case: kernel/cred.c:281:9: error: unmatched #endif in stream kernel/cred.c:281:9: error: unmatched #endif in stream kernel/cred.c:281:9: error: unmatched #endif in stream validation/preprocessor/preprocessor22.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 validation/preprocessor/preprocessor22.c diff --git a/validation/preprocessor/preprocessor22.c b/validation/preprocessor/preprocessor22.c new file mode 100644 index 0000000..838479f --- /dev/null +++ b/validation/preprocessor/preprocessor22.c @@ -0,0 +1,21 @@ +#define CONFIG_FOO 1 + +#define define_struct(name, fields...) struct fields name; + +define_struct(a, { +#ifdef CONFIG_FOO + int b; +#endif +}); +/* + * check-name: Preprocessor #22 + * check-description: Sparse gets this wrong, should be fixed + * check-command: sparse -E $file + * check-known-to-fail + * + * check-output-start + +struct { +int b; } a;; + * check-output-end + */ -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html