All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@freedesktop.org>
To: Randy Dunlap <rdunlap@xenotime.net>
Cc: linux-sparse@vger.kernel.org
Subject: Re: barrier macro
Date: Tue, 01 May 2007 21:11:22 -0700	[thread overview]
Message-ID: <46380F6A.8020909@freedesktop.org> (raw)
In-Reply-To: <20070501210413.d544d9eb.rdunlap@xenotime.net>

[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

  reply	other threads:[~2007-05-02  4:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-01 22:34 barrier macro Randy Dunlap
2007-05-02  3:17 ` Josh Triplett
2007-05-02  4:04   ` Randy Dunlap
2007-05-02  4:11     ` Josh Triplett [this message]
2007-05-02  4:24   ` Josh Triplett
2007-05-02  4:35     ` Randy Dunlap
2007-05-02  5:37     ` Josh Triplett
2007-05-02  7:20       ` Christopher Li
2007-05-02 18:11         ` Josh Triplett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46380F6A.8020909@freedesktop.org \
    --to=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.