(*
VarOrFunc("malloc",
- (Lib.al_type(Parse_c.type_of_string "void* (*)(int size)"),
+ (Lib.al_type(Parse_c.type_of_string "void* ( * )(int size)"),
Ast_c.NotLocalVar));
VarOrFunc("free",
- (Lib.al_type(Parse_c.type_of_string "void (*)(void *ptr)"),
+ (Lib.al_type(Parse_c.type_of_string "void ( * )(void *ptr)"),
Ast_c.NotLocalVar));
*)
]
(* fields *)
| RecordAccess (e, namefld)
| RecordPtAccess (e, namefld) as x ->
-
let fld = Ast_c.str_of_name namefld in
k expr; (* recurse to set the types-ref of sub expressions *)
| Pointer (t) -> Some t
| _ -> None
)
- | _ -> raise Impossible
+ | _ -> raise (Impossible 159)
in
(match topt with
| _ -> k expr; Type_c.noTypeHere
*)
- | New ty ->
+ | New (_, ty) ->
k expr;
pr2_once "Type annotater:not handling New";
Type_c.noTypeHere (* TODO *)
match (sto,local) with
| (_,Ast_c.NotLocalDecl) -> Ast_c.NotLocalVar
| ((Ast_c.Sto Ast_c.Static, _), Ast_c.LocalDecl) ->
- Ast_c.StaticLocalVar (Ast_c.info_of_type t)
- | (_,Ast_c.LocalDecl) -> Ast_c.LocalVar (Ast_c.info_of_type t)
+ (match Ast_c.info_of_type t with
+ (* if there is no info about the type it must not be
+ present, so we don't know what the variable is *)
+ None -> Ast_c.NotLocalVar
+ | Some ii -> Ast_c.StaticLocalVar ii)
+ | (_,Ast_c.LocalDecl) ->
+ (match Ast_c.info_of_type t with
+ (* if there is no info about the type it must not be
+ present, so we don't know what the variable is *)
+ None -> Ast_c.NotLocalVar
+ | Some ii -> Ast_c.LocalVar ii)
in
var +> Common.do_option (fun (name, iniopt) ->
let s = Ast_c.str_of_name name in
end
);
);
- | MacroDecl _ ->
+ | MacroDecl _ | MacroDeclInit _ ->
if need_annotate_body
then k d
);
*)
| iifunc1::iifunc2::ibrace1::ibrace2::ifakestart::isto ->
iifunc1, iifunc2
- | _ -> raise Impossible
+ | _ -> raise (Impossible 160)
in
let funcs = Ast_c.str_of_name name in
match nameopt with
| Some name ->
let s = Ast_c.str_of_name name in
- let local = Ast_c.LocalVar (Ast_c.info_of_type t) in
+ let local =
+ (match Ast_c.info_of_type t with
+ (* if there is no info about the type it must
+ not be present, so we don't know what the
+ variable is *)
+ None -> Ast_c.NotLocalVar
+ | Some ii -> Ast_c.LocalVar ii)
+ in
add_binding (VarOrFunc (s,(Lib.al_type t,local))) true
| None ->
pr2 "no type, certainly because Void type ?"
| EmptyDef _
| NotParsedCorrectly _
| FinalDef _
+ | Namespace _
->
k elem
);