Re: [PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-06 Thread Nick Desaulniers
On Tue, Feb 5, 2019 at 1:38 AM Rasmus Villemoes wrote: > > On 05/02/2019 09.05, Masahiro Yamada wrote: > > On Mon, Feb 4, 2019 at 4:24 AM Rasmus Villemoes > > wrote: > >> +#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, > >> #expr) > >> +#define __static_assert(expr, msg, .

Re: [PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-05 Thread Luc Van Oostenryck
On Tue, Feb 05, 2019 at 10:53:31AM +0100, Rasmus Villemoes wrote: > On 05/02/2019 00.12, Andrew Morton wrote: > >> > >> It would be (very) nice to actually use this macro in a few places so > >> it gets its build testing while in -next. > > > > ie, just about every BUILD_BUG_ON in mm/ could use th

Re: [PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-05 Thread Masahiro Yamada
On Tue, Feb 5, 2019 at 6:39 PM Rasmus Villemoes wrote: > > On 05/02/2019 09.05, Masahiro Yamada wrote: > > On Mon, Feb 4, 2019 at 4:24 AM Rasmus Villemoes > > wrote: > >> > >> BUILD_BUG_ON() is a little annoying, since it cannot be used outside > >> function scope. So one cannot put assertions ab

Re: [PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-05 Thread Rasmus Villemoes
On 05/02/2019 00.12, Andrew Morton wrote: >> >> It would be (very) nice to actually use this macro in a few places so >> it gets its build testing while in -next. > > ie, just about every BUILD_BUG_ON in mm/ could use this. Let's switch > a few? > Perhaps, but some make sense where they are, e.

Re: [PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-05 Thread Rasmus Villemoes
On 05/02/2019 09.05, Masahiro Yamada wrote: > On Mon, Feb 4, 2019 at 4:24 AM Rasmus Villemoes > wrote: >> >> BUILD_BUG_ON() is a little annoying, since it cannot be used outside >> function scope. So one cannot put assertions about the sizeof() a >> struct next to the struct definition, but has to

Re: [PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-05 Thread Masahiro Yamada
On Mon, Feb 4, 2019 at 4:24 AM Rasmus Villemoes wrote: > > BUILD_BUG_ON() is a little annoying, since it cannot be used outside > function scope. So one cannot put assertions about the sizeof() a > struct next to the struct definition, but has to hide that in some > more or less arbitrary function

Re: [PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-04 Thread Andrew Morton
On Mon, 4 Feb 2019 15:09:16 -0800 Andrew Morton wrote: > On Sun, 3 Feb 2019 20:24:00 +0100 Rasmus Villemoes > wrote: > > > BUILD_BUG_ON() is a little annoying, since it cannot be used outside > > function scope. So one cannot put assertions about the sizeof() a > > struct next to the struct

Re: [PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-04 Thread Andrew Morton
On Sun, 3 Feb 2019 20:24:00 +0100 Rasmus Villemoes wrote: > BUILD_BUG_ON() is a little annoying, since it cannot be used outside > function scope. So one cannot put assertions about the sizeof() a > struct next to the struct definition, but has to hide that in some > more or less arbitrary func

[PATCH] build_bug.h: add wrapper for _Static_assert

2019-02-03 Thread Rasmus Villemoes
BUILD_BUG_ON() is a little annoying, since it cannot be used outside function scope. So one cannot put assertions about the sizeof() a struct next to the struct definition, but has to hide that in some more or less arbitrary function. Since gcc 4.6 (which is now also the required minimum), there i