on 21/10/2010 16:23 Julia Lawall said the following:
> On Thu, 21 Oct 2010, Andriy Gapon wrote:
>> Example 2.
>> http://svn.freebsd.org/viewvc/base/head/sys/sys/pcpu.h?view=markup
>>
>> In this case it seems that the parser has trouble with macros that are 
>> defined in
>> the same file:
>> ERROR-RECOV: found sync end of #define, line 70
>> parsing pass2: try again
>> ERROR-RECOV: found sync end of #define, line 70
>> parse error
>>  = File "/usr/src/sys/sys/pcpu.h", line 71, column 0,  charpos = 2500
>>     around = '', whole content = #define        DPCPU_DEFINE(t, n)      t
>> DPCPU_NAME(n) __section("set_pcpu") __used
>> badcount: 1
>> bad: #define    DPCPU_NAME(n)           pcpu_entry_##n
>> BAD:!!!!! #define       DPCPU_DECLARE(t, n)     extern t DPCPU_NAME(n)
> 
> Unless you actually want to perform matches or transformations in these 
> macro definitions, I think you could ignore this.

About this example.
I actually use the same .cocci file on this .h file.
Thanks to your advice I now have this macros file:
#define LIST_HEAD(x,y) struct unknown
#define LIST_ENTRY(x) struct unknown
#define SLIST_ENTRY(x) struct unknown
#define PCPU_MD_FIELDS

Here's how I run spatch:
$ spatch -debug -macro_file cocci_macros.h -sp_file ~/tmp/cpumask_t.2.cocci
/usr/src/sys/sys/pcpu.h
init_defs_builtins: /usr/local/share/coccinelle/standard.h
init_defs: cocci_macros.h
-----------------------------------------------------------------------
processing semantic patch file: /home/avg/tmp/cpumask_t.2.cocci
with isos from: /usr/local/share/coccinelle/standard.iso
-----------------------------------------------------------------------
@r@
type S;
identifier x;
typedef cpumask_t;
@@
S { ...
* cpumask_t x;
  ...
  };

HANDLING: /usr/src/sys/sys/pcpu.h
-----------------------------------------------------------------------
let's go
-----------------------------------------------------------------------
parse error
 = error in /usr/src/sys/sys/pcpu.h; set verbose_parsing for more info
badcount: 1
bad: #define    DPCPU_NAME(n)           pcpu_entry_##n
BAD:!!!!! #define       DPCPU_DECLARE(t, n)     extern t DPCPU_NAME(n)
parse error
 = error in /usr/src/sys/sys/pcpu.h; set verbose_parsing for more info
badcount: 1
bad: #define    DPCPU_DECLARE(t, n)     extern t DPCPU_NAME(n)
BAD:!!!!! #define       DPCPU_DEFINE(t, n)      t DPCPU_NAME(n)
__section("set_pcpu") __used
-----------------------------------------------------------------------
r =
-----------------------------------------------------------------------
dependencies for rule r satisfied:
binding in = []
binding relevant in = []
     (ONCE) USING optional_qualifier builtin isomorphism
-----------------------------------------------------------------------
Finished
-----------------------------------------------------------------------
Check duplication for 1 files

So, no errors are reported within body of struct pcpu, but cpumask_t fields in 
it
are not detected either...
Perhaps something wrong with my cocci file?

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

Reply via email to