From 5eb2c187b50fdc0849f60a966fbc0ff0f407fd3d Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 10 May 2017 16:02:56 -0700 Subject: [PATCH] Add __BEGIN_DECLS and __END_DECLS for C++ Add __BEGIN_DECLS and __END_DECLS to support C++. IFUNC_IMPL_ADD and IFUNC_IMPL are used internally in libc. They shouldn't be used in any programs. * include/ifunc-impl-list.h: Add __BEGIN_DECLS and __END_DECLS. (IFUNC_IMPL_ADD, IFUNC_IMPL): Define only if __cplusplus isn't defined. --- include/ifunc-impl-list.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/ifunc-impl-list.h b/include/ifunc-impl-list.h index 22ca05f..7d53f11 100644 --- a/include/ifunc-impl-list.h +++ b/include/ifunc-impl-list.h @@ -22,6 +22,8 @@ #include #include +__BEGIN_DECLS + struct libc_ifunc_impl { /* The name of function to be tested. */ @@ -32,20 +34,25 @@ struct libc_ifunc_impl bool usable; }; +#ifndef __cplusplus +/* NB: IFUNC_IMPL_ADD and IFUNC_IMPL are used internally in libc. They + shouldn't be used in any programs. */ + /* Add an IFUNC implementation, IMPL, for function FUNC, to ARRAY with USABLE at index I and advance I by one. */ -#define IFUNC_IMPL_ADD(array, i, func, usable, impl) \ +# define IFUNC_IMPL_ADD(array, i, func, usable, impl) \ extern __typeof (func) impl attribute_hidden; \ (array)[i++] = (struct libc_ifunc_impl) { #impl, (void (*) (void)) impl, (usable) }; /* Return the number of IFUNC implementations, N, for function FUNC if string NAME matches FUNC. */ -#define IFUNC_IMPL(n, name, func, ...) \ +# define IFUNC_IMPL(n, name, func, ...) \ if (strcmp (name, #func) == 0) \ { \ __VA_ARGS__; \ return n; \ } +#endif /* __cplusplus */ /* Fill ARRAY of MAX elements with IFUNC implementations for function NAME and return the number of valid entries. */ @@ -53,4 +60,6 @@ extern size_t __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, size_t max); +__END_DECLS + #endif /* ifunc-impl-list.h */ -- 2.9.3