Open jpwidera opened 3 years ago
WIth version 28.1 on Master branch following code will create wrong line counting:
#c enum myEnum { _A = 0, _B = 1, _C = 2 }; #endc {#enum myEnum {underscoreToCase} deriving( Show, Eq) #}
Will create following code snippet
... toEnum 2 = C toEnum unmatched = error ("myEnum.toEnum: Cannot match " ++ show unmatched) {-# LINE 8 "test.chs" #-} ...
This LINE 8 should be LINE 9. This can be simply verified by repeating this the first code block. Each time, c2hs looses one line, eg.:
LINE 8
LINE 9
#c enum myEnum { _A = 0, _B = 1, _C = 2 }; #endc {#enum myEnum {underscoreToCase} deriving( Show, Eq) #} #c enum myEnum2 { _A2 = 0, _B2 = 1, _C2 = 2 }; #endc {#enum myEnum2 {underscoreToCase} deriving( Show, Eq) #}
This leads to wrong line numbering in error/warnings.
Dumping the c2hs process gives following code for the pseudo-block of c:
#ce #endc #cn #endc #cu #endc #cm #endc #c #endc #cm #endc #cy #endc #cE #endc #cn #endc #cu #endc #cm #endc #c #endc #c{ #endc #c #endc #c #endc #c #endc #c_ #endc #cA #endc #c #endc #c= #endc #c #endc #c0 #endc #c, #endc #c ... #endc #c} #endc #c; #endc #c #endc #c #endc{#enum myEnum {underscoreToCase} deriving (Show, Eq) #}
I'm not sure, if this is how it should look like. Any suggestions?
WIth version 28.1 on Master branch following code will create wrong line counting:
Will create following code snippet
This
LINE 8
should beLINE 9
. This can be simply verified by repeating this the first code block. Each time, c2hs looses one line, eg.:This leads to wrong line numbering in error/warnings.
Dumping the c2hs process gives following code for the pseudo-block of c:
I'm not sure, if this is how it should look like. Any suggestions?