Hi Ulf,
Forgot to include it. I believe this file was also written by Chih-hung.
Regards,
Dmitry
12.09.2017, 17:32, "Ulf Hermann" <ulf.herm...@qt.io>:
> Hi Dmitry,
>
> I would love to know how you implemented INLINE_NESTED_FUNC, but
> nested_func.h seems to be missing from your patch. Can you please double
> check this?
>
> regards,
> Ulf
/* Copyright (C) 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Chih-Hung Hsieh <chh(a)google.com>, 2015.
This file is free software; you can redistribute it and/or modify
it under the terms of either
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at
your option) any later version
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at
your option) any later version
or both in parallel, as here.
elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
#ifndef _NESTED_FUNC_H
#define _NESTED_FUNC_H 1
#if __clang__
#define __BLOCK __block
#define NESTED_FUNC(return_type, function_name, \
arg_types, arg_types_and_names) \
return_type (^function_name) arg_types = \
^ return_type arg_types_and_names
/* Clang does not like inline keyword before a block variable. */
#define INLINE_NESTED_FUNC(r, f, t, a) \
NESTED_FUNC (r, f, t, a)
#define INLINE_INTUSE_NESTED_FUNC(r, f, t, a) \
NESTED_FUNC (r, INTUSE(f), t, a)
/* Recrusive blocks need to be declared before used. */
#define RECURSIVE_NESTED_FUNC(return_type, function_name, \
arg_types, arg_types_and_names) \
__BLOCK return_type (^function_name) arg_types; \
function_name = ^ return_type arg_types_and_names
#define INLINE_RECURSIVE_NESTED_FUNC(r, f, t, a) \
RECURSIVE_NESTED_FUNC (r, f, t, a)
#define INLINE_INTUSE_RECURSIVE_NESTED_FUNC(r, f, t, a) \
RECURSIVE_NESTED_FUNC (r, INTUSE(f), t, a)
#else /* gcc nested function */
#define __BLOCK
#define NESTED_FUNC(return_type, function_name, \
arg_types, arg_types_and_names) \
return_type function_name arg_types_and_names
#define INLINE_NESTED_FUNC(r, f, t, a) \
inline NESTED_FUNC (r, f, t, a)
#define INLINE_INTUSE_NESTED_FUNC(r, f, t, a) \
inline NESTED_FUNC (r, INTUSE(f), t, a)
#define RECURSIVE_NESTED_FUNC(r, f, t, a) \
NESTED_FUNC (r, f, t, a)
#define INLINE_RECURSIVE_NESTED_FUNC(r, f, t, a) \
inline RECURSIVE_NESTED_FUNC (r, f, t, a)
#define INLINE_INTUSE_RECURSIVE_NESTED_FUNC(r, f, t, a) \
INLINE_RECURSIVE_NESTED_FUNC (r, INTUSE(f), t, a)
#endif
#endif /* _NESTED_FUNC_H */