From 1c153479a1fdd95e8df55afa8f337a456ae4b538 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 23 Mar 2017 14:02:02 +0100 Subject: Added handling if s.sloc <> s1.sloc If the label is on a different line than the code we can still emit a line directive for the label. Bug 21232 --- cparser/Unblock.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cparser/Unblock.ml') diff --git a/cparser/Unblock.ml b/cparser/Unblock.ml index 0752d8ae..91e2ce20 100644 --- a/cparser/Unblock.ml +++ b/cparser/Unblock.ml @@ -292,8 +292,12 @@ let rec unblock_stmt env ctx ploc s = {s with sdesc = Sswitch(expand_expr true env e, unblock_stmt env ctx s.sloc s1)} | Slabeled(lbl, s1) -> - add_lineno ~label:true ctx ploc s.sloc - {s with sdesc = Slabeled(lbl, unblock_stmt env ctx ploc s1)} + let loc,label = if s.sloc <> s1.sloc then + s.sloc,false (* Label and code are on different lines *) + else + ploc,true in + add_lineno ~label:label ctx ploc s.sloc + {s with sdesc = Slabeled(lbl, unblock_stmt env ctx loc s1)} | Sgoto lbl -> add_lineno ctx ploc s.sloc s | Sreturn None -> -- cgit