diff options
author | Bernhard Schommer <bschommer@users.noreply.github.com> | 2016-09-20 16:17:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-20 16:17:27 +0200 |
commit | d857db508c318887463dde2039c9bfe99cdeebfa (patch) | |
tree | 8cf1d98876f4c72e624892103917be5286c95c17 /cparser/Cprint.ml | |
parent | 99554c986d023d00192eb3d1fbfe1c0cc138596e (diff) | |
parent | 20f226ce463221032238895264c73d2207bf31d8 (diff) | |
download | compcert-d857db508c318887463dde2039c9bfe99cdeebfa.tar.gz compcert-d857db508c318887463dde2039c9bfe99cdeebfa.zip |
Merge pull request #139 from AbsInt/advanced-diagnostics
Advanced diagnostics
Diffstat (limited to 'cparser/Cprint.ml')
-rw-r--r-- | cparser/Cprint.ml | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cparser/Cprint.ml b/cparser/Cprint.ml index e80a4c8e..2a110104 100644 --- a/cparser/Cprint.ml +++ b/cparser/Cprint.ml @@ -126,7 +126,7 @@ let name_of_fkind = function | FDouble -> "double" | FLongDouble -> "long double" -let rec dcl pp ty n = +let rec dcl ?(pp_indication=true) pp ty n = match ty with | TVoid a -> fprintf pp "void%a%t" attributes a n @@ -160,7 +160,8 @@ let rec dcl pp ty n = | [] -> n pp | _ -> fprintf pp " (%a%t)" attributes a n end; - fprintf pp "(@[<hov 0>"; + fprintf pp "("; + if pp_indication then fprintf pp "@[<hov 0>"; begin match args with | None -> () | Some [] -> if vararg then fprintf pp "..." else fprintf pp "void" @@ -169,7 +170,8 @@ let rec dcl pp ty n = List.iter (fun a -> fprintf pp ",@ "; param a) al; if vararg then fprintf pp ",@ ..." end; - fprintf pp "@])" in + if pp_indication then fprintf pp "@]"; + fprintf pp ")" in dcl pp tres n' | TNamed(id, a) -> fprintf pp "%a%a%t" ident id attributes a n @@ -183,6 +185,9 @@ let rec dcl pp ty n = let typ pp ty = dcl pp ty (fun _ -> ()) +let typ_raw pp ty = + dcl ~pp_indication:false pp ty (fun _ -> ()) + type associativity = LtoR | RtoL | NA let precedence = function (* H&S section 7.2 *) |