> @disable optional_qualifier@
> identifier s;
> @@
> static const
> -char *
> +char * const
> s[] = ...;
>
> creates
>
> -static const char *ad1836_deemp[] = { ... };
> +static const char const *ad1836_deemp[] = { ... };
The patch below fixes the problem. Unfortunately the resulting code is
missing some whitespace that would be desirable. It may be possible to
improve that.
julia
diff --git a/parsing_cocci/visitor_ast0.ml b/parsing_cocci/visitor_ast0.ml
index c5d9125..49c065a 100644
--- a/parsing_cocci/visitor_ast0.ml
+++ b/parsing_cocci/visitor_ast0.ml
@@ -322,7 +322,12 @@ let visitor mode bind option_default
Ast0.ConstVol(cv,ty) ->
let (cv_n,cv) = cv_mcode cv in
let (ty_n,ty) = typeC ty in
- (bind cv_n ty_n, Ast0.ConstVol(cv,ty))
+ let front =
+ (* bind in the right order *)
+ match Ast0.unwrap ty with
+ Ast0.Pointer(ty,star) -> bind ty_n cv_n
+ | _ -> bind cv_n ty_n in
+ (front, Ast0.ConstVol(cv,ty))
| Ast0.BaseType(ty,strings) ->
let (strings_n,strings) = map_split_bind string_mcode strings in
(strings_n, Ast0.BaseType(ty,strings))
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)