aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/eval/union-cast-no.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-12 22:26:28 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-17 00:38:46 +0200
commit8b3cbf54ad42c68f5ea2fa5bc2cef5ce9e608571 (patch)
treed415ba8c9847ce463b0f967878d663737f6e9084 /validation/eval/union-cast-no.c
parent8b5d92da3b1919f574decb542d93fde82693fe71 (diff)
downloadsparse-dev-8b3cbf54ad42c68f5ea2fa5bc2cef5ce9e608571.tar.gz
union-cast: teach sparse about union casts
A cast to union type is a GCC extension similar to a compound literal just for union, using the syntax of a cast. However, sparse doesn't know about them and treats them like other casts to non-scalars. So, teach sparse about them, convert them to the corresponding compound literal and add a warning flag to enable/disable the associated warning: -W[no-]union-cast. Note: a difference between union casts and compound literals is that the union casts yield rvalues while compound literals are lvalues but this distinction is not yet done in this series. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/eval/union-cast-no.c')
-rw-r--r--validation/eval/union-cast-no.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/eval/union-cast-no.c b/validation/eval/union-cast-no.c
index d06b348d..6ba38db8 100644
--- a/validation/eval/union-cast-no.c
+++ b/validation/eval/union-cast-no.c
@@ -16,7 +16,6 @@ static union u bar(long l)
/*
* check-name: union-cast-no
* check-command: sparse -Wno-union-cast $file
- * check-known-to-fail
*
* check-error-start
eval/union-cast-no.c:13:17: warning: cast to non-scalar