On 08/02/2012 03:25 PM, Julia Lawall wrote:
>> I wanted to write a small cocci patch to transform
>> static const char *str = "...";
>> into
>> static const char * const str = "...";
>>
>> I used the following semantic patch:
>>
>> @@
>> identifier str;
>> expression E;
>> @@
>> -static const char *str
>> +static const char * const str
>>     = E;
> 
> The patch below now supports this.
> 

Hi,

For the following code

static const char *ad1836_deemp[] = { ... };

this

@disable optional_qualifier@
identifier s;
@@
 static
-const char *
+const char * const
 s[] = ...;

creates the following patch

-static const char *ad1836_deemp[] = { ... };
+static const char * const ad1836_deemp[] = { ... };

Which is expected. But this

@disable optional_qualifier@
identifier s;
@@
 static const
-char *
+char * const
 s[] = ...;

creates

-static const char *ad1836_deemp[] = { ... };
+static const char const *ad1836_deemp[] = { ... };

Do you have an idea why?

Thanks,
- Lars
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to