[MLton-commit] r5072

Vesa Karvonen vesak at mlton.org
Sun Jan 14 15:24:04 PST 2007


Added annotations to enable warnings (warnUnused and sequenceNonUnit) and
eliminated the exposed warnings (all of which were caused by unused
identifiers).  Previously, compiling mlnlffi-lib with warnings enabled
(from the command line) caused a flood of warnings.

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

U   mlton/trunk/lib/mlnlffi/c.mlb
U   mlton/trunk/lib/mlnlffi/internals/c-int.mlb
U   mlton/trunk/lib/mlnlffi/internals/c-int.sml
U   mlton/trunk/lib/mlnlffi/memory/linkage-libdl.sml
U   mlton/trunk/lib/mlnlffi/memory/memory.32bit-unix.mlb

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

Modified: mlton/trunk/lib/mlnlffi/c.mlb
===================================================================
--- mlton/trunk/lib/mlnlffi/c.mlb	2007-01-14 22:00:47 UTC (rev 5071)
+++ mlton/trunk/lib/mlnlffi/c.mlb	2007-01-14 23:23:47 UTC (rev 5072)
@@ -14,21 +14,27 @@
  *
  * author: Matthias Blume (blume at research.bell-labs.com)
  *)
-local
-   internals/c-int.mlb
+ann
+   "forceUsed"
+   "sequenceNonUnit warn"
+   "warnUnused true"
 in
-   structure Tag
+   local
+      internals/c-int.mlb
+   in
+      structure Tag
 
-   structure MLRep
+      structure MLRep
 
-   signature C
-   structure C
-   signature C_DEBUG
-   structure C_Debug
+      signature C
+      structure C
+      signature C_DEBUG
+      structure C_Debug
 
-   signature ZSTRING
-   structure ZString
+      signature ZSTRING
+      structure ZString
 
-   signature DYN_LINKAGE
-   structure DynLinkage
+      signature DYN_LINKAGE
+      structure DynLinkage
+   end
 end

Modified: mlton/trunk/lib/mlnlffi/internals/c-int.mlb
===================================================================
--- mlton/trunk/lib/mlnlffi/internals/c-int.mlb	2007-01-14 22:00:47 UTC (rev 5071)
+++ mlton/trunk/lib/mlnlffi/internals/c-int.mlb	2007-01-14 23:23:47 UTC (rev 5072)
@@ -2,34 +2,42 @@
    $(SML_LIB)/basis/basis.mlb
 
    ../memory/memory.mlb
+in
+   ann
+      "forceUsed"
+      "sequenceNonUnit warn"
+      "warnUnused true"
+   in
+      local
+         ../c.sig
+         ../c-debug.sig
+         c-int.sig
+         c-int.sml
+         c.sml
+         c-debug.sml
 
-   ../c.sig
-   ../c-debug.sig
-   c-int.sig
-   c-int.sml
-   c.sml
-   c-debug.sml
+         ../zstring.sig
+         zstring.sml
+         tag.sml
+      in
+         structure Tag
 
-   ../zstring.sig
-   zstring.sml
-   tag.sml
-in
-   structure Tag
+         structure MLRep
+         signature C
+         structure C
+         signature C_INT
+         structure C_Int
+         signature C_DEBUG
+         structure C_Debug
 
-   structure MLRep
-   signature C
-   structure C
-   signature C_INT
-   structure C_Int
-   signature C_DEBUG
-   structure C_Debug
+         signature ZSTRING
+         structure ZString
 
-   signature ZSTRING
-   structure ZString
+         signature DYN_LINKAGE
+         structure DynLinkage
 
-   signature DYN_LINKAGE
-   structure DynLinkage
-
-   signature CMEMORY
-   structure CMemory
+         signature CMEMORY
+         structure CMemory
+      end
+   end
 end

Modified: mlton/trunk/lib/mlnlffi/internals/c-int.sml
===================================================================
--- mlton/trunk/lib/mlnlffi/internals/c-int.sml	2007-01-14 22:00:47 UTC (rev 5071)
+++ mlton/trunk/lib/mlnlffi/internals/c-int.sml	2007-01-14 23:23:47 UTC (rev 5072)
@@ -45,7 +45,9 @@
         type cword = MLRep.Int.Unsigned.word
         type bf = { a: addr, l: word, r: word, lr: word, m: cword, im: cword }
 
+(*
         fun pair_type_addr (t: 'f objt) (a: addr) = (a, t)
+*)
         fun strip_type (a: addr, _: 'f objt) = a
         fun p_strip_type (a: addr, _: 'f objt) = a
         fun strip_fun (a: addr, _: 'f) = a
@@ -62,7 +64,9 @@
         val op ~>> = MLRep.Int.Unsigned.~>>
         val op && = MLRep.Int.Unsigned.andb
         val op || = MLRep.Int.Unsigned.orb
+(*
         val op ^^ = MLRep.Int.Unsigned.xorb
+*)
         val ~~ = MLRep.Int.Unsigned.notb
     in
 
@@ -168,7 +172,7 @@
        fn w => fn x => w x
     val convert' : (('st, 'sc) obj, ('tt, 'tc) obj) W.witness -> 
                    ('st, 'sc) obj' -> ('tt, 'tc) obj' =
-       fn w => fn x => x
+       fn _ => fn x => x
 
     (*
      * A family of types and corresponding values representing natural numbers.
@@ -399,9 +403,9 @@
         local
             val u2s = MLRep.Int.Signed.fromLarge o MLRep.Int.Unsigned.toLargeIntX
         in
-            fun ubf ({ a, l, r, lr, m, im } : bf) =
+            fun ubf ({ a, l, r=_, lr, m=_, im=_ } : bf) =
                 (CMemory.load_uint a << l) >> lr
-            fun sbf ({ a, l, r, lr, m, im } : bf) =
+            fun sbf ({ a, l, r=_, lr, m=_, im=_ } : bf) =
                 u2s ((CMemory.load_uint a << l) ~>> lr)
         end
     end
@@ -455,7 +459,7 @@
                fn (x, p) => ptr_voidptr' (p_strip_type x, p)
         end
 
-        fun ubf ({ a, l, r, lr, m, im }, x) =
+        fun ubf ({ a, l=_, r, lr=_, m, im }, x) =
            CMemory.store_uint (a, (CMemory.load_uint a && im) ||
                                ((x << r) && m))
 
@@ -498,7 +502,7 @@
 
         val inject : 'o ptr -> voidptr = p_strip_type
         val cast : 'o ptr T.typ -> voidptr -> 'o ptr =
-           fn PTR (null, t) => (fn p => (p, t))
+           fn PTR (_, t) => (fn p => (p, t))
             | _ => bug "Ptr.cast (non-pointer-type)"
 
         val vnull : voidptr = CMemory.null
@@ -526,7 +530,7 @@
            fn ((p, t as PTR (_, t')), i) => (|+! (T.sizeof t') (p, i), t)
             | _ => bug "Ptr.|+| (non-pointer-type)"
         val |-| : ('t, 'c) obj ptr * ('t, 'c) obj ptr -> int =
-           fn ((p, t as PTR (_, t')), (p', _)) => |-! (T.sizeof t') (p, p')
+           fn ((p, PTR (_, t')), (p', _)) => |-! (T.sizeof t') (p, p')
             | _ => bug "Ptr.|-| (non-pointer-type"
 
         val sub : ('t, 'c) obj ptr * int -> ('t, 'c) obj =
@@ -539,7 +543,7 @@
            fn w => fn x => w x
         val convert' : (('st, 'sc) obj ptr, ('tt, 'tc) obj ptr) W.witness ->
                        ('st, 'sc) obj ptr' -> ('tt, 'tc) obj ptr' =
-           fn w => fn x => x
+           fn _ => fn x => x
 
         val ro : ('t, 'c) obj ptr   -> ('t, ro) obj ptr =
            fn x => convert (W.pointer (W.ro W.trivial)) x
@@ -577,7 +581,7 @@
            fn ((a, PTR (_, t)), d) => (a, T.arr (t, d))
             | _ => bug "Arr.reconstruct (non-pointer)"
 
-        fun reconstruct' (a: addr, d: 'n Dim.dim) = a
+        fun reconstruct' (a: addr, _: 'n Dim.dim) = a
 
         fun dim (_: addr, t) = T.dim t
     end

Modified: mlton/trunk/lib/mlnlffi/memory/linkage-libdl.sml
===================================================================
--- mlton/trunk/lib/mlnlffi/memory/linkage-libdl.sml	2007-01-14 22:00:47 UTC (rev 5071)
+++ mlton/trunk/lib/mlnlffi/memory/linkage-libdl.sml	2007-01-14 23:23:47 UTC (rev 5072)
@@ -99,8 +99,9 @@
         end
 
         (* label used for CleanUp *)
+(*
         val label = "DynLinkNewEra"
-
+*)
         (* generate a new "era" indicator *)
         fun newEra () = ref ()
 

Modified: mlton/trunk/lib/mlnlffi/memory/memory.32bit-unix.mlb
===================================================================
--- mlton/trunk/lib/mlnlffi/memory/memory.32bit-unix.mlb	2007-01-14 22:00:47 UTC (rev 5071)
+++ mlton/trunk/lib/mlnlffi/memory/memory.32bit-unix.mlb	2007-01-14 23:23:47 UTC (rev 5072)
@@ -1,25 +1,33 @@
 local
    $(SML_LIB)/basis/basis.mlb
    $(SML_LIB)/basis/mlton.mlb
-
-   linkage.sig
-   ann "allowFFI true" in
-      linkage-libdl.sml
+in
+   ann
+      "forceUsed"
+      "sequenceNonUnit warn"
+      "warnUnused true"
+   in
+      local
+         linkage.sig
+         ann "allowFFI true" in
+            linkage-libdl.sml
+         end
+         bitop-fn.sml
+         mlrep-i8i16i32i32i64f32f64.sml
+         memaccess.sig
+         memaccess-a4c1s2i4l4ll8f4d8.sml
+         memalloc.sig
+         ann "allowFFI true" in
+            memalloc-a4-unix.sml
+         end
+         memory.sig
+         memory.sml
+      in
+         signature CMEMORY
+         structure CMemory
+         signature DYN_LINKAGE
+         structure DynLinkage
+         structure MLRep
+      end
    end
-   bitop-fn.sml
-   mlrep-i8i16i32i32i64f32f64.sml
-   memaccess.sig
-   memaccess-a4c1s2i4l4ll8f4d8.sml
-   memalloc.sig
-   ann "allowFFI true" in
-      memalloc-a4-unix.sml
-   end
-   memory.sig
-   memory.sml
-in
-   signature CMEMORY
-   structure CMemory
-   signature DYN_LINKAGE
-   structure DynLinkage
-   structure MLRep
 end




More information about the MLton-commit mailing list