diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-08-19 00:21:42 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-22 07:04:36 +0200 |
commit | c988415e7a89479679e053835d6c5c92e8789993 (patch) | |
tree | 51c2e4e66ac3178eac3e799f08794d7f9825e5eb | |
parent | cfca7b4c6cb48283cb554fc91dc859ff669f2547 (diff) | |
download | sparse-c988415e7a89479679e053835d6c5c92e8789993.tar.gz |
add testcase for missing inline definition
If the address of an inline function is taken, a definition
for this function must be emitted.
However, sparse only do this if this inline function is defined
before it is used.
So add a testcase for this.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | validation/linear/inline-definition.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/validation/linear/inline-definition.c b/validation/linear/inline-definition.c new file mode 100644 index 00000000..2918bd5d --- /dev/null +++ b/validation/linear/inline-definition.c @@ -0,0 +1,30 @@ +extern void use(void *); + +static inline int inl0(int a); +static inline int inl1(int a); + +static inline int inl0(int a) +{ + return a; +} + +void foo(void) +{ + use(inl0); + use(inl1); +} + +static inline int inl1(int a) +{ + return a; +} + +/* + * check-name: inline-definition + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: inl0: + * check-output-contains: inl1: + */ |