Re: [PATCH] locking/static_keys: avoid nested functions

From: Jason Baron
Date: Mon Feb 08 2016 - 14:09:22 EST


On 02/08/2016 09:36 AM, Arnd Bergmann wrote:
> clang does not support nested functions inside of an array definition:
>
> lib/test_static_keys.c:105:16: error: function definition is not allowed here
> .test_key = test_key_func(&old_true_key, static_key_true),
> lib/test_static_keys.c:50:20: note: expanded from macro 'test_key_func'
> ({bool func(void) { return branch(key); } func; })
>
> That code appears to have been a little too clever, so this
> simplifies it a bit by defining functions outside of the array.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> lib/test_static_keys.c | 62 ++++++++++++++++++++++++++++++++++----------------
> 1 file changed, 42 insertions(+), 20 deletions(-)
>

Works for me.

Acked-by: Jason Baron <jbaron@xxxxxxxxxx>

Thanks,

-Jason