coccinelle release 0.2.5
[bpt/coccinelle.git] / engine / check_exhaustive_pattern.ml
index 2914b42..d52ab04 100644 (file)
@@ -1,30 +1,32 @@
 (*
-* Copyright 2005-2008, Ecole des Mines de Nantes, University of Copenhagen
-* Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
-* This file is part of Coccinelle.
-* 
-* Coccinelle is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, according to version 2 of the License.
-* 
-* Coccinelle is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-* 
-* You should have received a copy of the GNU General Public License
-* along with Coccinelle.  If not, see <http://www.gnu.org/licenses/>.
-* 
-* The authors reserve the right to distribute this or future versions of
-* Coccinelle under other licenses.
-*)
+ * Copyright 2010, INRIA, University of Copenhagen
+ * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
+ * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
+ * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
+ * This file is part of Coccinelle.
+ *
+ * Coccinelle is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, according to version 2 of the License.
+ *
+ * Coccinelle is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Coccinelle.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * The authors reserve the right to distribute this or future versions of
+ * Coccinelle under other licenses.
+ *)
 
 
 
 (* Just to warn me when there is some news in the types in
  * ast_cocci.ml or even ast_c.ml, so that I can then adjust my code in
  * pattern.ml or transformation.ml.
- * 
+ *
  * For the moment I do it only for myself (pad), that is I check only
  * for news in ast_cocci.ml, because I already know when I add stuff in
  * my code in ast_c.ml or control_flow_c.ml. *)
@@ -63,6 +65,7 @@ let dumb_astcocci_rule_elem = function
  | A.Return _ -> ()
  | A.ReturnExpr (_, ea, _) -> ()
  | A.DefineHeader _ -> ()
+ | A.Undef _ -> ()
  | A.Include _ -> ()
  | A.Default _ -> ()
  | A.Case _ -> ()
@@ -75,6 +78,8 @@ let dumb_astcocci_decl = function
  | A.MacroDecl(fn, _, eas, _, _) -> ()
  | A.Ddots(dots,whencode) -> ()
  | A.MetaDecl _ -> ()
+ | A.MetaField _ -> ()
+ | A.MetaFieldList _ -> ()
  | A.Typedef(d,ty1,ty2,pv) -> ()
  | A.DisjDecl xs -> ()
  | A.OptDecl _ | A.UniqueDecl _ -> ()
@@ -88,6 +93,8 @@ let dumb_astcocci_initialiser = function
   | A.DisjDecl(decls) -> ()
   | A.Ddots(dots,whencode) -> ()
   | A.MetaDecl(name,_,_) -> ()
+  | A.MetaField(name,_,_) -> ()
+  | A.MetaFieldList(name,_,_,_) -> ()
   | A.OptDecl(decl) -> ()
   | A.UniqueDecl(decl) -> ()
 
@@ -133,12 +140,14 @@ let dumb_astcocci_fulltype = function
 
 let dumb_astcocci_type = function
  | A.MetaType(ida,_,_) -> ()
- | A.BaseType (basea, signaopt) -> ()
- | A.ImplicitInt (signa) -> ()
+ | A.BaseType (basea,strings) -> ()
+ | A.SignedT (signa,tya) -> ()
  | A.Pointer (typa, _) -> ()
  | A.FunctionPointer(ty,lp1,star,rp1,lp2,params,rp2) -> ()
  | A.FunctionType _ -> ()
  | A.Array (typa, _, eaopt, _) -> ()
+ | A.EnumName(en, ena) -> ()
+ | A.EnumDef(ty, lb, ids, rb) -> ()
  | A.StructUnionName(sa, sua) -> ()
  | A.StructUnionDef(ty, lb, decls, rb) -> ()
  | A.TypeName sa -> ()
@@ -147,36 +156,36 @@ let dumb_astcocci_type = function
 (* ------------------------------------------------------------------------- *)
 (* for C *)
 (*
-  | (Ident (_) | Constant _ | FunCall (_,_) | CondExpr (_,_,_) 
+  | (Ident (_) | Constant _ | FunCall (_,_) | CondExpr (_,_,_)
     | Sequence (_,_)
-    | Assignment (_,_,_) 
+    | Assignment (_,_,_)
     | Postfix (_,_) | Infix (_,_) | Unary (_,_) | Binary (_,_,_)
     | ArrayAccess (_,_) | RecordAccess (_,_) | RecordPtAccess (_,_)
-    | SizeOfExpr (_) | SizeOfType (_) | Cast (_,_) 
-    | StatementExpr (_) | Constructor 
+    | SizeOfExpr (_) | SizeOfType (_) | Cast (_,_)
+    | StatementExpr (_) | Constructor
     | ParenExpr (_) | MacroCall (_) | MacroCall2 (_)
-    ),_ -> 
+    ),_ ->
 
-  | ( Labeled (Label (_,_)) | Labeled (Case  (_,_)) 
+  | ( Labeled (Label (_,_)) | Labeled (Case  (_,_))
     | Labeled (CaseRange  (_,_,_)) | Labeled (Default _)
-    | Compound _ | ExprStatement _ 
+    | Compound _ | ExprStatement _
     | Selection  (If (_, _, _)) | Selection  (Switch (_, _))
-    | Iteration  (While (_, _)) | Iteration  (DoWhile (_, _)) 
+    | Iteration  (While (_, _)) | Iteration  (DoWhile (_, _))
     | Iteration  (For ((_,_), (_,_), (_, _), _))
     | Jump (Goto _) | Jump ((Continue|Break|Return)) | Jump (ReturnExpr _)
     | Decl _ | Asm | Selection (IfCpp (_,_))
-    ), _ -> 
+    ), _ ->
 *)
 
-(* for control flow nodes 
+(* for control flow nodes
 
-  | ( F.ExprStatement (_, _) 
+  | ( F.ExprStatement (_, _)
     | F.IfHeader  (_, _) | F.SwitchHeader (_, _)
-    | F.WhileHeader (_, _) | (* F.DoHeader (_, _) | *) F.DoWhileTail (_, _) 
+    | F.WhileHeader (_, _) | (* F.DoHeader (_, _) | *) F.DoWhileTail (_, _)
     | F.ForHeader (_, _)
     | F.Return     (_, _)  | F.ReturnExpr (_, _)
         (* no counter part in cocci *)
-    | F.Label (_, _) 
+    | F.Label (_, _)
     | F.Case  (_,_) | (* F.CaseRange (_, _) | *) F.Default   (_, _)
     | F.Goto (_, _) | F.Continue (_, _) | F.Break    (_, _)
     ) -> raise Impossible