mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: rc4-mmotm1110 - Another build error
Date: Tue, 11 Nov 2008 14:04:57 -0500	[thread overview]
Message-ID: <7421.1226430297@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Mon, 10 Nov 2008 19:43:53 PST." <20081110194353.1a1f616e.akpm@linux-foundation.org>

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

On Mon, 10 Nov 2008 19:43:53 PST, Andrew Morton said:
> On Mon, 10 Nov 2008 22:20:33 -0500 Valdis.Kletnieks@vt.edu wrote:
> 
> > gcc --version says:
> > gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)
> > 
> > ka-blam number 2:
> > 
> >   CC      kernel/audit.o
> > In file included from include/net/dst.h:15,
> >                  from include/net/sock.h:57,
> >                  from kernel/audit.c:54:
> > include/net/neighbour.h:114: error: braced-group within expression allowed 
only inside a function
> > make[1]: *** [kernel/audit.o] Error 1
> > 
> > I'm placing bets on patches/align-avoid-evaluating-its-argument-twice.patch
> > 
> > Yep, revert that patch, and audit.o compiles again.
> > 
> 
> I hadn't got around to testing that one yet.
> 
> So ug.  ALIGN() is used in array sizing and hence has to be a
> compile-time thing.  But ALIGN(foo, bar()) will call bar() twice.
> 
> Now how do we fix that?

Can we abuse __builtin_constant_p somehow?  Maybe we can make a definition
something like:

#define __align_mask(x,mask) (
	__builtin_constant_p(mask) ? {
		(((x)+(mask))&~(mask)) :
		{              \
		      typeof(mask) __mask = mask;             \
		       (((x) + __mask) & ~__mask);             \
		}
	})

If it's a compile-time constant, it's safe to evaluate mask twice.
And if it's *not* a constant, it shouldn't be used for sizing arrays
in open code.  And if it's an array local to a procedure, it probably
should be kmalloc()'ed instead.


[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

  parent reply	other threads:[~2008-11-11 19:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-11  3:20 Valdis.Kletnieks
2008-11-11  3:43 ` Andrew Morton
2008-11-11  6:54   ` KAMEZAWA Hiroyuki
2008-11-11  7:13     ` Andrew Morton
2008-11-11 19:04   ` Valdis.Kletnieks [this message]
2008-11-11 19:18     ` Andrew Morton

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=7421.1226430297@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®