LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Arnd Bergmann <arnd@arndb.de>, linuxppc-dev@lists.ozlabs.org
Cc: linuxppc-dev@ozlabs.org, dja@axtens.net
Subject: Re: [PATCH] powerpc/align: Use #ifdef __BIG_ENDIAN__ #else for REG_BYTE
Date: Fri, 17 Jun 2016 15:35:52 +1000	[thread overview]
Message-ID: <1466141752.22370.1.camel@ellerman.id.au> (raw)
In-Reply-To: <6933845.bk2S1M4pvP@wuerfel>

On Thu, 2016-06-16 at 15:05 +0200, Arnd Bergmann wrote:
> On Thursday, June 16, 2016 10:33:41 PM CEST Michael Ellerman wrote:
> > From: Daniel Axtens <dja@axtens.net>
> > 
> > Sparse complains that it doesn't know what REG_BYTE is:
> > 
> >   arch/powerpc/kernel/align.c:313:29: error: undefined identifier 'REG_BYTE'
> > 
> > REG_BYTE is defined differently based on whether we're compiling for
> > LE, BE32 or BE64. Sparse apparently doesn't provide __BIG_ENDIAN__ or
> > __LITTLE_ENDIAN__, which means we get no definition.
> > 
> > Rather than check for __BIG_ENDIAN__ and then separately for
> > __LITTLE_ENDIAN__, just switch the #ifdef to check for __BIG_ENDIAN__
> > and then #else we define the little endian version. Technically that's
> > dicey because PDP_ENDIAN is also a possibility, but we already do it in
> > a lot of places so one more hardly matters.
> > 
> > Signed-off-by: Daniel Axtens <dja@axtens.net>
> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> 
> That makes the code less robust for the cases that accidentally we
> have neither or both of __LITTLE_ENDIAN__/__BIG_ENDIAN__ set during
> an actual compilation.
 
True, but I already count ~30 locations where we do the #if/else check. So any
compiler that defines both or neither has zero chance of building the kernel
already, and is clearly broken IMHO.

> It would be better to fix the sparse compilation so the same endianess
> is set that you get when calling gcc.

Agree, but I don't want us to get road-blocked on that.

cheers

  parent reply	other threads:[~2016-06-17  5:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16 12:33 [PATCH] powerpc/align: Use #ifdef __BIG_ENDIAN__ #else for REG_BYTE Michael Ellerman
2016-06-16 13:05 ` Arnd Bergmann
2016-06-17  3:35   ` Daniel Axtens
2016-06-17 10:46     ` Arnd Bergmann
2016-06-21  0:51       ` Michael Ellerman
2016-06-21  9:04         ` Arnd Bergmann
2016-06-21  1:11       ` Daniel Axtens
2016-06-17  5:35   ` Michael Ellerman [this message]
2016-06-21  0:40 ` Michael Ellerman

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=1466141752.22370.1.camel@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=arnd@arndb.de \
    --cc=dja@axtens.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    /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