Skip to content
Snippets Groups Projects
Commit 3175ea90 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[printer] also protect empty ghost blocks inside non-ghost environment

parent 63ad701a
No related branches found
No related tags found
No related merge requests found
......@@ -1215,6 +1215,8 @@ class cil_printer () = object (self)
gives us at least a correct, compilable, C code.
*)
| _::_::_,[],[],_ -> is_cfg_block ctxt
| [s],[],[], (Then_with_else | Other)
when (not is_ghost) && s.ghost -> true
| [ { skind = Block b } as s' ], [], [], Stmt_block s ->
(b.bscoping ||
(not (Cil.has_extern_local_init b) && self#stmt_has_annot s))
......@@ -1225,8 +1227,6 @@ class cil_printer () = object (self)
| [ { skind = Block b } ], [], [], _ -> self#require_braces ctxt b
| [ { skind = UnspecifiedSequence s } ], [], [], _ ->
self#require_braces ctxt (Cil.block_from_unspecified_sequence s)
| [s],[],[], (Then_with_else | Other)
when (not is_ghost) && s.ghost -> true
| [_],[],[], Then_with_else -> self#block_has_dangling_else blk
| [ _ ], [], [], _ -> false
| [],[],[],_ -> false)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment