Another patch is below.  With this the code parses, and the transformation 
can be made.  However, it considers this to be a duplicate const 
annotation, so I'm not sure that the const is being associated in the 
right way by the parser.

julia

diff --git a/parsing_c/parsing_hacks.ml b/parsing_c/parsing_hacks.ml
index 4e8335e..2dd867e 100644
--- a/parsing_c/parsing_hacks.ml
+++ b/parsing_c/parsing_hacks.ml
@@ -1997,6 +1997,14 @@ let lookahead2 ~pass next before =
     when !Flag.c_plus_plus ->
          TCommentCpp (Token_c.CppDirective, i1)
 
+  (* const ident const: ident must be a type *)
+  | (TIdent (s, i1)::Tconst _::_,  Tconst _::_)
+      when not_struct_enum before
+      && ok_typedef s
+        ->
+      msg_typedef s i1 38; LP.add_typedef_root s;
+      TypedefIdent (s, i1)
+
        (* xx const tt *)
   | (TIdent (s, i1)::(Tconst _|Tvolatile _|Trestrict _)::type_::_  , _)
     when not_struct_enum before
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to