[MLton-commit] r4614

Matthew Fluet MLton@mlton.org
Sat, 27 May 2006 07:56:16 -0700


The libc for NetBSD 3.0 implements tolower/toupper via indexing into a
table; cast from 'char' to 'int' at the argument to quell gcc warning;
cast from 'int' to 'char' at return for consistency.


----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c	2006-05-27 14:54:14 UTC (rev 4613)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c	2006-05-27 14:56:16 UTC (rev 4614)
@@ -153,10 +153,10 @@
   do {                                              \
   char *btLower = strdup(bt);                       \
   for (size_t i = 0; i < strlen(btLower); i++)      \
-    btLower[i] = tolower(bt[i]);                    \
+    btLower[i] = (char)(tolower((int)(bt[i])));     \
   char *btUpper = strdup(bt);                       \
   for (size_t i = 0; i < strlen(btUpper); i++)      \
-    btUpper[i] = toupper(bt[i]);                    \
+    btUpper[i] = (char)(toupper((int)(bt[i])));     \
   writeString (cTypesHFd, "typedef ");              \
   writeString (cTypesHFd, "/* ");                   \
   writeString (cTypesHFd, #t);                      \
@@ -228,10 +228,10 @@
   do {                                              \
   char *btLower = strdup(bt);                       \
   for (size_t i = 0; i < strlen(btLower); i++)      \
-    btLower[i] = tolower(bt[i]);                    \
+    btLower[i] = (char)(tolower((int)(bt[i])));     \
   char *btUpper = strdup(bt);                       \
   for (size_t i = 0; i < strlen(btUpper); i++)      \
-    btUpper[i] = toupper(bt[i]);                    \
+    btUpper[i] = (char)(toupper((int)(bt[i])));     \
   writeString (cTypesHFd, "typedef ");              \
   writeString (cTypesHFd, "C_");                    \
   writeString (cTypesHFd, name1);                   \