From 79e419de6261c4e04785908828096cb4d56b8680 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 6 Jul 2015 14:58:51 -0500 Subject: Rework handling of basename variants As a commonly-included header, the #define basename in can affect code which uses "basename" for its own purposes (e.g. struct members or C++ namespaced functions). When such cases occur and some code includes and some not, then errors result. OTOH, is rarely used, and that's where the renaming occurs in glibc, so code using should already be safe. * libc/include/libgen.h (basename): Define as __xpg_basename for source compatibility with glibc. Declare with __ASMNAME("basename") for ABI compatibility. * libc/include/string.h (basename): Define as basename for source compatibility with glibc. Declare with __ASMNAME("__gnu_basename") for ABI compatibility. --- newlib/libc/include/string.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'newlib/libc/include/string.h') diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h index 92e08aebc..84dd6b0ce 100644 --- a/newlib/libc/include/string.h +++ b/newlib/libc/include/string.h @@ -175,8 +175,8 @@ int _EXFUN(strtosigno, (const char *__name)); this also implies that the POSIX version is used in this case. That's made sure here. */ #if __GNU_VISIBLE && !defined(basename) -char *_EXFUN(__nonnull (1) __gnu_basename,(const char *)); -# define basename __gnu_basename +# define basename basename +char *_EXFUN(__nonnull (1) basename,(const char *)) __asm__(__ASMNAME("__gnu_basename")); #endif #include -- cgit v1.2.3