diff options
Diffstat (limited to 'tests/c++defs.h')
| -rw-r--r-- | tests/c++defs.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/c++defs.h b/tests/c++defs.h index b77979a3..cfe68cb1 100644 --- a/tests/c++defs.h +++ b/tests/c++defs.h @@ -1,5 +1,5 @@ /* C++ compatible function declaration macros. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -127,6 +127,16 @@ #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters +/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to + parenthesized func otherwise. Parenthesization is needed in C23 if + the function is like strchr and so is a qualifier-generic macro + that expands to something more complicated. */ +#ifdef __cplusplus +# define _GL_FUNCDECL_SYS_NAME(func) func +#else +# define _GL_FUNCDECL_SYS_NAME(func) (func) +#endif + /* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. @@ -139,7 +149,7 @@ _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); */ #define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ - _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func |
