let rec pp_ctype dim fmt = function
  | TInt(ikind,_) -> Format.fprintf fmt "%a" Cil.d_ikind ikind
  | TFloat(fkind,_) -> Format.fprintf fmt "%a" Cil.d_fkind fkind
  | TPtr(typ,_) -> Format.fprintf fmt "%a*" (pp_ctype dim) typ
  | TFun _ as t ->  Format.fprintf fmt "%a*" (pp_ctype dim) t
  | TEnum (e,_) -> Format.fprintf fmt "enum %s " e.ename
  | TComp (comp,_,_) ->
      Format.fprintf fmt
        "%s %s"
        (if comp.cstruct then "struct" else "union")
        comp.cname

  | TArray (typ_elt,_,_,_) as t ->
      pp_ctype false fmt typ_elt ;
      if dim then pp_dim fmt t;

  | TBuiltin_va_list _ -> pp_print_string fmt "builtin type"
  | TVoid _ -> pp_print_string fmt "void"
  | TNamed (t,_)  -> Format.fprintf fmt "%s" t.tname