[MLton-commit] r4233

Matthew Fluet MLton@mlton.org
Tue, 15 Nov 2005 16:51:13 -0800


Real and Word prototypes conflict with c-chunk.h inline versions
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/Math.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform.h

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word.c	2005-11-16 00:33:09 UTC (rev 4232)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word.c	2005-11-16 00:51:10 UTC (rev 4233)
@@ -33,6 +33,7 @@
 #endif
 
 #define coerce(f, t)                            \
+        t f##_to##t (f x);                      \
         t f##_to##t (f x) {                     \
                 return (t)x;                    \
         }
@@ -55,6 +56,7 @@
 #define WordU64_max (WordU64)0xFFFFFFFFFFFFFFFFull
 
 #define binary(kind, name, op)                                          \
+        Word##kind Word##kind##_##name (Word##kind w1, Word##kind w2);  \
         Word##kind Word##kind##_##name (Word##kind w1, Word##kind w2) { \
                 return w1 op w2;                                        \
         }
@@ -125,6 +127,7 @@
         }
 
 #define compare(kind, name, op)                                         \
+        Bool Word##kind##_##name (Word##kind w1, Word##kind w2);        \
         Bool Word##kind##_##name (Word##kind w1, Word##kind w2) {       \
                 return w1 op w2;                                        \
         }
@@ -134,11 +137,13 @@
         compare (U##size, name, op)
 
 #define unary(kind,name, op)                            \
+        Word##kind Word##kind##_##name (Word##kind w);  \
         Word##kind Word##kind##_##name (Word##kind w) { \
                 return op w;                            \
         }
 
 #define shift(kind, name, op)                                           \
+        Word##kind Word##kind##_##name (Word##kind w1, Word w2);        \
         Word##kind Word##kind##_##name (Word##kind w1, Word w2) {       \
                 return w1 op w2;                                        \
         }
@@ -162,9 +167,11 @@
         bothBinary (size, quot, /)                              \
         SmulCheckOverflows (size)                               \
         bothBinary (size, rem, %)                               \
+        Word##size Word##size##_rol (Word##size w1, Word w2);   \
         Word##size Word##size##_rol (Word##size w1, Word w2) {  \
                 return (w1 >> (size - w2)) | (w1 << w2);        \
         }                                                       \
+        Word##size Word##size##_ror (Word##size w1, Word w2);   \
         Word##size Word##size##_ror (Word##size w1, Word w2) {  \
                 return (w1 >> w2) | (w1 << (size - w2));        \
         }                                                       \

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/Math.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/Math.c	2005-11-16 00:33:09 UTC (rev 4232)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/Math.c	2005-11-16 00:51:10 UTC (rev 4233)
@@ -1,9 +1,11 @@
 #include "platform.h"
 
 #define unaryReal(f, g)                                         \
+        Real64 Real64_##f (Real64 x);                           \
         Real64 Real64_##f (Real64 x) {                          \
                 return g (x);                                   \
         }                                                       \
+        Real32 Real32_##f (Real32 x);                           \
         Real32 Real32_##f (Real32 x) {                          \
                 return (Real32)(Real64_##f ((Real64)x));        \
         }
@@ -12,9 +14,11 @@
 #undef unaryReal
 
 #define binaryReal(f, g)                                        \
+        Real64 Real64_Math_##f (Real64 x, Real64 y);            \
         Real64 Real64_Math_##f (Real64 x, Real64 y) {           \
                 return g (x, y);                                \
         }                                                       \
+        Real32 Real32_Math_##f (Real32 x, Real32 y);            \
         Real32 Real32_Math_##f (Real32 x, Real32 y) {           \
                 return (Real32)(Real64_Math_##f ((Real64)x, (Real64)y)); \
         }
@@ -22,9 +26,11 @@
 #undef binaryReal
 
 #define unaryReal(f, g)                                         \
+        Real64 Real64_Math_##f (Real64 x);                      \
         Real64 Real64_Math_##f (Real64 x) {                     \
                 return g (x);                                   \
         }                                                       \
+        Real32 Real32_Math_##f (Real32 x);                      \
         Real32 Real32_Math_##f (Real32 x) {                     \
                 return (Real32)(Real64_Math_##f ((Real64)x));   \
         }
@@ -40,10 +46,12 @@
 unaryReal(tan, tan)
 #undef unaryReal
 
+Real64 Real64_ldexp (Real64 x, Int32 i);
 Real64 Real64_ldexp (Real64 x, Int32 i) {
         return ldexp (x, i);
 }
 
+Real32 Real32_ldexp (Real32 x, Int32 i);
 Real32 Real32_ldexp (Real32 x, Int32 i) {
         return (Real32)Real64_ldexp ((Real64)x, i);
 }

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform.h	2005-11-16 00:33:09 UTC (rev 4232)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform.h	2005-11-16 00:51:10 UTC (rev 4233)
@@ -977,33 +977,6 @@
 
 Real64 Real64_modf (Real64 x, Real64 *exp);
 Real32 Real32_modf (Real32 x, Real32 *exp);
-#define unaryReal(f)                                            \
-  Real64 Real64_##f (Real64 x);                                 \
-  Real32 Real32_##f (Real32 x);
-unaryReal(abs)
-unaryReal(round)
-#undef unaryReal
-#define binaryReal(f)                                           \
-        Real64 Real64_Math_##f (Real64 x, Real64 y);            \
-        Real32 Real32_Math_##f (Real32 x, Real32 y);
-binaryReal(atan2)
-#undef binaryReal
-#define unaryReal(f)                                            \
-        Real64 Real64_Math_##f (Real64 x);                      \
-        Real32 Real32_Math_##f (Real32 x);
-unaryReal(acos)
-unaryReal(asin)
-unaryReal(atan)
-unaryReal(cos)
-unaryReal(exp)
-unaryReal(ln)
-unaryReal(log10)
-unaryReal(sin)
-unaryReal(sqrt)
-unaryReal(tan)
-#undef unaryReal
-Real64 Real64_ldexp (Real64 x, Int32 i);
-Real32 Real32_ldexp (Real32 x, Int32 i);
 Real64 Real64_frexp (Real64 x, Int *exp);
 Cstring Real64_gdtoa (double d, int mode, int ndig, int *decpt);
 Cstring Real32_gdtoa (float f, int mode, int ndig, int *decpt);
@@ -1123,16 +1096,6 @@
 /*                  Word{8,16,32,64}                 */
 /* ------------------------------------------------- */
 
-#define coerce(f, t)                            \
-        t f##_to##t (f x);
-#define bothCoerce(from, to)                    \
-        coerce (Word##S##from, Word##to)        \
-        coerce (Word##U##from, Word##to)
-#define binary(kind, name)                                              \
-        Word##kind Word##kind##_##name (Word##kind w1, Word##kind w2);
-#define bothBinary(size, name)                  \
-        binary (S##size, name)                  \
-        binary (U##size, name)
 #define SaddCheckOverflows(size)                                        \
         Bool WordS##size##_addCheckOverflows (WordS##size x, WordS##size y);
 #define UaddCheckOverflows(size)                                        \
@@ -1143,65 +1106,24 @@
         Bool Word##size##_negCheckOverflows (WordS##size x);
 #define SsubCheckOverflows(size)                                        \
         Bool WordS##size##_subCheckOverflows (WordS##size x, WordS##size y);
-#define compare(kind, name)                                             \
-        Bool Word##kind##_##name (Word##kind w1, Word##kind w2);
-#define bothCompare(size, name)                     \
-        compare (S##size, name)                     \
-        compare (U##size, name)    
-#define unary(kind, name)                           \
-        Word##kind Word##kind##_##name (Word##kind w);
-#define shift(kind, name)                                               \
-        Word##kind Word##kind##_##name (Word##kind w1, Word w2);
 
 #define all(size)                                               \
-        binary (size, add)                                      \
         SaddCheckOverflows (size)                               \
         UaddCheckOverflows (size)                               \
-        binary (size, andb)                                     \
-        compare (size, equal)                                   \
-        bothCompare (size, ge)                                  \
-        bothCompare (size, gt)                                  \
-        bothCompare (size, le)                                  \
-        shift (size, lshift)                                    \
-        bothCompare (size, lt)                                  \
-        bothBinary (size, mul)                                  \
-        unary (size, neg)                                       \
         negCheckOverflows (size)                                \
-        unary (size, notb)                                      \
-        binary (size, orb)                                      \
-        bothBinary (size, quot)                                 \
         SmulCheckOverflows (size)                               \
-        bothBinary (size, rem)                                  \
-        Word##size Word##size##_rol (Word##size w1, Word w2);   \
-        Word##size Word##size##_ror (Word##size w1, Word w2);   \
-        shift (S##size, rshift)                                 \
-        shift (U##size, rshift)                                 \
-        binary (size, sub)                                      \
         SsubCheckOverflows (size)                               \
-        binary (size, xorb)                                     \
-        bothCoerce (size, 64)                                   \
-        bothCoerce (size, 32)                                   \
-        bothCoerce (size, 16)                                   \
-        bothCoerce (size, 8)
 
 all (8)
 all (16)
 all (32)
 all (64)
 
-#undef coerce
-#undef bothCoerce
-#undef binary
-#undef bothBinary
 #undef SaddCheckOverflows
 #undef UaddCheckOverflows
 #undef SmulCheckOverflows
 #undef negCheckOverflows
 #undef SsubCheckOverflows
-#undef compare
-#undef bothCompare
-#undef unary
-#undef shift
 #undef all
 
 /* ------------------------------------------------- */