Project

General

Profile

Revision 14c56a07 src/backends/C/c_backend_header.ml

View differences:

src/backends/C/c_backend_header.ml
43 43
  | Fun (n, vl)   -> Basic_library.pp_c n (print_static_val pp_var) fmt vl
44 44
  | _             -> (Format.eprintf "Internal error: C_backend_header.print_static_val"; assert false)
45 45

  
46
let print_constant m pp_var fmt v =
47
  Format.fprintf fmt "inst ## %s = %a"
48
    v.var_id
46
let print_constant_decl (m, attr, inst) pp_var fmt v =
47
  Format.fprintf fmt "%s %a = %a"
48
    attr
49
    (pp_c_type (Format.sprintf "%s ## %s" inst v.var_id)) v.var_type
49 50
    (print_static_val pp_var) (Machine_code.get_const_assign m v)
50 51

  
51
let print_static_constant (m, attr, inst) fmt const_locals =
52
let print_static_constant_decl (m, attr, inst) fmt const_locals =
52 53
  let pp_var fmt v =
53 54
    if List.mem v const_locals
54 55
    then
......
56 57
    else 
57 58
      Format.fprintf fmt "%s" v.var_id in
58 59
  Format.fprintf fmt "%a%t"
59
    (Utils.fprintf_list ~sep:";\\@," (print_constant m pp_var)) const_locals
60
    (Utils.fprintf_list ~sep:";\\@," (print_constant_decl (m, attr, inst) pp_var)) const_locals
60 61
    (Utils.pp_final_char_if_non_empty ";\\@," const_locals)
61 62

  
62 63
let print_static_declare_instance (m, attr, inst) const_locals fmt (i, (n, static)) =
......
84 85
    (Utils.pp_final_char_if_non_empty ", " m.mstatic)
85 86
    inst
86 87
    (* constants *)
87
    (print_static_constant (m, attr, inst)) const_locals
88
    (print_static_constant_decl (m, attr, inst)) const_locals
88 89
    attr
89 90
    pp_machine_memtype_name m.mname.node_id
90 91
    inst

Also available in: Unified diff