2 * Copyright 2010, INRIA, University of Copenhagen
3 * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
4 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
5 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
6 * This file is part of Coccinelle.
8 * Coccinelle is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, according to version 2 of the License.
12 * Coccinelle is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
20 * The authors reserve the right to distribute this or future versions of
21 * Coccinelle under other licenses.
26 (* Just to warn me when there is some news in the types in
27 * ast_cocci.ml or even ast_c.ml, so that I can then adjust my code in
28 * pattern.ml or transformation.ml.
30 * For the moment I do it only for myself (pad), that is I check only
31 * for news in ast_cocci.ml, because I already know when I add stuff in
32 * my code in ast_c.ml or control_flow_c.ml. *)
36 module F
= Control_flow_c
38 (* dependencies_to_adjust: pattern.ml, transformaton.ml *)
40 let dumb_astcocci_rule_elem = function
41 | A.MetaRuleElem _
-> ()
42 | A.MetaStmt
(ida
,_
,_
,_
) -> ()
43 | A.MetaStmtList _
-> ()
47 | A.TopInit init
-> ()
48 | A.FunHeader
(bef
,allminus
, fninfo
, ida
, _
, paramsa
, _
) -> ()
49 | A.Decl
(bef
,allminus
,decla
) -> ()
52 | A.ExprStatement
(ea
, _
) -> ()
53 | A.IfHeader
(_
,_
, ea
, _
) -> ()
55 | A.WhileHeader
(_
, _
, ea
, _
) -> ()
57 | A.WhileTail
(_
,_
,ea
,_
,_
) -> ()
58 | A.ForHeader
(_
, _
, ea1opt
, _
, ea2opt
, _
, ea3opt
, _
) -> ()
59 | A.IteratorHeader
(ia1
, ia2
, ea
, ia3
) -> ()
60 | A.SwitchHeader _
-> ()
66 | A.ReturnExpr
(_
, ea
, _
) -> ()
67 | A.DefineHeader _
-> ()
72 | A.DisjRuleElem _
-> failwith
"not possible - compiled away in asttoctl"
74 let dumb_astcocci_decl = function
75 | A.UnInit
(stg
, typa
, sa
, _
) -> ()
76 | A.Init
(stg
, typa
, sa
, _
, expa
, _
) -> ()
77 | A.TyDecl
(typa
, _
) -> ()
78 | A.MacroDecl
(fn
, _
, eas
, _
, _
) -> ()
79 | A.Ddots
(dots
,whencode
) -> ()
82 | A.MetaFieldList _
-> ()
83 | A.Typedef
(d
,ty1
,ty2
,pv
) -> ()
85 | A.OptDecl _
| A.UniqueDecl _
-> ()
87 let dumb_astcocci_initialiser = function
88 A.Init
(stg
,ty
,id
,eq
,ini
,sem
) -> ()
89 | A.UnInit
(stg
,ty
,id
,sem
) -> ()
90 | A.MacroDecl
(fn
, _
, eas
, _
, _
) -> ()
91 | A.TyDecl
(ty
,sem
) -> ()
92 | A.Typedef
(d
,ty1
,ty2
,pv
) -> ()
93 | A.DisjDecl
(decls
) -> ()
94 | A.Ddots
(dots
,whencode
) -> ()
95 | A.MetaDecl
(name
,_
,_
) -> ()
96 | A.MetaField
(name
,_
,_
) -> ()
97 | A.MetaFieldList
(name
,_
,_
,_
) -> ()
98 | A.OptDecl
(decl
) -> ()
99 | A.UniqueDecl
(decl
) -> ()
101 let dumb_astcocci_expr = function
102 | A.MetaExpr
(ida
,_
,_
, opttypa
, _
, _
) -> ()
103 | A.Edots
(_
,_
) -> ()
106 | A.Constant
(A.String sa
,_
,_
,_
) -> ()
107 | A.Constant
(A.Char sa
,_
,_
,_
) -> ()
108 | A.Constant
(A.Int sa
,_
,_
,_
) -> ()
109 | A.Constant
(A.Float sa
,_
,_
,_
) -> ()
110 | A.FunCall
(ea1
, _
, eas
, _
) -> ()
111 | A.Assignment
(ea1
, opa
, ea2
, _
) -> ()
112 | A.CondExpr
(ea1
,_
,ea2opt
,_
,ea3
) -> ()
113 | A.Postfix
(ea
, opa
) -> ()
114 | A.Infix
(ea
, opa
) -> ()
115 | A.Unary
(ea
, opa
) -> ()
116 | A.Binary
(ea1
, opa
, ea2
) -> ()
117 | A.Nested
(ea1
, opa
, ea2
) -> ()
118 | A.ArrayAccess
(ea1
, _
, ea2
, _
) -> ()
119 | A.RecordAccess
(ea
, _
, ida
) -> ()
120 | A.RecordPtAccess
(ea
, _
, ida
) -> ()
121 | A.Cast
(_
, typa
, _
, ea
) -> ()
122 | A.SizeOfExpr
(_
, ea
) -> ()
123 | A.SizeOfType
(_
, _
, typa
, _
) -> ()
124 | A.TypeExp
(typa
) -> ()
125 | A.Constructor
(_
, typa
, _
, ia
) -> ()
126 | A.Paren
(_
, ea
, _
) -> ()
128 | A.MetaExprList _
-> ()
132 | A.DisjExpr eas
-> ()
133 | A.UniqueExp _
-> ()
136 let dumb_astcocci_fulltype = function
138 | A.DisjType
(types
) -> ()
139 | A.OptType
(ty
) -> ()
140 | A.UniqueType
(ty
) -> ()
142 let dumb_astcocci_type = function
143 | A.MetaType
(ida
,_
,_
) -> ()
144 | A.BaseType
(basea
,strings
) -> ()
145 | A.SignedT
(signa
,tya
) -> ()
146 | A.Pointer
(typa
, _
) -> ()
147 | A.FunctionPointer
(ty
,lp1
,star
,rp1
,lp2
,params
,rp2
) -> ()
148 | A.FunctionType _
-> ()
149 | A.Array
(typa
, _
, eaopt
, _
) -> ()
150 | A.EnumName
(en
, ena
) -> ()
151 | A.EnumDef
(ty
, lb
, ids
, rb
) -> ()
152 | A.StructUnionName
(sa
, sua
) -> ()
153 | A.StructUnionDef
(ty
, lb
, decls
, rb
) -> ()
154 | A.TypeName sa
-> ()
157 (* ------------------------------------------------------------------------- *)
160 | (Ident (_) | Constant _ | FunCall (_,_) | CondExpr (_,_,_)
163 | Postfix (_,_) | Infix (_,_) | Unary (_,_) | Binary (_,_,_)
164 | ArrayAccess (_,_) | RecordAccess (_,_) | RecordPtAccess (_,_)
165 | SizeOfExpr (_) | SizeOfType (_) | Cast (_,_)
166 | StatementExpr (_) | Constructor
167 | ParenExpr (_) | MacroCall (_) | MacroCall2 (_)
170 | ( Labeled (Label (_,_)) | Labeled (Case (_,_))
171 | Labeled (CaseRange (_,_,_)) | Labeled (Default _)
172 | Compound _ | ExprStatement _
173 | Selection (If (_, _, _)) | Selection (Switch (_, _))
174 | Iteration (While (_, _)) | Iteration (DoWhile (_, _))
175 | Iteration (For ((_,_), (_,_), (_, _), _))
176 | Jump (Goto _) | Jump ((Continue|Break|Return)) | Jump (ReturnExpr _)
177 | Decl _ | Asm | Selection (IfCpp (_,_))
181 (* for control flow nodes
183 | ( F.ExprStatement (_, _)
184 | F.IfHeader (_, _) | F.SwitchHeader (_, _)
185 | F.WhileHeader (_, _) | (* F.DoHeader (_, _) | *) F.DoWhileTail
(_
, _
)
187 | F.Return
(_
, _
) | F.ReturnExpr
(_
, _
)
188 (* no counter part in cocci *)
190 | F.Case
(_
,_
) | (* F.CaseRange (_, _) | *) F.Default
(_
, _
)
191 | F.Goto
(_
, _
) | F.Continue
(_
, _
) | F.Break
(_
, _
)
192 ) -> raise Impossible