diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-02-09 21:56:57 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-02-09 23:55:56 +0100 |
| commit | b369f9225bfcf59361c986c8b7fbbacb420cb936 (patch) | |
| tree | 982e29ec15ee64fc4dd4cfd9097994a4b5dce379 /validation/expand | |
| parent | 98276e6116f3bc34839519db3a1cccc78a2f0838 (diff) | |
| download | sparse-dev-b369f9225bfcf59361c986c8b7fbbacb420cb936.tar.gz | |
inline: add some tests
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/expand')
| -rw-r--r-- | validation/expand/builtin_constant_inline0.c | 24 | ||||
| -rw-r--r-- | validation/expand/builtin_constant_inline1.c | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/validation/expand/builtin_constant_inline0.c b/validation/expand/builtin_constant_inline0.c new file mode 100644 index 00000000..9e775d5e --- /dev/null +++ b/validation/expand/builtin_constant_inline0.c @@ -0,0 +1,24 @@ +static inline int is_const(long size) +{ + return __builtin_constant_p(size) ? size : 0; +} + +int foo(void) +{ + return is_const(42); +} + +/* + * check-name: builtin_constant_inline0 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-start +foo: +.L0: + <entry-point> + ret.32 $42 + + + * check-output-end + */ diff --git a/validation/expand/builtin_constant_inline1.c b/validation/expand/builtin_constant_inline1.c new file mode 100644 index 00000000..da08f960 --- /dev/null +++ b/validation/expand/builtin_constant_inline1.c @@ -0,0 +1,24 @@ +static inline void fun(void) { } + +#define EXPR ({ fun(); 42; }) + +int bar(void) +{ + // GCC doesn't consider EXPR as a constant + return __builtin_constant_p(EXPR); +} + +/* + * check-name: builtin_constant_inline1 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-start +bar: +.L0: + <entry-point> + ret.32 $0 + + + * check-output-end + */ |
