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