2 * Copyright 2005-2008, Ecole des Mines de Nantes, University of Copenhagen
3 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
4 * This file is part of Coccinelle.
6 * Coccinelle is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, according to version 2 of the License.
10 * Coccinelle is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
18 * The authors reserve the right to distribute this or future versions of
19 * Coccinelle under other licenses.
24 (* Just to warn me when there is some news in the types in
25 * ast_cocci.ml or even ast_c.ml, so that I can then adjust my code in
26 * pattern.ml or transformation.ml.
28 * For the moment I do it only for myself (pad), that is I check only
29 * for news in ast_cocci.ml, because I already know when I add stuff in
30 * my code in ast_c.ml or control_flow_c.ml. *)
34 module F = Control_flow_c
36 (* dependencies_to_adjust: pattern.ml, transformaton.ml *)
38 let dumb_astcocci_rule_elem = function
39 | A.MetaRuleElem _ -> ()
40 | A.MetaStmt (ida,_,_,_) -> ()
41 | A.MetaStmtList _ -> ()
45 | A.FunHeader (bef,allminus, fninfo, ida, _, paramsa, _) -> ()
46 | A.Decl (bef,allminus,decla) -> ()
49 | A.ExprStatement (ea, _) -> ()
50 | A.IfHeader (_,_, ea, _) -> ()
52 | A.WhileHeader (_, _, ea, _) -> ()
54 | A.WhileTail (_,_,ea,_,_) -> ()
55 | A.ForHeader (_, _, ea1opt, _, ea2opt, _, ea3opt, _) -> ()
56 | A.IteratorHeader (ia1, ia2, ea, ia3) -> ()
57 | A.SwitchHeader _ -> ()
63 | A.ReturnExpr (_, ea, _) -> ()
64 | A.DefineHeader _ -> ()
68 | A.DisjRuleElem _ -> failwith "not possible - compiled away in asttoctl"
70 let dumb_astcocci_decl = function
71 | A.UnInit (stg, typa, sa, _) -> ()
72 | A.Init (stg, typa, sa, _, expa, _) -> ()
73 | A.TyDecl (typa, _) -> ()
74 | A.MacroDecl(fn, _, eas, _, _) -> ()
75 | A.Ddots(dots,whencode) -> ()
77 | A.Typedef(d,ty1,ty2,pv) -> ()
79 | A.OptDecl _ | A.UniqueDecl _ -> ()
81 let dumb_astcocci_initialiser = function
82 A.Init(stg,ty,id,eq,ini,sem) -> ()
83 | A.UnInit(stg,ty,id,sem) -> ()
84 | A.MacroDecl(fn, _, eas, _, _) -> ()
85 | A.TyDecl(ty,sem) -> ()
86 | A.Typedef(d,ty1,ty2,pv) -> ()
87 | A.DisjDecl(decls) -> ()
88 | A.Ddots(dots,whencode) -> ()
89 | A.MetaDecl(name,_,_) -> ()
90 | A.OptDecl(decl) -> ()
91 | A.UniqueDecl(decl) -> ()
93 let dumb_astcocci_expr = function
94 | A.MetaExpr (ida,_,_, opttypa, _, _) -> ()
98 | A.Constant (A.String sa,_,_,_) -> ()
99 | A.Constant (A.Char sa,_,_,_) -> ()
100 | A.Constant (A.Int sa,_,_,_) -> ()
101 | A.Constant (A.Float sa,_,_,_) -> ()
102 | A.FunCall (ea1, _, eas, _) -> ()
103 | A.Assignment (ea1, opa, ea2, _) -> ()
104 | A.CondExpr (ea1,_,ea2opt,_,ea3) -> ()
105 | A.Postfix (ea, opa) -> ()
106 | A.Infix (ea, opa) -> ()
107 | A.Unary (ea, opa) -> ()
108 | A.Binary (ea1, opa, ea2) -> ()
109 | A.Nested (ea1, opa, ea2) -> ()
110 | A.ArrayAccess (ea1, _, ea2, _) -> ()
111 | A.RecordAccess (ea, _, ida) -> ()
112 | A.RecordPtAccess (ea, _, ida) -> ()
113 | A.Cast (_, typa, _, ea) -> ()
114 | A.SizeOfExpr (_, ea) -> ()
115 | A.SizeOfType (_, _, typa, _) -> ()
116 | A.TypeExp (typa) -> ()
117 | A.Paren (_, ea, _) -> ()
119 | A.MetaExprList _ -> ()
123 | A.DisjExpr eas -> ()
124 | A.UniqueExp _ -> ()
127 let dumb_astcocci_fulltype = function
129 | A.DisjType(types) -> ()
130 | A.OptType(ty) -> ()
131 | A.UniqueType(ty) -> ()
133 let dumb_astcocci_type = function
134 | A.MetaType(ida,_,_) -> ()
135 | A.BaseType (basea, signaopt) -> ()
136 | A.ImplicitInt (signa) -> ()
137 | A.Pointer (typa, _) -> ()
138 | A.FunctionPointer(ty,lp1,star,rp1,lp2,params,rp2) -> ()
139 | A.FunctionType _ -> ()
140 | A.Array (typa, _, eaopt, _) -> ()
141 | A.StructUnionName(sa, sua) -> ()
142 | A.StructUnionDef(ty, lb, decls, rb) -> ()
143 | A.TypeName sa -> ()
146 (* ------------------------------------------------------------------------- *)
149 | (Ident (_) | Constant _ | FunCall (_,_) | CondExpr (_,_,_)
152 | Postfix (_,_) | Infix (_,_) | Unary (_,_) | Binary (_,_,_)
153 | ArrayAccess (_,_) | RecordAccess (_,_) | RecordPtAccess (_,_)
154 | SizeOfExpr (_) | SizeOfType (_) | Cast (_,_)
155 | StatementExpr (_) | Constructor
156 | ParenExpr (_) | MacroCall (_) | MacroCall2 (_)
159 | ( Labeled (Label (_,_)) | Labeled (Case (_,_))
160 | Labeled (CaseRange (_,_,_)) | Labeled (Default _)
161 | Compound _ | ExprStatement _
162 | Selection (If (_, _, _)) | Selection (Switch (_, _))
163 | Iteration (While (_, _)) | Iteration (DoWhile (_, _))
164 | Iteration (For ((_,_), (_,_), (_, _), _))
165 | Jump (Goto _) | Jump ((Continue|Break|Return)) | Jump (ReturnExpr _)
166 | Decl _ | Asm | Selection (IfCpp (_,_))
170 (* for control flow nodes
172 | ( F.ExprStatement (_, _)
173 | F.IfHeader (_, _) | F.SwitchHeader (_, _)
174 | F.WhileHeader (_, _) | (* F.DoHeader (_, _) | *) F.DoWhileTail (_, _)
176 | F.Return (_, _) | F.ReturnExpr (_, _)
177 (* no counter part in cocci *)
179 | F.Case (_,_) | (* F.CaseRange (_, _) | *) F.Default (_, _)
180 | F.Goto (_, _) | F.Continue (_, _) | F.Break (_, _)
181 ) -> raise Impossible