From 6b26660a01125acb394e39ac71635c8df4c110c4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 20 Nov 2016 13:24:27 +0100 Subject: [PATCH] snippet/c++defs: Simplify _GL_CXXALIAS_* macros. * build-aux/snippet/c++defs.h [__cplusplus && GNULIB_NAMESPACE] (_GL_CXXALIAS_RPL_1, _GL_CXXALIAS_RPL_CAST_1, _GL_CXXALIAS_SYS, _GL_CXXALIAS_SYS_CAST, _GL_CXXALIAS_SYS_CAST2): Inline and remove member function 'rpl ()' of the wrapper struct. --- ChangeLog | 8 ++++++++ build-aux/snippet/c++defs.h | 40 +++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index fbdecf003d..75070316c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-11-21 Bruno Haible + + snippet/c++defs: Simplify _GL_CXXALIAS_* macros. + * build-aux/snippet/c++defs.h [__cplusplus && GNULIB_NAMESPACE] + (_GL_CXXALIAS_RPL_1, _GL_CXXALIAS_RPL_CAST_1, + _GL_CXXALIAS_SYS, _GL_CXXALIAS_SYS_CAST, _GL_CXXALIAS_SYS_CAST2): + Inline and remove member function 'rpl ()' of the wrapper struct. + 2016-11-20 Paul Eggert dfa: fix logic typo diff --git a/build-aux/snippet/c++defs.h b/build-aux/snippet/c++defs.h index b19a0befa3..9cdef02588 100644 --- a/build-aux/snippet/c++defs.h +++ b/build-aux/snippet/c++defs.h @@ -133,8 +133,11 @@ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ - inline type rpl () const { return ::rpl_func; } \ - inline operator type () const { return rpl (); } \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy @@ -155,9 +158,11 @@ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ - inline type rpl () const \ - { return reinterpret_cast(::rpl_func); } \ - inline operator type () const { return rpl (); } \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::rpl_func); \ + } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy @@ -183,10 +188,13 @@ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ - inline type rpl () const { return ::func; } \ - inline operator type () const { return rpl (); } \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ } func = {}; \ - } \ + } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ @@ -205,9 +213,11 @@ static const struct _gl_ ## func ## _wrapper \ { \ typedef rettype (*type) parameters; \ - inline type rpl () const \ - { return reinterpret_cast(::func); } \ - inline operator type () const { return rpl (); }\ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::func); \ + } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy @@ -235,10 +245,10 @@ { \ typedef rettype (*type) parameters; \ \ - inline type rpl () const \ - { return reinterpret_cast((rettype2 (*) parameters2)(::func)); }\ - \ - inline operator type () const { return rpl (); } \ + inline operator type () const \ + { \ + return reinterpret_cast((rettype2 (*) parameters2)(::func)); \ + } \ } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy -- 2.39.5