aboutsummaryrefslogtreecommitdiffstats
path: root/backend/AisAnnot.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2018-03-13 15:34:01 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2018-03-13 15:34:01 +0100
commit3f83ae50789d44c49bec5db292d58db3f02d5f79 (patch)
tree03d5dc83333f8bbb432a00c189900356cc3f7466 /backend/AisAnnot.ml
parenta50902cad6765f80fc394d08054a8516febf7600 (diff)
downloadcompcert-kvx-3f83ae50789d44c49bec5db292d58db3f02d5f79.tar.gz
compcert-kvx-3f83ae50789d44c49bec5db292d58db3f02d5f79.zip
Add newline directly on list in annot.
This should avoid cluttering the assembler output with .ascii "\n" lines if the annotation ends with a string and make for a better readability. Bug 23169
Diffstat (limited to 'backend/AisAnnot.ml')
-rw-r--r--backend/AisAnnot.ml8
1 files changed, 6 insertions, 2 deletions
diff --git a/backend/AisAnnot.ml b/backend/AisAnnot.ml
index fc3c0305..bd768781 100644
--- a/backend/AisAnnot.ml
+++ b/backend/AisAnnot.ml
@@ -146,14 +146,18 @@ let ais_annot_txt warn lbl preg_string sp_reg_name txt args =
[]
in
let rec merge acc = function
- | [] -> List.rev acc
+ | [] -> acc
| (Label _ as lbl):: rest -> merge (lbl::acc) rest
| (Symbol _ as sym) :: rest -> merge (sym::acc) rest
| String s1 :: String s2 :: rest ->
merge acc (String (s1 ^ s2) :: rest)
| String s:: rest -> merge ((String s)::acc) rest
in
- merge [] annot
+ let rev_annot = match merge [] annot with
+ | [] -> []
+ | (String s)::rest -> (String (s^"\n"))::rest
+ | rest -> (String "\n")::rest in
+ List.rev rev_annot
let add_ais_annot lbl preg_string sp_reg_name txt args =
let annot = ais_annot_txt true lbl preg_string sp_reg_name txt args in