lkml.org 
[lkml]   [2015]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/13] lib/vsprintf.c: expand field_width to 24 bits
On Tue, 20 Oct 2015 22:30:04 +0200 Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> I didn't find a BUILD_BUG/compiletime_assertion/... which would work
> outside function context, so for now I just open-coded it.
>

It comes up occasionally. It would be better to create one.

> +extern char __check_printf_spec[1-2*(sizeof(struct printf_spec) != 8)];

Maybe something like

/*
* Description goes here
*/
#define BUILD_BUG_ON_STATIC(unique_id, expr) \
typedef char unique_id[1-2*(expr)];

BUILD_BUG_ON_STATIC(__check_printf_spec, sizeof(struct printf_spec) != 8);

("static" seems the wrong term, but what is the correct term for
"outside of functions"?)

(I hope this patchset is still up-to-date)


\
 
 \ /
  Last update: 2015-12-02 01:01    [W:2.057 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site