Commit | Line | Data |
---|---|---|
34e49164 C |
1 | |
2 | (* Just to warn me when there is some news in the types in | |
3 | * ast_cocci.ml or even ast_c.ml, so that I can then adjust my code in | |
4 | * pattern.ml or transformation.ml. | |
5 | * | |
6 | * For the moment I do it only for myself (pad), that is I check only | |
7 | * for news in ast_cocci.ml, because I already know when I add stuff in | |
8 | * my code in ast_c.ml or control_flow_c.ml. *) | |
9 | ||
10 | module A = Ast_cocci | |
11 | module B = Ast_c | |
12 | module F = Control_flow_c | |
13 | ||
14 | (* dependencies_to_adjust: pattern.ml, transformaton.ml *) | |
15 | ||
16 | let dumb_astcocci_rule_elem = function | |
17 | | A.MetaRuleElem _ -> () | |
18 | | A.MetaStmt (ida,_,_,_) -> () | |
19 | | A.MetaStmtList _ -> () | |
20 | | A.Exp expr -> () | |
21 | | A.TopExp expr -> () | |
22 | | A.Ty ty -> () | |
1be43e12 | 23 | | A.TopInit init -> () |
34e49164 C |
24 | | A.FunHeader (bef,allminus, fninfo, ida, _, paramsa, _) -> () |
25 | | A.Decl (bef,allminus,decla) -> () | |
26 | | A.SeqStart _ -> () | |
27 | | A.SeqEnd _ -> () | |
28 | | A.ExprStatement (ea, _) -> () | |
29 | | A.IfHeader (_,_, ea, _) -> () | |
30 | | A.Else _ -> () | |
31 | | A.WhileHeader (_, _, ea, _) -> () | |
32 | | A.DoHeader _ -> () | |
33 | | A.WhileTail (_,_,ea,_,_) -> () | |
34 | | A.ForHeader (_, _, ea1opt, _, ea2opt, _, ea3opt, _) -> () | |
35 | | A.IteratorHeader (ia1, ia2, ea, ia3) -> () | |
36 | | A.SwitchHeader _ -> () | |
37 | | A.Break _ -> () | |
38 | | A.Continue _ -> () | |
39 | | A.Label _ -> () | |
40 | | A.Goto(_,_,_) -> () | |
41 | | A.Return _ -> () | |
42 | | A.ReturnExpr (_, ea, _) -> () | |
43 | | A.DefineHeader _ -> () | |
44 | | A.Include _ -> () | |
45 | | A.Default _ -> () | |
46 | | A.Case _ -> () | |
47 | | A.DisjRuleElem _ -> failwith "not possible - compiled away in asttoctl" | |
48 | ||
49 | let dumb_astcocci_decl = function | |
50 | | A.UnInit (stg, typa, sa, _) -> () | |
51 | | A.Init (stg, typa, sa, _, expa, _) -> () | |
52 | | A.TyDecl (typa, _) -> () | |
53 | | A.MacroDecl(fn, _, eas, _, _) -> () | |
54 | | A.Ddots(dots,whencode) -> () | |
55 | | A.MetaDecl _ -> () | |
56 | | A.Typedef(d,ty1,ty2,pv) -> () | |
57 | | A.DisjDecl xs -> () | |
58 | | A.OptDecl _ | A.UniqueDecl _ -> () | |
59 | ||
60 | let dumb_astcocci_initialiser = function | |
61 | A.Init(stg,ty,id,eq,ini,sem) -> () | |
62 | | A.UnInit(stg,ty,id,sem) -> () | |
63 | | A.MacroDecl(fn, _, eas, _, _) -> () | |
64 | | A.TyDecl(ty,sem) -> () | |
65 | | A.Typedef(d,ty1,ty2,pv) -> () | |
66 | | A.DisjDecl(decls) -> () | |
67 | | A.Ddots(dots,whencode) -> () | |
68 | | A.MetaDecl(name,_,_) -> () | |
69 | | A.OptDecl(decl) -> () | |
70 | | A.UniqueDecl(decl) -> () | |
71 | ||
72 | let dumb_astcocci_expr = function | |
73 | | A.MetaExpr (ida,_,_, opttypa, _, _) -> () | |
74 | | A.Edots (_,_) -> () | |
75 | | A.MetaErr _ -> () | |
76 | | A.Ident ida -> () | |
77 | | A.Constant (A.String sa,_,_,_) -> () | |
78 | | A.Constant (A.Char sa,_,_,_) -> () | |
79 | | A.Constant (A.Int sa,_,_,_) -> () | |
80 | | A.Constant (A.Float sa,_,_,_) -> () | |
81 | | A.FunCall (ea1, _, eas, _) -> () | |
82 | | A.Assignment (ea1, opa, ea2, _) -> () | |
83 | | A.CondExpr (ea1,_,ea2opt,_,ea3) -> () | |
84 | | A.Postfix (ea, opa) -> () | |
85 | | A.Infix (ea, opa) -> () | |
86 | | A.Unary (ea, opa) -> () | |
87 | | A.Binary (ea1, opa, ea2) -> () | |
88 | | A.Nested (ea1, opa, ea2) -> () | |
89 | | A.ArrayAccess (ea1, _, ea2, _) -> () | |
90 | | A.RecordAccess (ea, _, ida) -> () | |
91 | | A.RecordPtAccess (ea, _, ida) -> () | |
92 | | A.Cast (_, typa, _, ea) -> () | |
93 | | A.SizeOfExpr (_, ea) -> () | |
94 | | A.SizeOfType (_, _, typa, _) -> () | |
95 | | A.TypeExp (typa) -> () | |
96 | | A.Paren (_, ea, _) -> () | |
97 | | A.NestExpr _ -> () | |
98 | | A.MetaExprList _ -> () | |
99 | | A.EComma _ -> () | |
100 | | A.Ecircles _ -> () | |
101 | | A.Estars _ -> () | |
102 | | A.DisjExpr eas -> () | |
103 | | A.UniqueExp _ -> () | |
104 | | A.OptExp _ -> () | |
105 | ||
106 | let dumb_astcocci_fulltype = function | |
107 | A.Type(cv,ty) -> () | |
108 | | A.DisjType(types) -> () | |
109 | | A.OptType(ty) -> () | |
110 | | A.UniqueType(ty) -> () | |
111 | ||
112 | let dumb_astcocci_type = function | |
113 | | A.MetaType(ida,_,_) -> () | |
faf9a90c C |
114 | | A.BaseType (basea,strings) -> () |
115 | | A.SignedT (signa,tya) -> () | |
34e49164 C |
116 | | A.Pointer (typa, _) -> () |
117 | | A.FunctionPointer(ty,lp1,star,rp1,lp2,params,rp2) -> () | |
118 | | A.FunctionType _ -> () | |
119 | | A.Array (typa, _, eaopt, _) -> () | |
faf9a90c | 120 | | A.EnumName(en, ena) -> () |
34e49164 C |
121 | | A.StructUnionName(sa, sua) -> () |
122 | | A.StructUnionDef(ty, lb, decls, rb) -> () | |
123 | | A.TypeName sa -> () | |
124 | ||
125 | ||
126 | (* ------------------------------------------------------------------------- *) | |
127 | (* for C *) | |
128 | (* | |
129 | | (Ident (_) | Constant _ | FunCall (_,_) | CondExpr (_,_,_) | |
130 | | Sequence (_,_) | |
131 | | Assignment (_,_,_) | |
132 | | Postfix (_,_) | Infix (_,_) | Unary (_,_) | Binary (_,_,_) | |
133 | | ArrayAccess (_,_) | RecordAccess (_,_) | RecordPtAccess (_,_) | |
134 | | SizeOfExpr (_) | SizeOfType (_) | Cast (_,_) | |
135 | | StatementExpr (_) | Constructor | |
136 | | ParenExpr (_) | MacroCall (_) | MacroCall2 (_) | |
137 | ),_ -> | |
138 | ||
139 | | ( Labeled (Label (_,_)) | Labeled (Case (_,_)) | |
140 | | Labeled (CaseRange (_,_,_)) | Labeled (Default _) | |
141 | | Compound _ | ExprStatement _ | |
142 | | Selection (If (_, _, _)) | Selection (Switch (_, _)) | |
143 | | Iteration (While (_, _)) | Iteration (DoWhile (_, _)) | |
144 | | Iteration (For ((_,_), (_,_), (_, _), _)) | |
145 | | Jump (Goto _) | Jump ((Continue|Break|Return)) | Jump (ReturnExpr _) | |
146 | | Decl _ | Asm | Selection (IfCpp (_,_)) | |
147 | ), _ -> | |
148 | *) | |
149 | ||
150 | (* for control flow nodes | |
151 | ||
152 | | ( F.ExprStatement (_, _) | |
153 | | F.IfHeader (_, _) | F.SwitchHeader (_, _) | |
154 | | F.WhileHeader (_, _) | (* F.DoHeader (_, _) | *) F.DoWhileTail (_, _) | |
155 | | F.ForHeader (_, _) | |
156 | | F.Return (_, _) | F.ReturnExpr (_, _) | |
157 | (* no counter part in cocci *) | |
158 | | F.Label (_, _) | |
159 | | F.Case (_,_) | (* F.CaseRange (_, _) | *) F.Default (_, _) | |
160 | | F.Goto (_, _) | F.Continue (_, _) | F.Break (_, _) | |
161 | ) -> raise Impossible | |
162 | ||
163 | *) |