From 309ce1f19f774f592d790e89de900dd81300c90b Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Thu, 19 Sep 2002 17:30:05 +0000 Subject: Hide my personal #warning reminders. Add __wcschrnul, rename strchrnul to __strchrnul, and add weak aliases for them. --- include/string.h | 6 ++---- libc/misc/locale/locale.c | 7 ++++--- libc/misc/wchar/wchar.c | 4 ++++ libc/misc/wctype/wctype.c | 6 ++++++ libc/stdlib/stdlib.c | 4 ++++ libc/string/Makefile | 3 ++- libc/string/wstring.c | 11 +++++++++-- 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/include/string.h b/include/string.h index edcdf19fe..872cccab2 100644 --- a/include/string.h +++ b/include/string.h @@ -62,8 +62,7 @@ extern int memcmp (__const void *__s1, __const void *__s2, size_t __n) extern void *memchr (__const void *__s, int __c, size_t __n) __THROW __attribute_pure__; -/*#ifdef __USE_GNU*/ -#if 0 +#ifdef __USE_GNU /* Search in S for C. This is similar to `memchr' but there is no length limit. */ extern void *rawmemchr (__const void *__s, int __c) __THROW __attribute_pure__; @@ -158,8 +157,7 @@ extern char *strchr (__const char *__s, int __c) __THROW __attribute_pure__; /* Find the last occurrence of C in S. */ extern char *strrchr (__const char *__s, int __c) __THROW __attribute_pure__; -#if 0 -/*#ifdef __USE_GNU*/ +#ifdef __USE_GNU /* This funciton is similar to `strchr'. But it returns a pointer to the closing NUL byte in case C is not found in S. */ extern char *strchrnul (__const char *__s, int __c) __THROW __attribute_pure__; diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 689257b41..f3c23f9fb 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -46,7 +46,7 @@ #ifdef __LOCALE_C_ONLY -link_warning(setlocale,"the 'setlocale' function supports only C|POSIX locales"); +link_warning(setlocale,"the 'setlocale' function supports only C|POSIX locales") static const char C_string[] = "C"; @@ -272,8 +272,7 @@ char *setlocale(int category, const char *locale) #ifdef __LOCALE_C_ONLY -#warning localeconv is hardwired for C/POSIX locale only -link_warning(localeconv,"the 'localeconv' function is hardwired for C/POSIX locale only"); +link_warning(localeconv,"the 'localeconv' function is hardwired for C/POSIX locale only") static struct lconv the_lconv; @@ -431,7 +430,9 @@ void _locale_set(const unsigned char *p) r = CODESET_LIST; __global_locale.codeset = r + r[c -= 3]; __global_locale.encoding = __ctype_encoding_8_bit; +#ifdef __UCLIBC_MJN3_ONLY__ #warning REMINDER: update 8 bit mb_cur_max when trasnlit implemented! +#endif /* TODO - update when translit implemented! */ __global_locale.mb_cur_max = 1; c8b = __locale_mmap->codeset_8_bit + c; diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 4506f4f8e..cb24f069e 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -76,7 +76,9 @@ #ifdef __UCLIBC_HAS_LOCALE__ #define ENCODING (__global_locale.encoding) +#ifdef __UCLIBC_MJN3_ONLY__ #warning implement __CTYPE_HAS_UTF_8_LOCALES! +#endif #define __CTYPE_HAS_UTF_8_LOCALES #else #undef __CTYPE_HAS_8_BIT_LOCALES @@ -363,7 +365,9 @@ size_t _wchar_utf8sntowcs(wchar_t *__restrict pwc, size_t wn, --n; if ((wc = ((unsigned char) *s++)) >= 0x80) { /* Not ASCII... */ mask = 0x40; +#ifdef __UCLIBC_MJN3_ONLY__ #warning fix range for 16 bit wides +#endif if ( ((unsigned char)(s[-1] - 0xc0)) < (0xfe - 0xc0) ) { goto START; } diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c index 802e979f1..68b9e4579 100644 --- a/libc/misc/wctype/wctype.c +++ b/libc/misc/wctype/wctype.c @@ -295,11 +295,15 @@ wctype_t wctype(const char *property) /**********************************************************************/ #ifdef L_iswctype +#ifdef __UCLIBC_MJN3_ONLY__ #warning duh... replace the range-based classification with table lookup! +#endif #ifdef __WCTYPE_WITH_LOCALE +#ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: need to fix locale ctype table lookup stuff +#endif #if 0 extern const char ctype_range[]; #else @@ -308,7 +312,9 @@ static const char ctype_range[] = { }; #endif +#ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: need to handle combining class! +#endif #define WCctype_TI_MASK ((1 << WCctype_TI_SHIFT) - 1) #define WCctype_II_MASK ((1 << WCctype_II_SHIFT) - 1) diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 3d53089f9..cc465e7a9 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -640,7 +640,9 @@ void ssort (void *base, #ifdef __UCLIBC_HAS_LOCALE__ #define ENCODING (__global_locale.encoding) +#ifdef __UCLIBC_MJN3_ONLY__ #warning implement __CTYPE_HAS_UTF_8_LOCALES! +#endif #define __CTYPE_HAS_UTF_8_LOCALES #else #define ENCODING (__ctype_encoding_7_bit) @@ -661,7 +663,9 @@ size_t _stdlib_mb_cur_max(void) return __global_locale.mb_cur_max; #else #ifdef __CTYPE_HAS_8_BIT_LOCALES +#ifdef __UCLIBC_MJN3_ONLY__ #warning need to change this when/if transliteration is implemented +#endif #endif return 1; #endif diff --git a/libc/string/Makefile b/libc/string/Makefile index 6c29bb9ec..811ec0b23 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -38,7 +38,8 @@ MOBJW= basename.o bcopy.o bzero.o dirname.o ffs.o memccpy.o memchr.o memcmp.o \ MOBJW2= wcscasecmp.o wcscat.o wcschrnul.o wcschr.o wcscmp.o wcscpy.o wcscspn.o \ wcsdup.o wcslen.o wcsncasecmp.o wcsncat.o wcsncmp.o wcsncpy.o \ wcsnlen.o wcspbrk.o wcsrchr.o wcsspn.o wcsstr.o wcstok.o wmemchr.o \ - wmemcmp.o wmemcpy.o wmemmove.o wmempcpy.o wmemset.o wcpcpy.o wcpncpy.o + wmemcmp.o wmemcpy.o wmemmove.o wmempcpy.o wmemset.o wcpcpy.o wcpncpy.o \ + wcschrnul.o # wcscoll wcsxfrm diff --git a/libc/string/wstring.c b/libc/string/wstring.c index 8a8206364..ab6bd4169 100644 --- a/libc/string/wstring.c +++ b/libc/string/wstring.c @@ -366,7 +366,7 @@ const char *const sys_errlist[] = { #endif #if EWOULDBLOCK != EAGAIN -#warning EWOULDBLOCK does not equal EAGAIN +#error EWOULDBLOCK does not equal EAGAIN #endif /* For now, ignore the other arch-specific errors. glibc only maps EPROCLIM. */ @@ -628,7 +628,9 @@ int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n) #ifdef L_strcmp #ifndef L_wcscmp +#ifdef __UCLIBC_MJN3_ONLY__ #warning implement strcoll and remove weak alias (or enable for C locale only) +#endif weak_alias(strcmp,strcoll); #endif @@ -1750,14 +1752,19 @@ char *strsep(char ** __restrict s1, const char * __restrict s2) /**********************************************************************/ #ifdef L_wcschrnul #define L_strchrnul +#define __Wstrchrnul __wcschrnul #define Wstrchrnul wcschrnul #else +#define __Wstrchrnul __strchrnul #define Wstrchrnul strchrnul #endif #ifdef L_strchrnul -Wchar *Wstrchrnul(register const Wchar *s, Wint c) +extern Wchar *__Wstrchrnul(register const Wchar *s, Wint c); +weak_alias(__Wstrchrnul, Wstrchrnul); + +Wchar *__Wstrchrnul(register const Wchar *s, Wint c) { --s; while (*++s && (*s != ((Wchar)c))); -- cgit v1.2.3