Browse Source

Hide my personal #warning reminders. Add __wcschrnul, rename strchrnul
to __strchrnul, and add weak aliases for them.

Manuel Novoa III 21 years ago
parent
commit
309ce1f19f

+ 2 - 4
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__;

+ 4 - 3
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;

+ 4 - 0
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;
 			}

+ 6 - 0
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)

+ 4 - 0
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

+ 2 - 1
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
 

+ 9 - 2
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)));