[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1449187382.17296.16.camel@perches.com>
Date: Thu, 03 Dec 2015 16:03:02 -0800
From: Joe Perches <joe@...ches.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
Kees Cook <keescook@...omium.org>,
Martin Kletzander <mkletzan@...hat.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Maurizio Lombardi <mlombard@...hat.com>,
Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 04/14] lib/vsprintf.c: expand field_width to 24 bits
On Thu, 2015-12-03 at 15:34 -0800, Andrew Morton wrote:
> I've been fiddling with a BUILD_BUG_ON which works outside functions
> using gcc's __COUNTER__ - something like
>
> #define BBO(expr) typedef char __bbo##__COUNTER__[1-2*(!!expr)]
nit: you need another parenthesis around expr
> BBO(1 == 1);
> BBO(2 == 2);
>
> but that comes out as
>
> typedef char __bbo__COUNTER__[1-2*(!!1 == 1)];
> typedef char __bbo__COUNTER__[1-2*(!!2 == 2)];
>
> instead of
>
> typedef char __bbo0[1-2*(!!1 == 1)];
> typedef char __bbo1[1-2*(!!2 == 2)];
>
> There's some trick here but I've forgotten what it is.
I believe it's something like:
#define __stringify_2(a, b) a##b
#define __stringify2(a, b) __stringify_2(a, b)
#define BBO(expr) typedef char __stringify2(bbo, __COUNTER__)[1 - 2*(!!(expr))]
--
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