diff options
| author | Al Viro <viro@ftp.linux.org.uk> | 2007-07-10 02:07:33 +0100 |
|---|---|---|
| committer | Josh Triplett <josh@freedesktop.org> | 2007-07-10 08:39:38 -0700 |
| commit | 073d2a3ab34f5f196150c684e5970b22d2acf2b4 (patch) | |
| tree | b9690383be163413313197a31c1771828026ff0e /validation | |
| parent | 449a5e3b13e1ba529c63dc80615e79d2dafe539b (diff) | |
| download | sparse-dev-073d2a3ab34f5f196150c684e5970b22d2acf2b4.tar.gz | |
fix handling of pointers in ?:
a) qualifiers are joined (const int * / volatile int * -> const volatile int *)
b) pointer to void / pointer to T => pointer to void (with all qualifiers)
testcase added
Still missing: T1 * / T2 * => pointer to composite type of T1 and T2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/cond_expr2.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/validation/cond_expr2.c b/validation/cond_expr2.c new file mode 100644 index 00000000..e53cd133 --- /dev/null +++ b/validation/cond_expr2.c @@ -0,0 +1,23 @@ +extern const int *p; +extern volatile void *q; +extern volatile int *r; +static void f(void) +{ + q = 1 ? p : q; // warn: const volatile void * -> const int * + r = 1 ? r : q; // OK: volatile void * -> volatile int * + r = 1 ? r : p; // warn: const volatile int * -> volatile int * +} +/* + * check-name: type of conditional expression + * check-description: Used to miss qualifier mixing and mishandle void * + * check-command: sparse $file + * + * check-output-start +cond_expr2.c:6:4: warning: incorrect type in assignment (different modifiers) +cond_expr2.c:6:4: expected void volatile *extern [addressable] [toplevel] q +cond_expr2.c:6:4: got void const volatile * +cond_expr2.c:8:4: warning: incorrect type in assignment (different modifiers) +cond_expr2.c:8:4: expected int volatile *extern [addressable] [toplevel] [assigned] r +cond_expr2.c:8:4: got int const volatile * + * check-output-end + */ |
