[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140227161004.GT26722@mwanda>
Date: Thu, 27 Feb 2014 19:10:04 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: "Theodore Ts'o" <tytso@....edu>, Borislav Petkov <bp@...en8.de>,
Joe Perches <joe@...ches.com>, Ben Pfaff <blp@...ira.com>,
Christopher Li <sparse@...isli.org>,
Josh Triplett <josh@...htriplett.org>,
linux-sparse@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
James Hogan <james.hogan@...tec.com>
Subject: Re: [PATCH V2] sparse: Allow override of sizeof(bool) warning
On Thu, Feb 27, 2014 at 07:48:35AM -0800, H. Peter Anvin wrote:
> > Do we have a fairly comprehensive list of what these extrastandard
> > requirements / assumptions are? It might be a good idea to have one
> > that we can point to, so that (a) people who are trying to define a
> > new architecture knows what they need to handle, (b) and so we can
> > give a list of things that static code analyzers like smatch and
> > coverity and sparse should be able to suppress (perhaps in a Linux
> > kernel-only mode).
> >
>
> No, but I think we can certainly make a list... a lot of it right now
> sits in various people's heads.
>
> Here are a couple:
>
> - Bytes are 8 bits
> - Signed integers will be 2's complement
> - sizeof char, short, int, long, and long long will be 1, 2, 4, 4, 8 or
> 1, 2, 4, 8, 8 on 32- and 64-bit processors, respectively.
> - sizeof(long) == sizeof(void *)
> - NULL is represented by all zero
> - Structures will not add padding as long as all the members are
> naturally aligned.
>
That last assumption has to change for the Meta architecture.
https://lwn.net/Articles/522188/
On meta, the structs and unions are padded to 4 bytes unless they are
explicitly marked as __packed.
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists