smatch: relicense to GPLv2+
[smatch.git] / validation / preprocessor / preprocessor22.c
blobaf5bcb37fa305d2ce91f3eefe6afe9b67d6ffb76
1 #define CONFIG_FOO 1
3 #define define_struct(name, fields...) struct fields name;
5 define_struct(a, {
6 #ifdef CONFIG_FOO
7 int b;
8 #elif defined(CONFIG_BAR)
9 int c;
10 #else
11 int d;
12 #endif
13 });
15 * check-name: Preprocessor #22
17 * check-description: Directives are not allowed within a macro argument list,
18 * although cpp deals with it to treat macro more like C functions.
20 * check-command: sparse -E $file
22 * check-error-start
23 preprocessor/preprocessor22.c:6:1: error: directive in argument list
24 preprocessor/preprocessor22.c:8:1: error: directive in argument list
25 preprocessor/preprocessor22.c:10:1: error: directive in argument list
26 preprocessor/preprocessor22.c:12:1: error: directive in argument list
27 * check-error-end
29 * check-output-start
31 struct {
32 int b;
33 } a;;
34 * check-output-end