diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-04-14 10:14:26 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-05-01 16:29:22 +0200 |
| commit | d06d4f79458da533a0e57b322ed8aab997845ddf (patch) | |
| tree | 220c30ab958ef2296fc4427d843a210301b7bc75 | |
| parent | 551b85c8a241bd45b267db152eca4cb01eddce39 (diff) | |
| download | sparse-dev-d06d4f79458da533a0e57b322ed8aab997845ddf.tar.gz | |
add testcase for enum / int type difference
Currently, type_difference() doesn't make a distinction between
enums & ints.
Add some testcases for this and mark the test as 'known-to-fail'.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | validation/typediff-enum.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/validation/typediff-enum.c b/validation/typediff-enum.c new file mode 100644 index 00000000..c5f2dc0a --- /dev/null +++ b/validation/typediff-enum.c @@ -0,0 +1,34 @@ +enum num { ZERO, ONE, MANY, }; +typedef enum num num; + +extern int v; +num v = 0; + +extern num w; +int w = 0; + +int foo(void); +num foo(void) { return ZERO; } + +num bar(void); +int bar(void) { return ZERO; } + +void baz(int a); +void baz(num a) { } + +void qux(num a); +void qux(int a) { } + +/* + * check-name: typediff-enum + * check-known-to-fail + * + * check-error-start +typediff-enum.c:5:5: error: symbol 'v' redeclared with different type (originally declared at typediff-enum.c:4) - different types +typediff-enum.c:8:5: error: symbol 'w' redeclared with different type (originally declared at typediff-enum.c:7) - different types +typediff-enum.c:11:5: error: symbol 'foo' redeclared with different type (originally declared at typediff-enum.c:10) - different types +typediff-enum.c:14:5: error: symbol 'bar' redeclared with different type (originally declared at typediff-enum.c:13) - different types +typediff-enum.c:17:6: error: symbol 'baz' redeclared with different type (originally declared at typediff-enum.c:16) - incompatible argument 1 (different types) +typediff-enum.c:20:6: error: symbol 'qux' redeclared with different type (originally declared at typediff-enum.c:19) - incompatible argument 1 (different types) + * check-error-end + */ |
