headers: fix _CONST_RETURN warnings

With previous changes to _CONST_RETURN, GCC 7-14 will warn about strchr
and similar functions with -Wbuiltin-declaration-mismatch, as GCC's
builtin versions of these functions return non-const pointers even in
C++ mode. Other versions of GCC and all versions of Clang are fine.

This commit fixes this by moving all C++ declartions of these functions
under extern "C++", similar to what glibc does. The difference between
we and glibc is that we only use __asm__ for the const versions of these
functions, while glibc uses it for both. This is to avoid -Wodr warnings
under LTO.

Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
4 files changed