fix parsing error with multi-line conditional operators
[bpt/coccinelle.git] / parsing_c / type_c.ml
index 250b18e..3e4d927 100644 (file)
@@ -84,6 +84,7 @@ let mk_fulltype bt str =
     Ast_c.cocci_tag =
      {contents =
        Some (Ast_cocci.CONTEXT (Ast_cocci.NoPos, Ast_cocci.NOTHING), [])};
+    Ast_c.annots_tag = Token_annot.empty;
     Ast_c.comments_tag = {contents =
         {Ast_c.mbefore = []; Ast_c.mafter = [];
          Ast_c.mbefore2 = []; Ast_c.mafter2 = []
@@ -205,9 +206,9 @@ let structdef_to_struct_name ty =
           qu, Ast_c.mk_tybis (StructUnionName (su, s)) [i1;i2]
       | None, _ ->
           ty
-      | x -> raise Impossible
+      | x -> raise (Impossible 126)
       )
-  | _ -> raise Impossible
+  | _ -> raise (Impossible 127)
 
 
 (*****************************************************************************)
@@ -233,7 +234,7 @@ let type_of_decl decl =
   match decl with
   | Ast_c.DeclList (xs,ii1) ->
       (match xs with
-      | [] -> raise Impossible
+      | [] -> raise (Impossible 128)
 
       (* todo? for other xs ? *)
       | (x,ii2)::xs ->
@@ -243,7 +244,7 @@ let type_of_decl decl =
           (* TODO normalize ? what if nested structure definition ? *)
           v_type
       )
-  | Ast_c.MacroDecl _ ->
+  | Ast_c.MacroDecl _ | Ast_c.MacroDeclInit _ ->
       pr2_once "not handling MacroDecl type yet";
       raise Todo
 
@@ -255,7 +256,7 @@ let structdef_of_decl decl =
   match decl with
   | Ast_c.DeclList (xs,ii1) ->
       (match xs with
-      | [] -> raise Impossible
+      | [] -> raise (Impossible 129)
 
       (* todo? for other xs ? *)
       | (x,ii2)::xs ->
@@ -265,10 +266,10 @@ let structdef_of_decl decl =
           (match Ast_c.unwrap_typeC v_type with
           | Ast_c.StructUnion (su, _must_be_some, fields) ->
               (su, fields)
-          | _ -> raise Impossible
+          | _ -> raise (Impossible 130)
           )
       )
-  | Ast_c.MacroDecl _ -> raise Impossible
+  | Ast_c.MacroDecl _ | Ast_c.MacroDeclInit _ -> raise (Impossible 131)