mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-31 11:30:56 +08:00
Feature test macros overhaul: string.h
Throughout, remove __STRICT_ANSI__ and use the proper internal macros. bcmp, bcopy, bzero, index, and rindex were in POSIX prior to 2008. memrchr is GNU. strdup and strndup are POSIX.1-2008. The int-returning form of strerror_r is POSIX.1-2001. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This commit is contained in:
parent
84ba25226c
commit
615d63599b
@ -43,28 +43,30 @@ char *_EXFUN(strtok,(char *__restrict, const char *__restrict));
|
|||||||
#endif
|
#endif
|
||||||
size_t _EXFUN(strxfrm,(char *__restrict, const char *__restrict, size_t));
|
size_t _EXFUN(strxfrm,(char *__restrict, const char *__restrict, size_t));
|
||||||
|
|
||||||
#if __POSIX_VISIBLE
|
#if __MISC_VISIBLE || __POSIX_VISIBLE
|
||||||
char *_EXFUN(strtok_r,(char *__restrict, const char *__restrict, char **__restrict));
|
char *_EXFUN(strtok_r,(char *__restrict, const char *__restrict, char **__restrict));
|
||||||
#endif
|
#endif
|
||||||
#if __BSD_VISIBLE
|
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809)
|
||||||
int _EXFUN(bcmp,(const void *, const void *, size_t));
|
int _EXFUN(bcmp,(const void *, const void *, size_t));
|
||||||
void _EXFUN(bcopy,(const void *, void *, size_t));
|
void _EXFUN(bcopy,(const void *, void *, size_t));
|
||||||
void _EXFUN(bzero,(void *, size_t));
|
void _EXFUN(bzero,(void *, size_t));
|
||||||
|
#endif
|
||||||
|
#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809
|
||||||
int _EXFUN(ffs,(int));
|
int _EXFUN(ffs,(int));
|
||||||
|
#endif
|
||||||
|
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809)
|
||||||
char *_EXFUN(index,(const char *, int));
|
char *_EXFUN(index,(const char *, int));
|
||||||
#endif
|
#endif
|
||||||
#if __BSD_VISIBLE || __XSI_VISIBLE
|
#if __MISC_VISIBLE || __POSIX_VISIBLE
|
||||||
_PTR _EXFUN(memccpy,(_PTR __restrict, const _PTR __restrict, int, size_t));
|
_PTR _EXFUN(memccpy,(_PTR __restrict, const _PTR __restrict, int, size_t));
|
||||||
#endif
|
#endif
|
||||||
#if __GNU_VISIBLE
|
#if __GNU_VISIBLE
|
||||||
_PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
|
_PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
|
||||||
_PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
|
_PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
|
||||||
#endif
|
|
||||||
_PTR _EXFUN(memrchr,(const _PTR, int, size_t));
|
_PTR _EXFUN(memrchr,(const _PTR, int, size_t));
|
||||||
#if __GNU_VISIBLE
|
|
||||||
_PTR _EXFUN(rawmemchr,(const _PTR, int));
|
_PTR _EXFUN(rawmemchr,(const _PTR, int));
|
||||||
#endif
|
#endif
|
||||||
#if __BSD_VISIBLE
|
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809)
|
||||||
char *_EXFUN(rindex,(const char *, int));
|
char *_EXFUN(rindex,(const char *, int));
|
||||||
#endif
|
#endif
|
||||||
char *_EXFUN(stpcpy,(char *__restrict, const char *__restrict));
|
char *_EXFUN(stpcpy,(char *__restrict, const char *__restrict));
|
||||||
@ -76,19 +78,14 @@ int _EXFUN(strcasecmp,(const char *, const char *));
|
|||||||
char *_EXFUN(strcasestr,(const char *, const char *));
|
char *_EXFUN(strcasestr,(const char *, const char *));
|
||||||
char *_EXFUN(strchrnul,(const char *, int));
|
char *_EXFUN(strchrnul,(const char *, int));
|
||||||
#endif
|
#endif
|
||||||
#if __XSI_VISIBLE >= 500
|
#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
|
||||||
char *_EXFUN(strdup,(const char *));
|
char *_EXFUN(strdup,(const char *));
|
||||||
#endif
|
#endif
|
||||||
#ifndef __STRICT_ANSI__
|
|
||||||
char *_EXFUN(_strdup_r,(struct _reent *, const char *));
|
char *_EXFUN(_strdup_r,(struct _reent *, const char *));
|
||||||
#endif
|
#if __POSIX_VISIBLE >= 200809
|
||||||
#if __XSI_VISIBLE >= 700
|
|
||||||
char *_EXFUN(strndup,(const char *, size_t));
|
char *_EXFUN(strndup,(const char *, size_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __STRICT_ANSI__
|
|
||||||
char *_EXFUN(_strndup_r,(struct _reent *, const char *, size_t));
|
char *_EXFUN(_strndup_r,(struct _reent *, const char *, size_t));
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __GNU_VISIBLE
|
#if __GNU_VISIBLE
|
||||||
int _EXFUN(ffsl,(long));
|
int _EXFUN(ffsl,(long));
|
||||||
@ -101,7 +98,7 @@ int _EXFUN(ffsll, (long long));
|
|||||||
invoke the underlying function, but that requires gcc support. */
|
invoke the underlying function, but that requires gcc support. */
|
||||||
#if __GNU_VISIBLE
|
#if __GNU_VISIBLE
|
||||||
char *_EXFUN(strerror_r,(int, char *, size_t));
|
char *_EXFUN(strerror_r,(int, char *, size_t));
|
||||||
#else
|
#elif __POSIX_VISIBLE >= 200112
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
int _EXFUN(strerror_r,(int, char *, size_t))
|
int _EXFUN(strerror_r,(int, char *, size_t))
|
||||||
#ifdef __ASMNAME
|
#ifdef __ASMNAME
|
||||||
@ -124,19 +121,14 @@ size_t _EXFUN(strlcpy,(char *, const char *, size_t));
|
|||||||
#if __BSD_VISIBLE || __POSIX_VISIBLE
|
#if __BSD_VISIBLE || __POSIX_VISIBLE
|
||||||
int _EXFUN(strncasecmp,(const char *, const char *, size_t));
|
int _EXFUN(strncasecmp,(const char *, const char *, size_t));
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__STRICT_ANSI__) || __POSIX_VISIBLE >= 200809 || \
|
#if __POSIX_VISIBLE >= 200809
|
||||||
__XSI_VISIBLE >= 700
|
|
||||||
size_t _EXFUN(strnlen,(const char *, size_t));
|
size_t _EXFUN(strnlen,(const char *, size_t));
|
||||||
#endif
|
#endif
|
||||||
#if __BSD_VISIBLE
|
#if __BSD_VISIBLE
|
||||||
char *_EXFUN(strsep,(char **, const char *));
|
char *_EXFUN(strsep,(char **, const char *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
#if __MISC_VISIBLE
|
||||||
* The origin of these is unknown to me so I am conditionalizing them
|
|
||||||
* on __STRICT_ANSI__. Finetuning this is definitely needed. --joel
|
|
||||||
*/
|
|
||||||
#if !defined(__STRICT_ANSI__)
|
|
||||||
char *_EXFUN(strlwr,(char *));
|
char *_EXFUN(strlwr,(char *));
|
||||||
char *_EXFUN(strupr,(char *));
|
char *_EXFUN(strupr,(char *));
|
||||||
#endif
|
#endif
|
||||||
@ -149,7 +141,7 @@ char *_EXFUN(strsignal, (int __signo));
|
|||||||
int _EXFUN(strtosigno, (const char *__name));
|
int _EXFUN(strtosigno, (const char *__name));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _GNU_SOURCE && defined __GNUC__
|
#if __GNU_VISIBLE && defined(__GNUC__)
|
||||||
#define strdupa(__s) \
|
#define strdupa(__s) \
|
||||||
(__extension__ ({const char *__in = (__s); \
|
(__extension__ ({const char *__in = (__s); \
|
||||||
size_t __len = strlen (__in) + 1; \
|
size_t __len = strlen (__in) + 1; \
|
||||||
@ -161,7 +153,7 @@ int _EXFUN(strtosigno, (const char *__name));
|
|||||||
char *__out = (char *) __builtin_alloca (__len); \
|
char *__out = (char *) __builtin_alloca (__len); \
|
||||||
__out[__len-1] = '\0'; \
|
__out[__len-1] = '\0'; \
|
||||||
(char *) memcpy (__out, __in, __len-1);}))
|
(char *) memcpy (__out, __in, __len-1);}))
|
||||||
#endif /* _GNU_SOURCE && __GNUC__ */
|
#endif /* __GNU_VISIBLE && __GNUC__ */
|
||||||
|
|
||||||
/* There are two common basename variants. If you do NOT #include <libgen.h>
|
/* There are two common basename variants. If you do NOT #include <libgen.h>
|
||||||
and you do
|
and you do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user