aboutsummaryrefslogtreecommitdiffstats
path: root/cparser
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-08-17 12:34:28 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2016-08-17 12:34:28 +0200
commite2b4459ccd1b0f8436cb70a631772d715e642dcd (patch)
tree22f9d82330c64b20cdcf506e09e2d253e907981e /cparser
parent0f9d824914c9dff0bf5d983ab387a5b5326307fc (diff)
downloadcompcert-e2b4459ccd1b0f8436cb70a631772d715e642dcd.tar.gz
compcert-e2b4459ccd1b0f8436cb70a631772d715e642dcd.zip
Exit earlier on empty union.
Instead of a warning for an empty union CompCert reports an error and exits. This avoids problems during the generation of initializers for these. Bug 19565.
Diffstat (limited to 'cparser')
-rw-r--r--cparser/Elab.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index 1586f142..8cd7ed64 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -813,7 +813,11 @@ and elab_struct_or_union_info kind loc env members attrs =
check_incomplete m;
(* Warn for empty structs or unions *)
if m = [] then
- warning loc "empty %s" (if kind = Struct then "struct" else "union");
+ if kind = Struct then begin
+ warning loc "empty struct"
+ end else begin
+ fatal_error loc "empty union"
+ end;
(composite_info_def env' kind attrs m, env')
and elab_struct_or_union only kind loc tag optmembers attrs env =