2 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
3 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
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.TopInit init
-> ()
46 | A.FunHeader
(bef
,allminus
, fninfo
, ida
, _
, paramsa
, _
) -> ()
47 | A.Decl
(bef
,allminus
,decla
) -> ()
50 | A.ExprStatement
(ea
, _
) -> ()
51 | A.IfHeader
(_
,_
, ea
, _
) -> ()
53 | A.WhileHeader
(_
, _
, ea
, _
) -> ()
55 | A.WhileTail
(_
,_
,ea
,_
,_
) -> ()
56 | A.ForHeader
(_
, _
, ea1opt
, _
, ea2opt
, _
, ea3opt
, _
) -> ()
57 | A.IteratorHeader
(ia1
, ia2
, ea
, ia3
) -> ()
58 | A.SwitchHeader _
-> ()
64 | A.ReturnExpr
(_
, ea
, _
) -> ()
65 | A.DefineHeader _
-> ()
69 | A.DisjRuleElem _
-> failwith
"not possible - compiled away in asttoctl"
71 let dumb_astcocci_decl = function
72 | A.UnInit
(stg
, typa
, sa
, _
) -> ()
73 | A.Init
(stg
, typa
, sa
, _
, expa
, _
) -> ()
74 | A.TyDecl
(typa
, _
) -> ()
75 | A.MacroDecl
(fn
, _
, eas
, _
, _
) -> ()
76 | A.Ddots
(dots
,whencode
) -> ()
78 | A.Typedef
(d
,ty1
,ty2
,pv
) -> ()
80 | A.OptDecl _
| A.UniqueDecl _
-> ()
82 let dumb_astcocci_initialiser = function
83 A.Init
(stg
,ty
,id
,eq
,ini
,sem
) -> ()
84 | A.UnInit
(stg
,ty
,id
,sem
) -> ()
85 | A.MacroDecl
(fn
, _
, eas
, _
, _
) -> ()
86 | A.TyDecl
(ty
,sem
) -> ()
87 | A.Typedef
(d
,ty1
,ty2
,pv
) -> ()
88 | A.DisjDecl
(decls
) -> ()
89 | A.Ddots
(dots
,whencode
) -> ()
90 | A.MetaDecl
(name
,_
,_
) -> ()
91 | A.OptDecl
(decl
) -> ()
92 | A.UniqueDecl
(decl
) -> ()
94 let dumb_astcocci_expr = function
95 | A.MetaExpr
(ida
,_
,_
, opttypa
, _
, _
) -> ()
99 | A.Constant
(A.String sa
,_
,_
,_
) -> ()
100 | A.Constant
(A.Char sa
,_
,_
,_
) -> ()
101 | A.Constant
(A.Int sa
,_
,_
,_
) -> ()
102 | A.Constant
(A.Float sa
,_
,_
,_
) -> ()
103 | A.FunCall
(ea1
, _
, eas
, _
) -> ()
104 | A.Assignment
(ea1
, opa
, ea2
, _
) -> ()
105 | A.CondExpr
(ea1
,_
,ea2opt
,_
,ea3
) -> ()
106 | A.Postfix
(ea
, opa
) -> ()
107 | A.Infix
(ea
, opa
) -> ()
108 | A.Unary
(ea
, opa
) -> ()
109 | A.Binary
(ea1
, opa
, ea2
) -> ()
110 | A.Nested
(ea1
, opa
, ea2
) -> ()
111 | A.ArrayAccess
(ea1
, _
, ea2
, _
) -> ()
112 | A.RecordAccess
(ea
, _
, ida
) -> ()
113 | A.RecordPtAccess
(ea
, _
, ida
) -> ()
114 | A.Cast
(_
, typa
, _
, ea
) -> ()
115 | A.SizeOfExpr
(_
, ea
) -> ()
116 | A.SizeOfType
(_
, _
, typa
, _
) -> ()
117 | A.TypeExp
(typa
) -> ()
118 | A.Paren
(_
, ea
, _
) -> ()
120 | A.MetaExprList _
-> ()
124 | A.DisjExpr eas
-> ()
125 | A.UniqueExp _
-> ()
128 let dumb_astcocci_fulltype = function
130 | A.DisjType
(types
) -> ()
131 | A.OptType
(ty
) -> ()
132 | A.UniqueType
(ty
) -> ()
134 let dumb_astcocci_type = function
135 | A.MetaType
(ida
,_
,_
) -> ()
136 | A.BaseType
(basea
,strings
) -> ()
137 | A.SignedT
(signa
,tya
) -> ()
138 | A.Pointer
(typa
, _
) -> ()
139 | A.FunctionPointer
(ty
,lp1
,star
,rp1
,lp2
,params
,rp2
) -> ()
140 | A.FunctionType _
-> ()
141 | A.Array
(typa
, _
, eaopt
, _
) -> ()
142 | A.EnumName
(en
, ena
) -> ()
143 | A.StructUnionName
(sa
, sua
) -> ()
144 | A.StructUnionDef
(ty
, lb
, decls
, rb
) -> ()
145 | A.TypeName sa
-> ()
148 (* ------------------------------------------------------------------------- *)
151 | (Ident (_) | Constant _ | FunCall (_,_) | CondExpr (_,_,_)
154 | Postfix (_,_) | Infix (_,_) | Unary (_,_) | Binary (_,_,_)
155 | ArrayAccess (_,_) | RecordAccess (_,_) | RecordPtAccess (_,_)
156 | SizeOfExpr (_) | SizeOfType (_) | Cast (_,_)
157 | StatementExpr (_) | Constructor
158 | ParenExpr (_) | MacroCall (_) | MacroCall2 (_)
161 | ( Labeled (Label (_,_)) | Labeled (Case (_,_))
162 | Labeled (CaseRange (_,_,_)) | Labeled (Default _)
163 | Compound _ | ExprStatement _
164 | Selection (If (_, _, _)) | Selection (Switch (_, _))
165 | Iteration (While (_, _)) | Iteration (DoWhile (_, _))
166 | Iteration (For ((_,_), (_,_), (_, _), _))
167 | Jump (Goto _) | Jump ((Continue|Break|Return)) | Jump (ReturnExpr _)
168 | Decl _ | Asm | Selection (IfCpp (_,_))
172 (* for control flow nodes
174 | ( F.ExprStatement (_, _)
175 | F.IfHeader (_, _) | F.SwitchHeader (_, _)
176 | F.WhileHeader (_, _) | (* F.DoHeader (_, _) | *) F.DoWhileTail
(_
, _
)
178 | F.Return
(_
, _
) | F.ReturnExpr
(_
, _
)
179 (* no counter part in cocci *)
181 | F.Case
(_
,_
) | (* F.CaseRange (_, _) | *) F.Default
(_
, _
)
182 | F.Goto
(_
, _
) | F.Continue
(_
, _
) | F.Break
(_
, _
)
183 ) -> raise Impossible