lkml.org 
[lkml]   [2012]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] utilize _Static_assert() for BUILD_BUG_ON() when the compiler supports it
On 12/13/2012 03:43 AM, Jan Beulich wrote:
>>>> On 13.12.12 at 01:29, Daniel Santos<danielfsantos@att.net> wrote:
>> Wow, it's really easy to miss parallel development on the same issue.
>> Sorry for my late response to this thread. I started another thread
>> addressing these issues (as well as a few others) back in September
>> (https://lkml.org/lkml/2012/9/28/1136). I've finally gotten ACKs from
>> maintainers with v6 of the patches (here
>> https://lkml.org/lkml/2012/11/20/621) and I'm just waiting for 3.8-rc1
>> to re-submit them. I actually submitted these patches back in June as
>> part of a larger patch set, but broke it apart in September (I had way
>> to many changes for one patch set)
> Since yours is apparently ready to go in, but doesn't use
> _Static_assert, I guess I'll wait for it to appear until I re-work
> whatever might be left to actually make use of _Static_assert.
>
> Jan
>
Interesting! They've enabled it by default (I suppose as an extension?)
in every standard (except -pedantic of course). One minor draw-back is
that it appears to enjoy escaping tickmarks in the error message. I've
opened a bug for it (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55678)

But realistically, the "compiletime_assert" macro I wrote in compiler.h
can be renamed to "static_assert", analogous to C11's static_assert from
assert.h (§7.2 of C11) and it can expand to the _Static_assert keyword,
when that is available.

Something else that I didn't consider too much before was support for
compiling -O0 or -O1, which will cause many expressions that are
otherwise evaluated as compile-time constants to become non-constant and
result in failed assertions. This isn't anything new however, building
-O0 has been broken for quite some time, but I presume it could help
some development of out of tree modules.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-12-13 23:01    [W:0.155 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site