aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cutil.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2019-09-30 17:27:23 +0200
committerBernhard Schommer <bschommer@users.noreply.github.com>2019-09-30 17:32:25 +0200
commitd09786a563c7cbea8aa27c0e7da0dff4231b9253 (patch)
tree5f02a672362a959741da855329a1d3c64f1ad63c /cparser/Cutil.ml
parenta8586f12b75687061a6d8df9d23696d35f4472f0 (diff)
downloadcompcert-kvx-d09786a563c7cbea8aa27c0e7da0dff4231b9253.tar.gz
compcert-kvx-d09786a563c7cbea8aa27c0e7da0dff4231b9253.zip
Various improvements for diagnostics.
* Extend check for incomplete type. Extended the check to also include a check for variables with incomplete object type that are not arrays, that have an initializer. Furthermore the warning includes the type and variable name. * Warning for incomplete type in compound literals. Incomplete types are not allowed for compound literals, except for array types. * Extend type printing function. The type of a typedeof of an anonymous type should not be printed. Furthermore added '<anonymous>' to the printing of anonymous types. * Unify incomplete type errors message. The incomplete type error messages should all look the same including name of the variable, parameter, etc. and then the incomplete type.
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r--cparser/Cutil.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml
index 7a2f4828..3467c092 100644
--- a/cparser/Cutil.ml
+++ b/cparser/Cutil.ml
@@ -836,6 +836,12 @@ let is_anonymous_composite = function
| TUnion (id,_) -> id.C.name = ""
| _ -> false
+let is_anonymous_type = function
+ | TEnum (id,_)
+ | TStruct (id,_)
+ | TUnion (id,_) -> id.C.name = ""
+ | _ -> false
+
let is_function_pointer_type env t =
match unroll env t with
| TPtr (ty, _) -> is_function_type env ty