-# define memchr rpl_memchr
-extern void *memchr (void const *__s, int __c, size_t __n)
- __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
-# endif
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define memchr rpl_memchr
+# endif
+_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
+ __attribute__ ((__pure__))
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
+# else
+# if defined __SUNPRO_CC
+ /* This compiler defines an overloaded function
+ extern "C" { const void * std::memchr (const void *, int, size_t); }
+ extern "C++" { inline void * std::memchr (void *, int, size_t); }
+ and diagnoses an error
+ "Error: Could not find a match for std::memchr(const void*, int, unsigned)"
+ */
+_GL_CXXALIAS_SYS_CAST2 (memchr,
+ void *, (void const *__s, int __c, size_t __n),
+ void const *, (void const *__s, int __c, size_t __n));
+# else
+_GL_CXXALIAS_SYS (memchr, void *, (void const *__s, int __c, size_t __n));
+# endif
+# endif
+_GL_CXXALIASWARN (memchr);