Re: barrier macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Randy Dunlap wrote:
> On Tue, 01 May 2007 20:17:53 -0700 Josh Triplett wrote:
> 
>> Randy Dunlap wrote:
>>> (using sparse 0.3)
>>>
>>> ./compiler-gcc.h:10:#define barrier() __asm__ __volatile__("": : :"memory")
>>>
>>> causes this output:
>>>
>>> net/sunrpc/xprtsock.c:640:2: error: Expected ( after asm
>>> net/sunrpc/xprtsock.c:640:2: error: got __volatile__
>>> net/sunrpc/xprtsock.c:640:2: error: typename in expression
>>> net/sunrpc/xprtsock.c:640:2: error: Expected ) in function call
>>> net/sunrpc/xprtsock.c:640:2: error: got :
>>>
>>>
>>> Maybe sparse could allow modifiers between asm|__asm__ and the
>>> (...) ?
>> Sparse specifically allows volatile, and double-underscore variants, between the asm keyword and the open parenthesis:
>>
>> static struct token *parse_asm_statement(struct token *token, struct statement *stmt)
>> {
>>         token = token->next;
>>         stmt->type = STMT_ASM;
>>         if (match_idents(token, &__volatile___ident, &__volatile_ident, &volatile_ident, NULL)) {
>>                 token = token->next;
>>         }
>>         token = expect(token, '(', "after asm");
>> [...]
>>
>>
>> I cannot reproduce your report with the following test case (just added to git
>> as validation/asm-volatile.c):
> 
> I'm doing this on i386 (x86_32).  Maybe that would help you.

Same here.

> It's trivial to reproduce.

I've managed to reproduce it using a current Linux tree.  Let me look into it.

>> #define barrier() __asm__ __volatile__("": : :"memory")
>>
>> static void f(void)
>> {
>>         barrier();
>> }
>>
>>
>> Perhaps something else has caused the problem.  Could you please generate a
>> preprocessed file with "make net/sunrpc/xprtsock.i", and strip it down to a
>> minimal test case that still generates the Sparse warning?
> 
> Sure, I'll trim the 35000 lines down to a test case and get back
> to you.

Ouch.  Nevermind, now that I've reproduced it I'll take care of it.

- Josh Triplett

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux