linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens.net>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: linuxppc-dev@ozlabs.org, mikey@neuling.org, imunsie@au.ibm.com,
	Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH] cxl: Fix ambiguous else warnings
Date: Mon, 03 Aug 2015 10:36:47 +1000	[thread overview]
Message-ID: <1438562207.31010.14.camel@axtens.net> (raw)
In-Reply-To: <87wpxg3cvv.fsf@igel.home>

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

Hi Andreas,

On Fri, 2015-07-31 at 11:16 +0200, Andreas Schwab wrote:
> Daniel Axtens <dja@axtens.net> writes:
> 
> > Every time I build cxl I see the following warnings:
> >
> > /scratch/dja/linux-capi/drivers/misc/cxl/pci.c: In function ‘sanitise_afu_regs’:
> > /scratch/dja/linux-capi/drivers/misc/cxl/pci.c:712:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
> >    if (reg & CXL_PSL_DSISR_TRANS)
> >       ^
> > /scratch/dja/linux-capi/drivers/misc/cxl/irq.c: In function ‘fail_psl_irq’:
> > /scratch/dja/linux-capi/drivers/misc/cxl/irq.c:184:5: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
> >   if (irq_info->dsisr & CXL_PSL_DSISR_TRANS)
> >      ^
> 
> Why are they ambigous?  Why doesn't cxl_p2n_write(afu, CXL_PSL_TFC_An,
> CXL_PSL_TFC_An_AE) expand to a proper statement?
> 
> #define cxl_p2n_write(afu, reg, val) \
> 	out_be64(_cxl_p2n_addr(afu, reg), val)
> 

I realised that I started seeing this when I was working on my EEH
patches, which change the definition to:

#define cxl_p2n_write(afu, reg, val) \
	if (cxl_adapter_link_ok(afu->adapter)) \
		out_be64(_cxl_p2n_addr(afu, reg), val)


I'll redo the patch to change the write functions to wrap the if
statement so they cease to be ambiguous. I'll also spin a patch to
enable -Werror so I catch this earlier next time.

Thanks for the feedback, it was very helpful in me figuring out the root
cause.

-- 
Regards,
Daniel

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 860 bytes --]

  reply	other threads:[~2015-08-03  0:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1438324508-30341-1-git-send-email-dja__13473.5064967119$1438324749$gmane$org@axtens.net>
2015-07-31  9:16 ` [PATCH] cxl: Fix ambiguous else warnings Andreas Schwab
2015-08-03  0:36   ` Daniel Axtens [this message]
2015-08-03  0:43     ` Michael Ellerman
2015-08-03  0:47       ` Daniel Axtens
2015-08-03  1:37         ` Michael Ellerman
2015-07-31  6:35 Daniel Axtens
2015-07-31  9:28 ` Thomas Huth

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=1438562207.31010.14.camel@axtens.net \
    --to=dja@axtens.net \
    --cc=imunsie@au.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=schwab@linux-m68k.org \
    --cc=thuth@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).