You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2016/03/20 06:53:55 UTC

[01/14] lucy-clownfish git commit: Remove unused static function `S_to_parcel`.

Repository: lucy-clownfish
Updated Branches:
  refs/heads/master b8d40d0ef -> c1ed8ee70


Remove unused static function `S_to_parcel`.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/bf4723fc
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/bf4723fc
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/bf4723fc

Branch: refs/heads/master
Commit: bf4723fc2d3b4a110eb7b4b0dd7625df92d79ea1
Parents: b8d40d0
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Mar 15 23:50:39 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 21:42:22 2016 -0700

----------------------------------------------------------------------
 compiler/python/src/cfc/_cfc.c | 6 ------
 1 file changed, 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bf4723fc/compiler/python/src/cfc/_cfc.c
----------------------------------------------------------------------
diff --git a/compiler/python/src/cfc/_cfc.c b/compiler/python/src/cfc/_cfc.c
index 24e45a4..0f6c882 100644
--- a/compiler/python/src/cfc/_cfc.c
+++ b/compiler/python/src/cfc/_cfc.c
@@ -91,12 +91,6 @@ S_to_Hierarchy(PyObject *wrapper) {
         "Clownfish::CFC::Model::Hierarchy");
 }
 
-static CFCParcel*
-S_to_Parcel(PyObject *wrapper) {
-    return (CFCParcel*)S_to_cfc_something(wrapper,
-        "Clownfish::CFC::Model::Parcel");
-}
-
 static CFCBindCore*
 S_to_BindCore(PyObject *wrapper) {
     return (CFCBindCore*)S_to_cfc_something(wrapper,


[07/14] lucy-clownfish git commit: Add UINT_EQ to CFC tests.

Posted by ma...@apache.org.
Add UINT_EQ to CFC tests.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/9d3aef80
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/9d3aef80
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/9d3aef80

Branch: refs/heads/master
Commit: 9d3aef8012cba02f43cb5cf17cefbebb8a9814a8
Parents: 74b7a06
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 22:27:49 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 compiler/src/CFCTest.c | 17 +++++++++++++++++
 compiler/src/CFCTest.h | 11 +++++++++++
 2 files changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9d3aef80/compiler/src/CFCTest.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTest.c b/compiler/src/CFCTest.c
index 3e8cd41..f925cb1 100644
--- a/compiler/src/CFCTest.c
+++ b/compiler/src/CFCTest.c
@@ -288,6 +288,23 @@ CFCTest_test_int_equals(CFCTest *self, int64_t result, int64_t expected,
 }
 
 void
+CFCTest_test_uint_equals(CFCTest *self, uint64_t result, uint64_t expected,
+                        const char *fmt, ...) {
+    int cond = (result == expected);
+
+    va_list args;
+    va_start(args, fmt);
+    S_vtest_true(self, cond, fmt, args);
+    va_end(args);
+
+    if (!cond) {
+        self->formatter->test_comment("Expected '%"PRIu64"',"
+                                      " got '%"PRIu64"'.\n",
+                                      expected, result);
+    }
+}
+
+void
 CFCTest_skip(CFCTest *self, int num, const char *fmt, ...) {
     va_list args;
     va_start(args, fmt);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9d3aef80/compiler/src/CFCTest.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTest.h b/compiler/src/CFCTest.h
index a88418a..352e390 100644
--- a/compiler/src/CFCTest.h
+++ b/compiler/src/CFCTest.h
@@ -29,6 +29,7 @@
   #define OK      CFCTest_test_true
   #define STR_EQ  CFCTest_test_string_equals
   #define INT_EQ  CFCTest_test_int_equals
+  #define UINT_EQ CFCTest_test_uint_equals
   #define SKIP    CFCTest_skip
 #endif
 
@@ -113,6 +114,16 @@ void
 CFCTest_test_int_equals(CFCTest *self, int64_t result, int64_t expected,
                         const char *fmt, ...);
 
+/* Test unsigned integers for equality and collect result.
+ *
+ * @param result Result integer to be tested.
+ * @param expected Expected result integer.
+ * @param fmt printf-like format string describing the test.
+ */
+void
+CFCTest_test_uint_equals(CFCTest *self, uint64_t result, uint64_t expected,
+                         const char *fmt, ...);
+
 /* Skip tests.
  *
  * @param num Number of tests to skip.


[08/14] lucy-clownfish git commit: Change CFCTest's INT_EQ to used signed int.

Posted by ma...@apache.org.
Change CFCTest's INT_EQ to used signed int.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/74b7a06a
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/74b7a06a
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/74b7a06a

Branch: refs/heads/master
Commit: 74b7a06ae204119b3a7cbacd7281f2376b2de88a
Parents: d8eb00c
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 22:24:42 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 compiler/src/CFCTest.c | 6 +++---
 compiler/src/CFCTest.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/74b7a06a/compiler/src/CFCTest.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTest.c b/compiler/src/CFCTest.c
index a542c32..3e8cd41 100644
--- a/compiler/src/CFCTest.c
+++ b/compiler/src/CFCTest.c
@@ -271,7 +271,7 @@ CFCTest_test_string_equals(CFCTest *self, const char *result,
 }
 
 void
-CFCTest_test_int_equals(CFCTest *self, uint64_t result, uint64_t expected,
+CFCTest_test_int_equals(CFCTest *self, int64_t result, int64_t expected,
                         const char *fmt, ...) {
     int cond = (result == expected);
 
@@ -281,8 +281,8 @@ CFCTest_test_int_equals(CFCTest *self, uint64_t result, uint64_t expected,
     va_end(args);
 
     if (!cond) {
-        self->formatter->test_comment("Expected '%"PRIu64"',"
-                                      " got '%"PRIu64"'.\n",
+        self->formatter->test_comment("Expected '%"PRId64"',"
+                                      " got '%"PRId64"'.\n",
                                       expected, result);
     }
 }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/74b7a06a/compiler/src/CFCTest.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTest.h b/compiler/src/CFCTest.h
index fd8bd30..a88418a 100644
--- a/compiler/src/CFCTest.h
+++ b/compiler/src/CFCTest.h
@@ -110,7 +110,7 @@ CFCTest_test_string_equals(CFCTest *self, const char *result,
  * @param fmt printf-like format string describing the test.
  */
 void
-CFCTest_test_int_equals(CFCTest *self, uint64_t result, uint64_t expected,
+CFCTest_test_int_equals(CFCTest *self, int64_t result, int64_t expected,
                         const char *fmt, ...);
 
 /* Skip tests.


[12/14] lucy-clownfish git commit: Change INT_EQ args from uint64_t to int64_t.

Posted by ma...@apache.org.
Change INT_EQ args from uint64_t to int64_t.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/b5a1dd20
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/b5a1dd20
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/b5a1dd20

Branch: refs/heads/master
Commit: b5a1dd206ed0f1e19ef999ae595bb2f0ae29409b
Parents: 840567e
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 01:26:52 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 runtime/core/Clownfish/TestHarness/TestBatchRunner.c   | 8 ++++----
 runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b5a1dd20/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestBatchRunner.c b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
index f832d0e..df95034 100644
--- a/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
+++ b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
@@ -150,8 +150,8 @@ TestBatchRunner_test_false(TestBatchRunner *self, bool condition,
 }
 
 bool
-TestBatchRunner_test_int_equals(TestBatchRunner *self, uint64_t got,
-                                uint64_t expected, const char *pattern, ...) {
+TestBatchRunner_test_int_equals(TestBatchRunner *self, int64_t got,
+                                int64_t expected, const char *pattern, ...) {
     va_list args;
     va_start(args, pattern);
     bool result = TestBatchRunner_VTest_Int_Equals(self, got, expected,
@@ -223,8 +223,8 @@ TestBatchRunner_VTest_False_IMP(TestBatchRunner *self, bool condition,
 }
 
 bool
-TestBatchRunner_VTest_Int_Equals_IMP(TestBatchRunner *self, uint64_t got,
-                                     uint64_t expected, const char *pattern,
+TestBatchRunner_VTest_Int_Equals_IMP(TestBatchRunner *self, int64_t got,
+                                     int64_t expected, const char *pattern,
                                      va_list args) {
     bool pass = (got == expected);
     S_vtest_true(self, pass, pattern, args);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b5a1dd20/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
index fc39d33..85bec44 100644
--- a/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
+++ b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
@@ -68,7 +68,7 @@ class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj {
                ...);
 
     inert bool
-    test_int_equals(TestBatchRunner *self, uint64_t got, uint64_t expected,
+    test_int_equals(TestBatchRunner *self, int64_t got, int64_t expected,
                     const char *pattern, ...);
 
     inert bool
@@ -97,7 +97,7 @@ class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj {
                 va_list args);
 
     bool
-    VTest_Int_Equals(TestBatchRunner *self, uint64_t got, uint64_t expected,
+    VTest_Int_Equals(TestBatchRunner *self, int64_t got, int64_t expected,
                      const char *pattern, va_list args);
 
     bool


[04/14] lucy-clownfish git commit: Fix some `unused` warnings in the Perl bindings.

Posted by ma...@apache.org.
Fix some `unused` warnings in the Perl bindings.

Have the code generator emit some temp variables only if they are
needed.  Deploy one UNUSED_VAR macro.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/338ab9f6
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/338ab9f6
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/338ab9f6

Branch: refs/heads/master
Commit: 338ab9f6c61a4cf71edde1068de88b4cb77f2fe6
Parents: f35c02d
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed Mar 16 00:35:55 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 21:42:44 2016 -0700

----------------------------------------------------------------------
 compiler/src/CFCPerlConstructor.c               |  4 ++--
 compiler/src/CFCPerlMethod.c                    | 23 +++++++++++++++-----
 .../perl/buildlib/Clownfish/Build/Binding.pm    |  1 +
 3 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/338ab9f6/compiler/src/CFCPerlConstructor.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlConstructor.c b/compiler/src/CFCPerlConstructor.c
index c0c3a89..380cb08 100644
--- a/compiler/src/CFCPerlConstructor.c
+++ b/compiler/src/CFCPerlConstructor.c
@@ -118,7 +118,8 @@ CFCPerlConstructor_xsub_def(CFCPerlConstructor *self, CFCClass *klass) {
         unsigned num_params = num_vars - 1;
         items_check = "items < 1";
         param_specs = CFCPerlSub_build_param_specs((CFCPerlSub*)self, 1);
-        locs_decl   = CFCUtil_sprintf("    int32_t locations[%u];\n",
+        locs_decl   = CFCUtil_sprintf("    int32_t locations[%u];\n"
+                                      "    SV *sv;\n",
                                       num_params);
 
         const char *pattern =
@@ -146,7 +147,6 @@ CFCPerlConstructor_xsub_def(CFCPerlConstructor *self, CFCClass *klass) {
         "    dXSARGS;\n"
         "%s" // param_specs
         "%s" // locs_decl
-        "    SV *sv;\n"
         "%s" // arg_decls
         "    %s retval;\n"
         "\n"

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/338ab9f6/compiler/src/CFCPerlMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlMethod.c b/compiler/src/CFCPerlMethod.c
index 08d32e2..c8281ee 100644
--- a/compiler/src/CFCPerlMethod.c
+++ b/compiler/src/CFCPerlMethod.c
@@ -258,13 +258,18 @@ S_xsub_def_labeled_params(CFCPerlMethod *self, CFCClass *klass) {
         retval_decl = CFCUtil_sprintf("    %s retval;\n", return_type_c);
     }
 
+    const char *locations_sv = "";
+    if (num_vars > 1) {
+        locations_sv = "    SV *sv;\n";
+    }
+
     char pattern[] =
         "XS(%s);\n"
         "XS(%s) {\n"
         "    dXSARGS;\n"
         "%s"        // param_specs
         "    int32_t locations[%d];\n"
-        "    SV *sv;\n"
+        "%s" // locations_sv
         "%s"        // arg_decls
         "    %s method;\n"
         "%s"
@@ -286,8 +291,9 @@ S_xsub_def_labeled_params(CFCPerlMethod *self, CFCClass *klass) {
         "}\n";
     char *xsub_def
         = CFCUtil_sprintf(pattern, c_name, c_name, param_specs, num_vars - 1,
-                          arg_decls, meth_type_c, retval_decl, self_name,
-                          num_vars - 1, self_assign, arg_assigns, body);
+                          locations_sv, arg_decls, meth_type_c, retval_decl,
+                          self_name, num_vars - 1, self_assign, arg_assigns,
+                          body);
 
     FREEMEM(param_specs);
     FREEMEM(arg_decls);
@@ -342,6 +348,10 @@ S_xsub_def_positional_args(CFCPerlMethod *self, CFCClass *klass) {
                                        NULL);
         }
     }
+    const char *working_sv = "";
+    if (num_vars > 1) {
+        working_sv = "    SV *sv;\n";
+    }
 
     char *retval_decl;
     if (CFCType_is_void(return_type)) {
@@ -356,7 +366,7 @@ S_xsub_def_positional_args(CFCPerlMethod *self, CFCClass *klass) {
         "XS(%s);\n"
         "XS(%s) {\n"
         "    dXSARGS;\n"
-        "    SV *sv;\n"
+        "%s" // working_sv
         "%s" // arg_decls
         "    %s method;\n"
         "%s"
@@ -376,8 +386,9 @@ S_xsub_def_positional_args(CFCPerlMethod *self, CFCClass *klass) {
         "}\n";
     char *xsub
         = CFCUtil_sprintf(pattern, self->sub.c_name, self->sub.c_name,
-                          arg_decls, meth_type_c, retval_decl, num_args_cond,
-                          xs_name_list, self_assign, arg_assigns, body);
+                          working_sv, arg_decls, meth_type_c, retval_decl,
+                          num_args_cond, xs_name_list, self_assign,
+                          arg_assigns, body);
 
     FREEMEM(arg_assigns);
     FREEMEM(arg_decls);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/338ab9f6/runtime/perl/buildlib/Clownfish/Build/Binding.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build/Binding.pm b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
index ec8ac12..d7f0ec0 100644
--- a/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -200,6 +200,7 @@ singleton(either_sv, value)
     bool     value;
 CODE:
 {
+    CFISH_UNUSED_VAR(either_sv);
     RETVAL = CFISH_OBJ_TO_SV_INC(cfish_Bool_singleton(value));
 }
 OUTPUT: RETVAL


[03/14] lucy-clownfish git commit: Avoid `uninitialized` warning within TRY block.

Posted by ma...@apache.org.
Avoid `uninitialized` warning within TRY block.

The compiler can't tell that either the TRY block will assign to
`retvalCF` successfully or an error will be detected before we return
it.  Therefore, assign an initial value to quiet the warning.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/f35c02d9
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/f35c02d9
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/f35c02d9

Branch: refs/heads/master
Commit: f35c02d96610e8f1fef0ed396650a1b498a1d138
Parents: b71d2db
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed Mar 16 00:23:47 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 21:42:36 2016 -0700

----------------------------------------------------------------------
 compiler/src/CFCPyMethod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f35c02d9/compiler/src/CFCPyMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPyMethod.c b/compiler/src/CFCPyMethod.c
index 3d13665..45b0f86 100644
--- a/compiler/src/CFCPyMethod.c
+++ b/compiler/src/CFCPyMethod.c
@@ -515,7 +515,7 @@ S_gen_meth_invocation(CFCMethod *method, CFCClass *invoker) {
         maybe_assign = "";
     }
     else {
-        maybe_declare = CFCUtil_sprintf("    %s retvalCF;\n",
+        maybe_declare = CFCUtil_sprintf("    %s retvalCF = 0;\n",
                                         CFCType_to_c(return_type));
         maybe_assign = "retvalCF = ";
     }


[14/14] lucy-clownfish git commit: Merge branch 'fixwarn2'

Posted by ma...@apache.org.
Merge branch 'fixwarn2'

Address many compiler warnings, particularly integer precision warnings
triggered by adding `-Wconversion`.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/c1ed8ee7
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/c1ed8ee7
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/c1ed8ee7

Branch: refs/heads/master
Commit: c1ed8ee7027a2311fb6487ac8f055a4316117721
Parents: b8d40d0 9b7678b
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 22:51:44 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:51:44 2016 -0700

----------------------------------------------------------------------
 compiler/c/cfc.c                                |  5 +-
 compiler/python/src/cfc/_cfc.c                  |  8 +---
 compiler/src/CFCBase.h                          |  2 +-
 compiler/src/CFCCHtml.c                         |  9 ++--
 compiler/src/CFCClass.c                         |  2 +-
 compiler/src/CFCDocuComment.c                   |  6 +--
 compiler/src/CFCFile.c                          |  2 +-
 compiler/src/CFCGoFunc.c                        | 12 ++---
 compiler/src/CFCGoTypeMap.c                     |  8 ++--
 compiler/src/CFCParcel.c                        |  8 ++--
 compiler/src/CFCParser.c                        |  2 +-
 compiler/src/CFCPerl.c                          |  2 +-
 compiler/src/CFCPerlConstructor.c               |  6 +--
 compiler/src/CFCPerlMethod.c                    | 25 +++++++---
 compiler/src/CFCPerlPod.c                       |  6 +--
 compiler/src/CFCPerlSub.c                       |  4 +-
 compiler/src/CFCPyClass.c                       |  2 +-
 compiler/src/CFCPyMethod.c                      | 32 ++++++-------
 compiler/src/CFCPython.c                        |  4 +-
 compiler/src/CFCRuby.c                          |  2 +-
 compiler/src/CFCTest.c                          | 19 +++++++-
 compiler/src/CFCTest.h                          | 13 ++++-
 compiler/src/CFCTestParamList.c                 |  4 +-
 compiler/src/CFCTestParser.c                    |  6 +--
 compiler/src/CFCTestUtil.c                      |  4 +-
 compiler/src/CFCType.c                          |  4 +-
 compiler/src/CFCUtil.c                          | 25 +++++-----
 compiler/src/CFCVersion.c                       |  3 +-
 runtime/core/Clownfish/ByteBuf.c                |  8 ++--
 runtime/core/Clownfish/CharBuf.c                | 25 +++++-----
 runtime/core/Clownfish/Class.c                  |  6 +--
 runtime/core/Clownfish/Obj.c                    |  2 +-
 runtime/core/Clownfish/PtrHash.c                |  2 +-
 runtime/core/Clownfish/String.c                 |  6 +--
 runtime/core/Clownfish/Test/TestBlob.c          |  4 +-
 runtime/core/Clownfish/Test/TestByteBuf.c       |  8 ++--
 runtime/core/Clownfish/Test/TestHash.c          | 28 +++++------
 .../core/Clownfish/Test/TestLockFreeRegistry.c  |  2 +-
 runtime/core/Clownfish/Test/TestNum.c           |  2 +-
 runtime/core/Clownfish/Test/TestString.c        | 50 ++++++++++----------
 runtime/core/Clownfish/Test/TestVector.c        | 34 ++++++-------
 runtime/core/Clownfish/Test/Util/TestMemory.c   | 20 ++++----
 .../core/Clownfish/Test/Util/TestStringHelper.c | 12 ++---
 .../Clownfish/TestHarness/TestBatchRunner.c     | 33 +++++++++++--
 .../Clownfish/TestHarness/TestBatchRunner.cfh   | 13 ++++-
 runtime/core/Clownfish/TestHarness/TestUtils.c  | 16 +++----
 runtime/core/Clownfish/Util/SortUtils.c         |  8 ++--
 runtime/core/Clownfish/Util/StringHelper.c      |  3 +-
 .../perl/buildlib/Clownfish/Build/Binding.pm    |  1 +
 runtime/python/setup.py                         |  2 +-
 50 files changed, 291 insertions(+), 219 deletions(-)
----------------------------------------------------------------------



[09/14] lucy-clownfish git commit: Address int warnings in Clownfish core.

Posted by ma...@apache.org.
Address int warnings in Clownfish core.

Clean up after adding `-Wconversion`.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/840567ed
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/840567ed
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/840567ed

Branch: refs/heads/master
Commit: 840567edd83fc137692fb7f4c1661ffca7f33ad0
Parents: 91f0005
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 01:17:18 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 runtime/core/Clownfish/ByteBuf.c               |  8 +++----
 runtime/core/Clownfish/CharBuf.c               | 25 ++++++++++-----------
 runtime/core/Clownfish/Class.c                 |  6 ++---
 runtime/core/Clownfish/Obj.c                   |  2 +-
 runtime/core/Clownfish/PtrHash.c               |  2 +-
 runtime/core/Clownfish/String.c                |  6 ++---
 runtime/core/Clownfish/Test/TestHash.c         |  6 ++---
 runtime/core/Clownfish/TestHarness/TestUtils.c | 16 ++++++-------
 runtime/core/Clownfish/Util/SortUtils.c        |  8 +++----
 runtime/core/Clownfish/Util/StringHelper.c     |  3 ++-
 10 files changed, 41 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/ByteBuf.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/ByteBuf.c b/runtime/core/Clownfish/ByteBuf.c
index 14ede6f..96d31b6 100644
--- a/runtime/core/Clownfish/ByteBuf.c
+++ b/runtime/core/Clownfish/ByteBuf.c
@@ -54,7 +54,7 @@ BB_new(size_t capacity) {
 ByteBuf*
 BB_init(ByteBuf *self, size_t min_cap) {
     // Round up to next multiple of eight.
-    size_t capacity = (min_cap + 7) & ~7;
+    size_t capacity = (min_cap + 7) & ((size_t)~7);
     // Check for overflow.
     if (capacity < min_cap) { capacity = SIZE_MAX; }
 
@@ -73,7 +73,7 @@ BB_new_bytes(const void *bytes, size_t size) {
 ByteBuf*
 BB_init_bytes(ByteBuf *self, const void *bytes, size_t size) {
     // Round up to next multiple of eight.
-    size_t capacity = (size + 7) & ~7;
+    size_t capacity = (size + 7) & ((size_t)~7);
     // Check for overflow.
     if (capacity < size) { capacity = SIZE_MAX; }
 
@@ -174,7 +174,7 @@ char*
 BB_Grow_IMP(ByteBuf *self, size_t min_cap) {
     if (min_cap > self->cap) {
         // Round up to next multiple of eight.
-        size_t capacity = (min_cap + 7) & ~7;
+        size_t capacity = (min_cap + 7) & ((size_t)~7);
         // Check for overflow.
         if (capacity < min_cap) { capacity = SIZE_MAX; }
 
@@ -236,7 +236,7 @@ S_grow_and_oversize(ByteBuf *self, size_t min_size) {
     // Oversize by 25%, but at least eight bytes.
     size_t extra = min_size / 4;
     // Round up to next multiple of eight.
-    extra = (extra + 7) & ~7;
+    extra = (extra + 7) & ((size_t)~7);
 
     size_t capacity = min_size + extra;
     // Check for overflow.

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/CharBuf.c b/runtime/core/Clownfish/CharBuf.c
index 53541c2..3867249 100644
--- a/runtime/core/Clownfish/CharBuf.c
+++ b/runtime/core/Clownfish/CharBuf.c
@@ -20,6 +20,7 @@
 
 #include "charmony.h"
 
+#include <stddef.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -143,8 +144,8 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
         // Consume all characters leading up to a '%'.
         while (slice_end < pattern_end && *slice_end != '%') { slice_end++; }
         if (pattern != slice_end) {
-            size_t size = slice_end - pattern;
-            S_cat_utf8(self, pattern, size);
+            ptrdiff_t size = slice_end - pattern;
+            S_cat_utf8(self, pattern, (size_t)size);
             pattern = slice_end;
         }
 
@@ -173,7 +174,6 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
                     break;
                 case 'i': {
                         int64_t val = 0;
-                        size_t size;
                         if (pattern[1] == '8') {
                             val = va_arg(args, int32_t);
                             pattern++;
@@ -189,13 +189,12 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
                         else {
                             S_die_invalid_pattern(pattern_start);
                         }
-                        size = sprintf(buf, "%" PRId64, val);
-                        S_cat_utf8(self, buf, size);
+                        int size = sprintf(buf, "%" PRId64, val);
+                        S_cat_utf8(self, buf, (size_t)size);
                     }
                     break;
                 case 'u': {
                         uint64_t val = 0;
-                        size_t size;
                         if (pattern[1] == '8') {
                             val = va_arg(args, uint32_t);
                             pattern += 1;
@@ -211,16 +210,16 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
                         else {
                             S_die_invalid_pattern(pattern_start);
                         }
-                        size = sprintf(buf, "%" PRIu64, val);
-                        S_cat_utf8(self, buf, size);
+                        int size = sprintf(buf, "%" PRIu64, val);
+                        S_cat_utf8(self, buf, (size_t)size);
                     }
                     break;
                 case 'f': {
                         if (pattern[1] == '6' && pattern[2] == '4') {
                             double num  = va_arg(args, double);
                             char bigbuf[512];
-                            size_t size = sprintf(bigbuf, "%g", num);
-                            S_cat_utf8(self, bigbuf, size);
+                            int size = sprintf(bigbuf, "%g", num);
+                            S_cat_utf8(self, bigbuf, (size_t)size);
                             pattern += 2;
                         }
                         else {
@@ -231,8 +230,8 @@ CB_VCatF_IMP(CharBuf *self, const char *pattern, va_list args) {
                 case 'x': {
                         if (pattern[1] == '3' && pattern[2] == '2') {
                             unsigned long val = va_arg(args, uint32_t);
-                            size_t size = sprintf(buf, "%.8lx", val);
-                            S_cat_utf8(self, buf, size);
+                            int size = sprintf(buf, "%.8lx", val);
+                            S_cat_utf8(self, buf, (size_t)size);
                             pattern += 2;
                         }
                         else {
@@ -362,7 +361,7 @@ S_grow_and_oversize(CharBuf *self, size_t min_size) {
     // Oversize by 25%, but at least eight bytes.
     size_t extra = min_size / 4;
     // Round up to next multiple of eight.
-    extra = (extra + 7) & ~7;
+    extra = (extra + 7) & ((size_t)(~7));
 
     size_t capacity = min_size + extra;
     if (capacity < min_size) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/Class.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Class.c b/runtime/core/Clownfish/Class.c
index 60434d2..8c5cdfe 100644
--- a/runtime/core/Clownfish/Class.c
+++ b/runtime/core/Clownfish/Class.c
@@ -84,7 +84,7 @@ Class_bootstrap(const cfish_ParcelSpec *parcel_spec) {
                                 : offsetof(Class, vtable);
         uint32_t class_alloc_size = novel_offset
                                     + spec->num_novel_meths
-                                      * sizeof(cfish_method_t);
+                                      * (uint32_t)sizeof(cfish_method_t);
 
         Class *klass = (Class*)CALLOCATE(class_alloc_size, 1);
 
@@ -158,7 +158,7 @@ Class_bootstrap(const cfish_ParcelSpec *parcel_spec) {
         if (parent) {
             // Copy parent vtable.
             uint32_t parent_vt_size = parent->class_alloc_size
-                                      - offsetof(Class, vtable);
+                                      - (uint32_t)offsetof(Class, vtable);
             memcpy(klass->vtable, parent->vtable, parent_vt_size);
         }
 
@@ -181,7 +181,7 @@ Class_bootstrap(const cfish_ParcelSpec *parcel_spec) {
         for (size_t i = 0; i < spec->num_novel_meths; ++i) {
             const NovelMethSpec *mspec = &novel_specs[num_novel++];
             *mspec->offset = novel_offset;
-            novel_offset += sizeof(cfish_method_t);
+            novel_offset += (uint32_t)sizeof(cfish_method_t);
             Class_Override_IMP(klass, mspec->func, *mspec->offset);
         }
     }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Obj.c b/runtime/core/Clownfish/Obj.c
index 888ebf4..cd52115 100644
--- a/runtime/core/Clownfish/Obj.c
+++ b/runtime/core/Clownfish/Obj.c
@@ -68,7 +68,7 @@ Obj_To_String_IMP(Obj *self) {
 #elif (CHY_SIZEOF_PTR == 8)
     int64_t   iaddress   = CHY_PTR_TO_I64(self);
     uint64_t  address    = (uint64_t)iaddress;
-    uint32_t  address_hi = address >> 32;
+    uint32_t  address_hi = (uint32_t)(address >> 32);
     uint32_t  address_lo = address & 0xFFFFFFFF;
     return Str_newf("%o@0x%x32%x32", Obj_get_class_name(self), address_hi,
                     address_lo);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/PtrHash.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/PtrHash.c b/runtime/core/Clownfish/PtrHash.c
index 9d42622..f1f91b2 100644
--- a/runtime/core/Clownfish/PtrHash.c
+++ b/runtime/core/Clownfish/PtrHash.c
@@ -169,7 +169,7 @@ PtrHash_Fetch(PtrHash *self, void *key) {
 
 static void
 S_resize(PtrHash *self) {
-    size_t old_size = self->end - self->entries;
+    size_t old_size = (size_t)(self->end - self->entries);
     if (old_size > SIZE_MAX / 2 || self->shift == 0) {
         THROW(ERR, "PtrHash size overflow");
     }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/String.c b/runtime/core/Clownfish/String.c
index ac17bad..f619673 100644
--- a/runtime/core/Clownfish/String.c
+++ b/runtime/core/Clownfish/String.c
@@ -202,7 +202,7 @@ Str_Hash_Sum_IMP(String *self) {
     const StrIter_Next_t next = METHOD_PTR(STRINGITERATOR, CFISH_StrIter_Next);
     int32_t code_point;
     while (STR_OOB != (code_point = next(iter))) {
-        hashvalue = ((hashvalue << 5) + hashvalue) ^ code_point;
+        hashvalue = ((hashvalue << 5) + hashvalue) ^ (size_t)code_point;
     }
 
     return hashvalue;
@@ -404,7 +404,7 @@ Str_Find_IMP(String *self, String *substring) {
 StringIterator*
 Str_Find_Utf8_IMP(String *self, const char *substring, size_t size) {
     const char *ptr = S_memmem(self, substring, size);
-    return ptr ? StrIter_new(self, ptr - self->ptr) : NULL;
+    return ptr ? StrIter_new(self, (size_t)(ptr - self->ptr)) : NULL;
 }
 
 static const char*
@@ -417,7 +417,7 @@ S_memmem(String *self, const char *substring, size_t size) {
     char first_char = substring[0];
 
     // Naive string search.
-    while (NULL != (ptr = (const char*)memchr(ptr, first_char, end - ptr))) {
+    while (NULL != (ptr = (const char*)memchr(ptr, first_char, (size_t)(end - ptr)))) {
         if (memcmp(ptr, substring, size) == 0) { break; }
         ptr++;
     }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/Test/TestHash.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestHash.c b/runtime/core/Clownfish/Test/TestHash.c
index e3fb0d7..c5c9c1f 100644
--- a/runtime/core/Clownfish/Test/TestHash.c
+++ b/runtime/core/Clownfish/Test/TestHash.c
@@ -83,7 +83,7 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
     TEST_INT_EQ(runner, Hash_Get_Capacity(hash), starting_cap,
                 "Initial capacity sufficient (no rebuilds)");
 
-    for (int32_t i = 0; i < 100; i++) {
+    for (size_t i = 0; i < 100; i++) {
         String *key  = (String*)Vec_Fetch(expected, i);
         Obj    *elem = Hash_Fetch(hash, key);
         Vec_Push(got, (Obj*)INCREF(elem));
@@ -182,10 +182,10 @@ test_stress(TestBatchRunner *runner) {
     Vector   *values;
 
     for (uint32_t i = 0; i < 1000; i++) {
-        String *str = TestUtils_random_string(rand() % 1200);
+        String *str = TestUtils_random_string((size_t)(rand() % 1200));
         while (Hash_Fetch(hash, str)) {
             DECREF(str);
-            str = TestUtils_random_string(rand() % 1200);
+            str = TestUtils_random_string((size_t)(rand() % 1200));
         }
         Hash_Store(hash, str, (Obj*)str);
         Vec_Push(expected, INCREF(str));

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/TestHarness/TestUtils.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestUtils.c b/runtime/core/Clownfish/TestHarness/TestUtils.c
index b71461d..556d301 100644
--- a/runtime/core/Clownfish/TestHarness/TestUtils.c
+++ b/runtime/core/Clownfish/TestHarness/TestUtils.c
@@ -44,7 +44,7 @@ TestUtils_random_i64s(int64_t *buf, size_t count, int64_t min,
     uint64_t  range = min < limit ? (uint64_t)limit - (uint64_t)min : 0;
     int64_t *ints = buf ? buf : (int64_t*)CALLOCATE(count, sizeof(int64_t));
     for (size_t i = 0; i < count; i++) {
-        ints[i] = min + TestUtils_random_u64() % range;
+        ints[i] = min + (int64_t)(TestUtils_random_u64() % range);
     }
     return ints;
 }
@@ -65,7 +65,7 @@ TestUtils_random_f64s(double *buf, size_t count) {
     double *f64s = buf ? buf : (double*)CALLOCATE(count, sizeof(double));
     for (size_t i = 0; i < count; i++) {
         uint64_t num = TestUtils_random_u64();
-        f64s[i] = CHY_U64_TO_DOUBLE(num) / UINT64_MAX;
+        f64s[i] = CHY_U64_TO_DOUBLE(num) / (double)UINT64_MAX;
     }
     return f64s;
 }
@@ -74,7 +74,7 @@ static int32_t
 S_random_code_point(void) {
     int32_t code_point = 0;
     while (1) {
-        uint8_t chance = (rand() % 9) + 1;
+        uint8_t chance = (uint8_t)((rand() % 9) + 1);
         switch (chance) {
             case 1: case 2: case 3:
                 code_point = rand() % 0x80;
@@ -87,7 +87,7 @@ S_random_code_point(void) {
                 break;
             case 9: {
                     uint64_t num = TestUtils_random_u64();
-                    code_point = (num % (0x10FFFF - 0x10000)) + 0x10000;
+                    code_point = (int32_t)(num % (0x10FFFF - 0x10000)) + 0x10000;
                 }
         }
         if (code_point > 0x10FFFF) {
@@ -148,7 +148,7 @@ TestUtils_time() {
     struct timeval t;
     gettimeofday(&t, NULL);
 
-    return (uint64_t)t.tv_sec * 1000000 + t.tv_usec;
+    return (uint64_t)(t.tv_sec * 1000000 + t.tv_usec);
 }
 
 #else
@@ -172,10 +172,10 @@ TestUtils_usleep(uint64_t microseconds) {
 
 void
 TestUtils_usleep(uint64_t microseconds) {
-    uint32_t seconds = microseconds / 1000000;
+    uint64_t seconds = microseconds / 1000000;
     microseconds %= 1000000;
-    sleep(seconds);
-    usleep(microseconds);
+    sleep((unsigned)seconds);
+    usleep((useconds_t)microseconds);
 }
 
 #else

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/Util/SortUtils.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Util/SortUtils.c b/runtime/core/Clownfish/Util/SortUtils.c
index d620098..1fe8b29 100644
--- a/runtime/core/Clownfish/Util/SortUtils.c
+++ b/runtime/core/Clownfish/Util/SortUtils.c
@@ -161,11 +161,11 @@ SI_merge(void *left_vptr,  size_t left_size,
         }
     }
 
-    const size_t left_remaining = left_limit - left_ptr;
-    memcpy(dest, left_ptr, left_remaining);
+    const ptrdiff_t left_remaining = left_limit - left_ptr;
+    memcpy(dest, left_ptr, (size_t)left_remaining);
     dest += left_remaining;
-    const size_t right_remaining = right_limit - right_ptr;
-    memcpy(dest, right_ptr, right_remaining);
+    const ptrdiff_t right_remaining = right_limit - right_ptr;
+    memcpy(dest, right_ptr, (size_t)right_remaining);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/840567ed/runtime/core/Clownfish/Util/StringHelper.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Util/StringHelper.c b/runtime/core/Clownfish/Util/StringHelper.c
index 085d8a5..59418b2 100644
--- a/runtime/core/Clownfish/Util/StringHelper.c
+++ b/runtime/core/Clownfish/Util/StringHelper.c
@@ -16,6 +16,7 @@
 
 #define C_CFISH_STRINGHELPER
 #include <string.h>
+#include <stddef.h>
 
 #define CFISH_USE_SHORT_NAMES
 
@@ -70,7 +71,7 @@ StrHelp_to_base36(uint64_t num, void *buffer) {
         num /= 36;
     } while (num > 0);
 
-    size_t size = end - buf;
+    size_t size = (size_t)(end - buf);
     memcpy(buffer, buf, size + 1);
     return size;
 }


[06/14] lucy-clownfish git commit: Add UINT_EQ test functions.

Posted by ma...@apache.org.
Add UINT_EQ test functions.

Add unsigned integer unit test functions.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/e37b154b
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/e37b154b
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/e37b154b

Branch: refs/heads/master
Commit: e37b154b20984708dc533d4060cbaed7eca1a49c
Parents: b5a1dd2
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 21:59:44 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 .../Clownfish/TestHarness/TestBatchRunner.c     | 25 ++++++++++++++++++++
 .../Clownfish/TestHarness/TestBatchRunner.cfh   |  9 +++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e37b154b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestBatchRunner.c b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
index df95034..fd3bec9 100644
--- a/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
+++ b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
@@ -161,6 +161,17 @@ TestBatchRunner_test_int_equals(TestBatchRunner *self, int64_t got,
 }
 
 bool
+TestBatchRunner_test_uint_equals(TestBatchRunner *self, uint64_t got,
+                                 uint64_t expected, const char *pattern, ...) {
+    va_list args;
+    va_start(args, pattern);
+    bool result = TestBatchRunner_VTest_UInt_Equals(self, got, expected,
+                                                    pattern, args);
+    va_end(args);
+    return result;
+}
+
+bool
 TestBatchRunner_test_float_equals(TestBatchRunner *self, double got,
                                   double expected, const char *pattern, ...) {
     va_list args;
@@ -230,6 +241,20 @@ TestBatchRunner_VTest_Int_Equals_IMP(TestBatchRunner *self, int64_t got,
     S_vtest_true(self, pass, pattern, args);
     if (!pass) {
         TestFormatter_test_comment(self->formatter,
+                                   "Expected '%"PRId64"', got '%"PRId64"'.\n",
+                                   expected, got);
+    }
+    return pass;
+}
+
+bool
+TestBatchRunner_VTest_UInt_Equals_IMP(TestBatchRunner *self, uint64_t got,
+                                      uint64_t expected, const char *pattern,
+                                      va_list args) {
+    bool pass = (got == expected);
+    S_vtest_true(self, pass, pattern, args);
+    if (!pass) {
+        TestFormatter_test_comment(self->formatter,
                                    "Expected '%"PRIu64"', got '%"PRIu64"'.\n",
                                    expected, got);
     }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e37b154b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
index 85bec44..0f01b38 100644
--- a/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
+++ b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
@@ -72,6 +72,10 @@ class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj {
                     const char *pattern, ...);
 
     inert bool
+    test_uint_equals(TestBatchRunner *self, uint64_t got, uint64_t expected,
+                     const char *pattern, ...);
+
+    inert bool
     test_float_equals(TestBatchRunner *self, double got, double expected,
                       const char *pattern, ...);
 
@@ -101,6 +105,10 @@ class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj {
                      const char *pattern, va_list args);
 
     bool
+    VTest_UInt_Equals(TestBatchRunner *self, uint64_t got, uint64_t expected,
+                     const char *pattern, va_list args);
+
+    bool
     VTest_Float_Equals(TestBatchRunner *self, double got, double expected,
                        const char *pattern, va_list args);
 
@@ -125,6 +133,7 @@ __C__
   #define TEST_TRUE            cfish_TestBatchRunner_test_true
   #define TEST_FALSE           cfish_TestBatchRunner_test_false
   #define TEST_INT_EQ          cfish_TestBatchRunner_test_int_equals
+  #define TEST_UINT_EQ         cfish_TestBatchRunner_test_uint_equals
   #define TEST_FLOAT_EQ        cfish_TestBatchRunner_test_float_equals
   #define TEST_STR_EQ          cfish_TestBatchRunner_test_string_equals
   #define PASS                 cfish_TestBatchRunner_pass


[05/14] lucy-clownfish git commit: Address int warnings in CFC.

Posted by ma...@apache.org.
Address int warnings in CFC.

Quiet warnings exposed by adding `-Wconversion`.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/91f00051
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/91f00051
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/91f00051

Branch: refs/heads/master
Commit: 91f00051d7b434136244a7f44f3f6d1fe187464f
Parents: 338ab9f
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Fri Mar 18 23:41:26 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:19:41 2016 -0700

----------------------------------------------------------------------
 compiler/c/cfc.c                  |  5 +++--
 compiler/src/CFCBase.h            |  2 +-
 compiler/src/CFCCHtml.c           |  9 +++++----
 compiler/src/CFCClass.c           |  2 +-
 compiler/src/CFCDocuComment.c     |  6 +++---
 compiler/src/CFCFile.c            |  2 +-
 compiler/src/CFCGoFunc.c          | 12 ++++++------
 compiler/src/CFCGoTypeMap.c       |  8 ++++----
 compiler/src/CFCParcel.c          |  8 ++++----
 compiler/src/CFCParser.c          |  2 +-
 compiler/src/CFCPerl.c            |  2 +-
 compiler/src/CFCPerlConstructor.c |  2 +-
 compiler/src/CFCPerlMethod.c      |  2 +-
 compiler/src/CFCPerlPod.c         |  6 +++---
 compiler/src/CFCPerlSub.c         |  4 ++--
 compiler/src/CFCPyClass.c         |  2 +-
 compiler/src/CFCPyMethod.c        | 30 +++++++++++++++---------------
 compiler/src/CFCPython.c          |  4 ++--
 compiler/src/CFCRuby.c            |  2 +-
 compiler/src/CFCType.c            |  4 ++--
 compiler/src/CFCUtil.c            | 25 +++++++++++++------------
 compiler/src/CFCVersion.c         |  3 ++-
 22 files changed, 73 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/c/cfc.c
----------------------------------------------------------------------
diff --git a/compiler/c/cfc.c b/compiler/c/cfc.c
index 6f5f527..369a0b1 100644
--- a/compiler/c/cfc.c
+++ b/compiler/c/cfc.c
@@ -75,6 +75,7 @@ S_parse_string_array_argument(const char *arg, const char *name,
     size_t   arg_len  = strlen(arg);
     size_t   name_len = strlen(name);
     int      new_num_results;
+    size_t   amount;
     char   **new_results;
 
     if (arg_len < name_len
@@ -85,8 +86,8 @@ S_parse_string_array_argument(const char *arg, const char *name,
     }
 
     new_num_results = *num_results + 1;
-    new_results     = (char **)REALLOCATE(*results,
-                              (new_num_results + 1) * sizeof(char *));
+    amount = (((size_t)new_num_results + 1) * sizeof(char *));
+    new_results = (char **)REALLOCATE(*results, amount);
     new_results[new_num_results-1] = CFCUtil_strdup(arg + name_len + 1);
     new_results[new_num_results]   = NULL;
     *num_results = new_num_results;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCBase.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCBase.h b/compiler/src/CFCBase.h
index 9117ae2..09ee662 100644
--- a/compiler/src/CFCBase.h
+++ b/compiler/src/CFCBase.h
@@ -33,7 +33,7 @@ typedef void (*CFCBase_destroy_t)(CFCBase *self);
 #ifdef CFC_NEED_BASE_STRUCT_DEF
 struct CFCBase {
     const CFCMeta *meta;
-    int refcount;
+    unsigned refcount;
 };
 #endif
 struct CFCMeta {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCCHtml.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCHtml.c b/compiler/src/CFCCHtml.c
index 6f42ea6..a054cb8 100644
--- a/compiler/src/CFCCHtml.c
+++ b/compiler/src/CFCCHtml.c
@@ -16,6 +16,7 @@
 
 #include <ctype.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 
 #include <cmark.h>
@@ -1091,8 +1092,8 @@ S_type_to_html(CFCType *type, const char *sep, CFCClass *doc_class) {
             CFCUtil_die("Unprefixed object specifier '%s'", specifier);
         }
 
-        size_t      offset     = underscore + 1 - specifier;
-        char       *prefix     = CFCUtil_strndup(specifier, offset);
+        ptrdiff_t   offset     = underscore + 1 - specifier;
+        char       *prefix     = CFCUtil_strndup(specifier, (size_t)offset);
         const char *struct_sym = specifier + offset;
 
         if (!klass) {
@@ -1117,7 +1118,7 @@ S_type_to_html(CFCType *type, const char *sep, CFCClass *doc_class) {
     const char *const_str = CFCType_const(type) ? "const " : "";
 
     int indirection = CFCType_get_indirection(type);
-    size_t asterisk_offset = indirection < 10 ? 10 - indirection : 0;
+    ptrdiff_t asterisk_offset = indirection < 10 ? 10 - indirection : 0;
     const char *asterisks = "**********";
     const char *ind_str   = asterisks + asterisk_offset;
 
@@ -1203,7 +1204,7 @@ S_relative_url(const char *url, CFCClass *base, int dir_level) {
     }
 
     // Create path back to root
-    size_t bytes = dir_level * 3;
+    size_t bytes = (size_t)(dir_level * 3);
     char *prefix = (char*)MALLOCATE(bytes + 1);
     for (size_t i = 0; i < bytes; i += 3) {
         memcpy(prefix + i, "../", 3);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index 56edce5..77e0158 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -274,7 +274,7 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
     char *short_class_var = (char*)MALLOCATE(struct_sym_len + 1);
     size_t i;
     for (i = 0; i < struct_sym_len; i++) {
-        short_class_var[i] = toupper(struct_sym[i]);
+        short_class_var[i] = (char)toupper(struct_sym[i]);
     }
     short_class_var[struct_sym_len] = '\0';
     self->short_class_var = short_class_var;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCDocuComment.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCDocuComment.c b/compiler/src/CFCDocuComment.c
index f5c45cc..2bcc495 100644
--- a/compiler/src/CFCDocuComment.c
+++ b/compiler/src/CFCDocuComment.c
@@ -107,7 +107,7 @@ CFCDocuComment_parse(const char *raw_text) {
             && ((ptr == limit - 1) || isspace(*(ptr + 1)))
            ) {
             ptr++;
-            size_t brief_len = ptr - text;
+            size_t brief_len = (size_t)(ptr - text);
             self->brief = CFCUtil_strdup(text);
             self->brief[brief_len] = '\0';
             break;
@@ -136,7 +136,7 @@ CFCDocuComment_parse(const char *raw_text) {
         while (isspace(*ptr) && ptr < text_limit) { ptr++; }
         char *param_name = ptr;
         while ((isalnum(*ptr) || *ptr == '_') && ptr < text_limit) { ptr++; }
-        size_t param_name_len = ptr - param_name;
+        size_t param_name_len = (size_t)(ptr - param_name);
         if (!param_name_len) {
             CFCUtil_die("Malformed @param directive in '%s'", raw_text);
         }
@@ -151,7 +151,7 @@ CFCDocuComment_parse(const char *raw_text) {
               ) {
             ptr++;
         }
-        size_t param_doc_len = ptr - param_doc;
+        size_t param_doc_len = (size_t)(ptr - param_doc);
 
         num_params++;
         size_t size = (num_params + 1) * sizeof(char*);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCFile.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCFile.c b/compiler/src/CFCFile.c
index 52a4451..1e03a3e 100644
--- a/compiler/src/CFCFile.c
+++ b/compiler/src/CFCFile.c
@@ -81,7 +81,7 @@ CFCFile_init(CFCFile *self, CFCParcel *parcel, CFCFileSpec *spec) {
             self->guard_name[j++] = '_';
         }
         else if (isalnum(c)) {
-            self->guard_name[j++] = toupper(c);
+            self->guard_name[j++] = (char)toupper(c);
         }
     }
     self->guard_name[j] = '\0';

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCGoFunc.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoFunc.c b/compiler/src/CFCGoFunc.c
index dbebee8..8607d8f 100644
--- a/compiler/src/CFCGoFunc.c
+++ b/compiler/src/CFCGoFunc.c
@@ -49,9 +49,9 @@ char*
 CFCGoFunc_go_meth_name(const char *orig, int is_public) {
     char *go_name = CFCUtil_strdup(orig);
     if (!is_public) {
-        go_name[0] = tolower(go_name[0]);
+        go_name[0] = (char)tolower(go_name[0]);
     }
-    for (int i = 1, j = 1, max = strlen(go_name) + 1; i < max; i++) {
+    for (size_t i = 1, j = 1, max = strlen(go_name) + 1; i < max; i++) {
         if (go_name[i] != '_') {
             go_name[j++] = go_name[i];
         }
@@ -81,8 +81,8 @@ S_prep_start(CFCParcel *parcel, const char *name, CFCClass *invoker,
 
     char *params = CFCUtil_strdup("");
     char *converted = CFCUtil_strdup("");
-    int start = targ == IS_METHOD ? 1 : 0;
-    for (int i = start; param_vars[i] != NULL; i++) {
+    size_t start = targ == IS_METHOD ? 1 : 0;
+    for (size_t i = start; param_vars[i] != NULL; i++) {
         CFCVariable *var = param_vars[i];
         CFCType *type = CFCVariable_get_type(var);
         char *go_type_name = CFCGoTypeMap_go_type_name(type, parcel);
@@ -96,7 +96,7 @@ S_prep_start(CFCParcel *parcel, const char *name, CFCClass *invoker,
 
     // Convert certain types and defer their destruction until after the
     // Clownfish call returns.
-    for (int i = 0; param_vars[i] != NULL; i++) {
+    for (size_t i = 0; param_vars[i] != NULL; i++) {
         CFCVariable *var = param_vars[i];
         CFCType *type = CFCVariable_get_type(var);
         if (!CFCType_is_object(type)) {
@@ -231,7 +231,7 @@ S_prep_cfargs(CFCParcel *parcel, CFCClass *invoker,
     char go_name[GO_NAME_BUF_SIZE];
     char *cfargs = CFCUtil_strdup("");
 
-    for (int i = 0; vars[i] != NULL; i++) {
+    for (size_t i = 0; vars[i] != NULL; i++) {
         CFCVariable *var = vars[i];
         CFCType *type = CFCVariable_get_type(var);
         if (targ == IS_METHOD && i == 0) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCGoTypeMap.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoTypeMap.c b/compiler/src/CFCGoTypeMap.c
index 4c74863..ad91817 100644
--- a/compiler/src/CFCGoTypeMap.c
+++ b/compiler/src/CFCGoTypeMap.c
@@ -153,7 +153,7 @@ CFCGoTypeMap_go_type_name(CFCType *type, CFCParcel *current_parcel) {
         }
         char *result = CFCUtil_sprintf("%s.%s", package_name, struct_sym);
         for (int i = 0; result[i] != '.'; i++) {
-            result[i] = tolower(result[i]);
+            result[i] = (char)tolower(result[i]);
         }
         return result;
     }
@@ -184,7 +184,7 @@ CFCGoTypeMap_go_short_package(CFCParcel *parcel) {
     // parcel names.
     char *go_short_package = CFCUtil_strdup(parcel_frag);
     for (int i = 0; go_short_package[i] != '\0'; i++) {
-        go_short_package[i] = tolower(go_short_package[i]);
+        go_short_package[i] = (char)tolower(go_short_package[i]);
     }
     return go_short_package;
 }
@@ -207,7 +207,7 @@ CFCGoTypeMap_go_meth_receiever(const char *struct_name,
     // Find the first letter of the type and lowercase it.
     for (size_t i = 0, max = strlen(struct_name); i < max; i++) {
         if (isupper(struct_name[i])) {
-            buf[0] = tolower(struct_name[i]);
+            buf[0] = (char)tolower(struct_name[i]);
             buf[1] = '\0';
             break;
         }
@@ -265,7 +265,7 @@ CFCGoTypeMap_go_arg_name(CFCParamList *param_list, size_t tick, char *buf,
             continue;
         }
         else if (last_was_underscore) {
-            buf[dest_tick] = toupper(orig[i]);
+            buf[dest_tick] = (char)toupper(orig[i]);
         }
         else {
             buf[dest_tick] = orig[i];

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCParcel.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCParcel.c b/compiler/src/CFCParcel.c
index 3e2e8ba..cbfd2a5 100644
--- a/compiler/src/CFCParcel.c
+++ b/compiler/src/CFCParcel.c
@@ -209,8 +209,8 @@ CFCParcel_init(CFCParcel *self, const char *name, const char *nickname,
         self->Prefix[nickname_len] = '\0';
     }
     for (size_t i = 0; i < amount; i++) {
-        self->prefix[i] = tolower(self->Prefix[i]);
-        self->PREFIX[i] = toupper(self->Prefix[i]);
+        self->prefix[i] = (char)tolower(self->Prefix[i]);
+        self->PREFIX[i] = (char)toupper(self->Prefix[i]);
     }
     self->prefix[prefix_len] = '\0';
     self->Prefix[prefix_len] = '\0';
@@ -221,7 +221,7 @@ CFCParcel_init(CFCParcel *self, const char *name, const char *nickname,
     self->privacy_sym = (char*)MALLOCATE(privacy_sym_len + 1);
     memcpy(self->privacy_sym, "CFP_", 4);
     for (size_t i = 0; i < nickname_len; i++) {
-        self->privacy_sym[i+4] = toupper(self->nickname[i]);
+        self->privacy_sym[i+4] = (char)toupper(self->nickname[i]);
     }
     self->privacy_sym[privacy_sym_len] = '\0';
 
@@ -776,7 +776,7 @@ S_parse_json_string(const char **json) {
     }
     JSONNode *node = (JSONNode*)calloc(1, sizeof(JSONNode));
     node->type = JSON_STRING;
-    node->string = CFCUtil_strndup(start, text - start);
+    node->string = CFCUtil_strndup(start, (size_t)(text - start));
 
     // Move pointer.
     text++;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCParser.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCParser.c b/compiler/src/CFCParser.c
index a49a6c4..b1c74f7 100644
--- a/compiler/src/CFCParser.c
+++ b/compiler/src/CFCParser.c
@@ -99,7 +99,7 @@ CFCParser_parse(CFCParser *self, const char *string) {
     // Zero out, then parse.
     self->errors = false;
     self->lineno = 0;
-    YY_BUFFER_STATE buffer = yy_scan_bytes(string, (int)strlen(string));
+    YY_BUFFER_STATE buffer = yy_scan_bytes(string, (yy_size_t)strlen(string));
     yylex();
     yy_delete_buffer(buffer);
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerl.c b/compiler/src/CFCPerl.c
index 056afaf..ccd548b 100644
--- a/compiler/src/CFCPerl.c
+++ b/compiler/src/CFCPerl.c
@@ -280,7 +280,7 @@ S_write_boot_h(CFCPerl *self) {
     S_replace_double_colons(guard, '_');
     for (char *ptr = guard; *ptr != '\0'; ptr++) {
         if (isalpha(*ptr)) {
-            *ptr = toupper(*ptr);
+            *ptr = (char)toupper(*ptr);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCPerlConstructor.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlConstructor.c b/compiler/src/CFCPerlConstructor.c
index 380cb08..6069aa2 100644
--- a/compiler/src/CFCPerlConstructor.c
+++ b/compiler/src/CFCPerlConstructor.c
@@ -115,7 +115,7 @@ CFCPerlConstructor_xsub_def(CFCPerlConstructor *self, CFCClass *klass) {
         locate_args = CFCUtil_strdup("");
     }
     else {
-        unsigned num_params = num_vars - 1;
+        unsigned num_params = (unsigned)num_vars - 1;
         items_check = "items < 1";
         param_specs = CFCPerlSub_build_param_specs((CFCPerlSub*)self, 1);
         locs_decl   = CFCUtil_sprintf("    int32_t locations[%u];\n"

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCPerlMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlMethod.c b/compiler/src/CFCPerlMethod.c
index c8281ee..f614896 100644
--- a/compiler/src/CFCPerlMethod.c
+++ b/compiler/src/CFCPerlMethod.c
@@ -133,7 +133,7 @@ CFCPerlMethod_perl_name(CFCMethod *method) {
     const char *name      = CFCMethod_get_name(method);
     char       *perl_name = CFCUtil_strdup(name);
     for (size_t i = 0; perl_name[i] != '\0'; i++) {
-        perl_name[i] = tolower(perl_name[i]);
+        perl_name[i] = (char)tolower(perl_name[i]);
     }
 
     return perl_name;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCPerlPod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.c b/compiler/src/CFCPerlPod.c
index c09eacf..09be538 100644
--- a/compiler/src/CFCPerlPod.c
+++ b/compiler/src/CFCPerlPod.c
@@ -577,14 +577,14 @@ S_camel_to_lower(const char *camel) {
     }
     char *lower = (char*)MALLOCATE(alloc + 1);
 
-    lower[0] = tolower(camel[0]);
+    lower[0] = (char)tolower(camel[0]);
     size_t j = 1;
     for (size_t i = 1; camel[i]; i++) {
         // Only insert underscore if next char is lowercase.
         if (isupper(camel[i]) && islower(camel[i+1])) {
             lower[j++] = '_';
         }
-        lower[j++] = tolower(camel[i]);
+        lower[j++] = (char)tolower(camel[i]);
     }
     lower[j] = '\0';
 
@@ -948,7 +948,7 @@ S_convert_link(cmark_node *link, CFCClass *doc_class, int header_level) {
 
             char *perl_name = CFCUtil_strdup(name);
             for (size_t i = 0; perl_name[i] != '\0'; ++i) {
-                perl_name[i] = tolower(perl_name[i]);
+                perl_name[i] = (char)tolower(perl_name[i]);
             }
 
             // The Perl POD only contains sections for novel methods. Link

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCPerlSub.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlSub.c b/compiler/src/CFCPerlSub.c
index fb50975..2f1d71b 100644
--- a/compiler/src/CFCPerlSub.c
+++ b/compiler/src/CFCPerlSub.c
@@ -51,9 +51,9 @@ CFCPerlSub_init(CFCPerlSub *self, CFCParamList *param_list,
 
     size_t c_name_len = strlen(self->perl_name) + sizeof("XS_") + 1;
     self->c_name = (char*)MALLOCATE(c_name_len);
-    int j = 3;
+    size_t j = 3;
     memcpy(self->c_name, "XS_", j);
-    for (int i = 0, max = (int)strlen(self->perl_name); i < max; i++) {
+    for (size_t i = 0, max = strlen(self->perl_name); i < max; i++) {
         char c = self->perl_name[i];
         if (c == ':') {
             while (self->perl_name[i + 1] == ':') { i++; }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCPyClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPyClass.c b/compiler/src/CFCPyClass.c
index 0fe168e..1e80ebb 100644
--- a/compiler/src/CFCPyClass.c
+++ b/compiler/src/CFCPyClass.c
@@ -204,7 +204,7 @@ S_pytype_struct_def(CFCPyClass *self) {
     char *pymod_name = CFCUtil_strdup(parcel_name);
     // TODO: Stop lowercasing when parcels are restricted to lowercase.
     for (int i = 0; pymod_name[i] != '\0'; i++) {
-        pymod_name[i] = tolower(pymod_name[i]);
+        pymod_name[i] = (char)tolower(pymod_name[i]);
     }
 
     const char *struct_sym = CFCClass_get_struct_sym(klass);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCPyMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPyMethod.c b/compiler/src/CFCPyMethod.c
index 45b0f86..168bfb8 100644
--- a/compiler/src/CFCPyMethod.c
+++ b/compiler/src/CFCPyMethod.c
@@ -50,12 +50,12 @@ S_maybe_unreachable(CFCType *return_type);
 
 static char*
 S_build_py_args(CFCParamList *param_list) {
-    int num_vars = CFCParamList_num_vars(param_list);
+    size_t num_vars = CFCParamList_num_vars(param_list);
     CFCVariable **vars = CFCParamList_get_variables(param_list);
     char pattern[] = "    PyObject *cfcb_ARGS = S_pack_tuple(%d";
     char *py_args = CFCUtil_sprintf(pattern, num_vars - 1);
 
-    for (int i = 1; vars[i] != NULL; i++) {
+    for (size_t i = 1; vars[i] != NULL; i++) {
         const char *var_name = CFCVariable_get_name(vars[i]);
         CFCType *type = CFCVariable_get_type(vars[i]);
         char *conversion = CFCPyTypeMap_c_to_py(type, var_name);
@@ -70,9 +70,9 @@ S_build_py_args(CFCParamList *param_list) {
 static char*
 S_gen_decs(CFCParamList *param_list, int first_tick) {
     char *decs = CFCUtil_strdup("");
-    int num_vars = CFCParamList_num_vars(param_list);
+    size_t num_vars = CFCParamList_num_vars(param_list);
     CFCVariable **vars = CFCParamList_get_variables(param_list);
-    for (int i = first_tick; i < num_vars; i++) {
+    for (int i = first_tick; i < (int)num_vars; i++) {
         CFCType *type = CFCVariable_get_type(vars[i]);
         const char *name = CFCVariable_get_name(vars[i]);
         decs = CFCUtil_cat(decs, "    ", CFCType_to_c(type), " ", name,
@@ -192,7 +192,7 @@ S_gen_arg_parsing(CFCParamList *param_list, int first_tick, char **error) {
 
     CFCVariable **vars = CFCParamList_get_variables(param_list);
     const char **vals = CFCParamList_get_initial_values(param_list);
-    int num_vars = CFCParamList_num_vars(param_list);
+    size_t num_vars = CFCParamList_num_vars(param_list);
 
     char *declarations = CFCUtil_strdup("");
     char *keywords     = CFCUtil_strdup("");
@@ -200,7 +200,7 @@ S_gen_arg_parsing(CFCParamList *param_list, int first_tick, char **error) {
     char *targets      = CFCUtil_strdup("");
     int optional_started = 0;
 
-    for (int i = first_tick; i < num_vars; i++) {
+    for (int i = first_tick; i < (int)num_vars; i++) {
         CFCVariable *var  = vars[i];
         const char  *val  = vals[i];
 
@@ -276,8 +276,8 @@ S_build_pymeth_invocation(CFCMethod *method) {
         if (strlen(ret_type_str) > 63) {
             CFCUtil_die("Unexpectedly long type name: %s", ret_type_str);
         }
-        for (int i = 0, max = strlen(ret_type_str) + 1; i < max; i++) {
-            type_upcase[i] = toupper(ret_type_str[i]);
+        for (size_t i = 0, max = strlen(ret_type_str) + 1; i < max; i++) {
+            type_upcase[i] = (char)toupper(ret_type_str[i]);
         }
         const char pattern[] =
             "    %s cfcb_RESULT = CALL_PYMETH_%s((PyObject*)self, \"%s\", cfcb_ARGS);";
@@ -433,9 +433,9 @@ S_meth_top(CFCMethod *method) {
 static char*
 S_gen_arg_increfs(CFCParamList *param_list, int first_tick) {
     CFCVariable **vars = CFCParamList_get_variables(param_list);
-    int num_vars = CFCParamList_num_vars(param_list);
+    size_t num_vars = CFCParamList_num_vars(param_list);
     char *content = CFCUtil_strdup("");
-    for (int i = first_tick;i < num_vars; i++) {
+    for (size_t i = (size_t)first_tick; i < num_vars; i++) {
         CFCType *type = CFCVariable_get_type(vars[i]);
         if (CFCType_decremented(type)) {
             const char *name = CFCVariable_get_name(vars[i]);
@@ -455,10 +455,10 @@ S_gen_arg_increfs(CFCParamList *param_list, int first_tick) {
 static char*
 S_gen_decrefs(CFCParamList *param_list, int first_tick) {
     CFCVariable **vars = CFCParamList_get_variables(param_list);
-    int num_vars = CFCParamList_num_vars(param_list);
+    size_t num_vars = CFCParamList_num_vars(param_list);
     char *decrefs = CFCUtil_strdup("");
 
-    for (int i = first_tick; i < num_vars; i++) {
+    for (size_t i = (size_t)first_tick; i < num_vars; i++) {
         CFCVariable *var = vars[i];
         CFCType *type = CFCVariable_get_type(var);
         const char *micro_sym = CFCVariable_get_name(var);
@@ -480,9 +480,9 @@ S_gen_decrefs(CFCParamList *param_list, int first_tick) {
 static char*
 S_gen_arg_list(CFCParamList *param_list, const char *first_arg) {
     CFCVariable **vars = CFCParamList_get_variables(param_list);
-    int num_vars = CFCParamList_num_vars(param_list);
+    size_t num_vars = CFCParamList_num_vars(param_list);
     char *arg_list = CFCUtil_strdup("");
-    for (int i = 0; i < num_vars; i++) {
+    for (size_t i = 0; i < num_vars; i++) {
         if (i > 0) {
             arg_list = CFCUtil_cat(arg_list, ", ", NULL);
         }
@@ -646,7 +646,7 @@ CFCPyMethod_pymethoddef(CFCMethod *method, CFCClass *invoker) {
     char *meth_sym = CFCMethod_full_method_sym(method, invoker);
     char *micro_sym = CFCUtil_strdup(CFCSymbol_get_name((CFCSymbol*)method));
     for (int i = 0; micro_sym[i] != 0; i++) {
-        micro_sym[i] = tolower(micro_sym[i]);
+        micro_sym[i] = (char)tolower(micro_sym[i]);
     }
 
     char pattern[] =

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCPython.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPython.c b/compiler/src/CFCPython.c
index 3c60682..0dff7e2 100644
--- a/compiler/src/CFCPython.c
+++ b/compiler/src/CFCPython.c
@@ -447,7 +447,7 @@ S_write_module_file(CFCPython *self, CFCParcel *parcel, const char *dest) {
     char *pymod_name = CFCUtil_strdup(parcel_name);
     // TODO: Stop lowercasing when parcels are restricted to lowercase.
     for (int i = 0; pymod_name[i] != '\0'; i++) {
-        pymod_name[i] = tolower(pymod_name[i]);
+        pymod_name[i] = (char)tolower(pymod_name[i]);
     }
     const char *last_dot = strrchr(pymod_name, '.');
     const char *last_component = last_dot != NULL
@@ -455,7 +455,7 @@ S_write_module_file(CFCPython *self, CFCParcel *parcel, const char *dest) {
                                  : pymod_name;
     char *helper_mod_name = CFCUtil_sprintf("%s._%s", pymod_name, last_component);
     for (int i = 0; helper_mod_name[i] != '\0'; i++) {
-        helper_mod_name[i] = tolower(helper_mod_name[i]);
+        helper_mod_name[i] = (char)tolower(helper_mod_name[i]);
     }
 
     CFCClass  **ordered = CFCHierarchy_ordered_classes(self->hierarchy);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCRuby.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCRuby.c b/compiler/src/CFCRuby.c
index ec3dd9a..0e2c146 100644
--- a/compiler/src/CFCRuby.c
+++ b/compiler/src/CFCRuby.c
@@ -135,7 +135,7 @@ S_write_boot_h(CFCRuby *self) {
     S_replace_double_colons(guard, '_');
     for (char *ptr = guard; *ptr != '\0'; ptr++) {
         if (isalpha(*ptr)) {
-            *ptr = toupper(*ptr);
+            *ptr = (char)toupper(*ptr);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCType.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCType.c b/compiler/src/CFCType.c
index 87f1a85..a45c174 100644
--- a/compiler/src/CFCType.c
+++ b/compiler/src/CFCType.c
@@ -384,7 +384,7 @@ CFCType_get_class_var(CFCType *self) {
     if (!self->class_var) {
         self->class_var = CFCUtil_strdup(self->specifier);
         for (int i = 0; self->class_var[i] != 0; i++) {
-            self->class_var[i] = toupper(self->class_var[i]);
+            self->class_var[i] = (char)toupper(self->class_var[i]);
         }
     }
     return self->class_var;
@@ -410,7 +410,7 @@ CFCType_to_c(CFCType *self) {
         // NOTE: Array postfixes are NOT included.
         const char *child_c_string = CFCType_to_c(self->child);
         size_t      child_c_len    = strlen(child_c_string);
-        size_t      amount         = child_c_len + self->indirection;
+        size_t      amount         = child_c_len + (size_t)self->indirection;
         c_string = (char*)MALLOCATE(amount + 1);
         strcpy(c_string, child_c_string);
         for (int i = 0; i < self->indirection; i++) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCUtil.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c
index 7470c04..f505cac 100644
--- a/compiler/src/CFCUtil.c
+++ b/compiler/src/CFCUtil.c
@@ -16,6 +16,7 @@
 
 #include "charmony.h"
 
+#include <stddef.h>
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -155,32 +156,32 @@ CFCUtil_global_replace(const char *string, const char *match,
     int   len_diff        = replacement_len - match_len;
 
     // Allocate space.
-    unsigned count = 0;
+    int count = 0;
     while (NULL != (found = strstr(found, match))) {
         count++;
         found += match_len;
     }
     int size = string_len + count * len_diff + 1;
-    char *modified = (char*)MALLOCATE(size);
+    char *modified = (char*)MALLOCATE((size_t)size);
     modified[size - 1] = 0; // NULL-terminate.
 
     // Iterate through all matches.
     found = (char*)string;
     char *target = modified;
-    size_t last_end = 0;
+    ptrdiff_t last_end = 0;
     if (count) {
         while (NULL != (found = strstr(found, match))) {
-            size_t pos = found - string;
-            size_t unchanged_len = pos - last_end;
+            ptrdiff_t pos = found - string;
+            ptrdiff_t unchanged_len = pos - last_end;
             found += match_len;
-            memcpy(target, string + last_end, unchanged_len);
+            memcpy(target, string + last_end, (size_t)unchanged_len);
             target += unchanged_len;
             last_end = pos + match_len;
-            memcpy(target, replacement, replacement_len);
+            memcpy(target, replacement, (size_t)replacement_len);
             target += replacement_len;
         }
     }
-    size_t remaining = string_len - last_end;
+    size_t remaining = (size_t)(string_len - last_end);
     memcpy(target, string + string_len - remaining, remaining);
 
     return modified;
@@ -205,7 +206,7 @@ CFCUtil_enclose_lines(const char *text, const char *line_prefix,
     while (line_start < text_end) {
         const char *line_end = strchr(line_start, '\n');
         const char *next_start;
-        size_t      line_len;
+        ptrdiff_t   line_len;
 
         if (line_end == NULL) {
             line_len   = text_end - line_start;
@@ -216,8 +217,8 @@ CFCUtil_enclose_lines(const char *text, const char *line_prefix,
             next_start = line_end + 1;
         }
 
-        char *line = (char*)MALLOCATE(line_len + 1);
-        memcpy(line, line_start, line_len);
+        char *line = (char*)MALLOCATE((size_t)line_len + 1);
+        memcpy(line, line_start, (size_t)line_len);
         line[line_len] = '\0';
         result = CFCUtil_cat(result, line_prefix, line, line_postfix, "\n",
                              NULL);
@@ -353,7 +354,7 @@ CFCUtil_slurp_text(const char *file_path, size_t *len_ptr) {
     }
 
     /* Find length; return NULL if the file has a zero-length. */
-    binary_len = CFCUtil_flength(file);
+    binary_len = (size_t)CFCUtil_flength(file);
     if (binary_len == 0) {
         *len_ptr = 0;
         return NULL;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/91f00051/compiler/src/CFCVersion.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCVersion.c b/compiler/src/CFCVersion.c
index 671ff36..97727a8 100644
--- a/compiler/src/CFCVersion.c
+++ b/compiler/src/CFCVersion.c
@@ -60,7 +60,8 @@ CFCVersion_init(CFCVersion *self, const char *vstring) {
     self->numbers = (uint32_t*)CALLOCATE(1, sizeof(uint32_t));
     while (1) {
         if (isdigit(*vstring)) {
-            num = num * 10 + *vstring - '0';
+            int digit = *vstring - '0';
+            num = num * 10 + (uint32_t)digit;
         }
         else {
             if (*vstring != 0 && *vstring != '.') {


[02/14] lucy-clownfish git commit: Better Python include dirs for Python.h.

Posted by ma...@apache.org.
Better Python include dirs for Python.h.

Getting the include dir from `distutils.sysconfig` seems to be more
reliable than `sysconfig`.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/b71d2dbd
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/b71d2dbd
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/b71d2dbd

Branch: refs/heads/master
Commit: b71d2dbd60bcef59153fce949b9f519b64c297f7
Parents: bf4723f
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed Mar 16 00:21:05 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 21:42:28 2016 -0700

----------------------------------------------------------------------
 runtime/python/setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b71d2dbd/runtime/python/setup.py
----------------------------------------------------------------------
diff --git a/runtime/python/setup.py b/runtime/python/setup.py
index 2e89dd2..fa184ef 100644
--- a/runtime/python/setup.py
+++ b/runtime/python/setup.py
@@ -39,7 +39,7 @@ def ext_build_dir(base):
 # CFLAGS.  Add the Python headers include dir to CFLAGS.
 compiler = distutils.ccompiler.new_compiler()
 cflags = sysconfig.get_config_var('CFLAGS')
-cflags = cflags + " -I" + sysconfig.get_path('include')
+cflags = cflags + " -I" + distutils.sysconfig.get_python_inc()
 compiler_type = distutils.ccompiler.get_default_compiler()
 
 # There's no public way to get a string representing the compiler executable


[10/14] lucy-clownfish git commit: Address int warnings in core tests.

Posted by ma...@apache.org.
Address int warnings in core tests.

Fix warnings from `-Wconversion`.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/0f6fdb45
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/0f6fdb45
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/0f6fdb45

Branch: refs/heads/master
Commit: 0f6fdb45b9ad0f60391dcb81e0e7d05f83aeada7
Parents: e37b154
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 01:58:57 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 runtime/core/Clownfish/Test/TestBlob.c          |  4 +-
 runtime/core/Clownfish/Test/TestByteBuf.c       |  8 ++--
 runtime/core/Clownfish/Test/TestHash.c          | 22 ++++-----
 .../core/Clownfish/Test/TestLockFreeRegistry.c  |  2 +-
 runtime/core/Clownfish/Test/TestNum.c           |  2 +-
 runtime/core/Clownfish/Test/TestString.c        | 50 ++++++++++----------
 runtime/core/Clownfish/Test/TestVector.c        | 34 ++++++-------
 runtime/core/Clownfish/Test/Util/TestMemory.c   | 20 ++++----
 .../core/Clownfish/Test/Util/TestStringHelper.c | 12 ++---
 9 files changed, 77 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestBlob.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestBlob.c b/runtime/core/Clownfish/Test/TestBlob.c
index 9307f5f..c8c70c3 100644
--- a/runtime/core/Clownfish/Test/TestBlob.c
+++ b/runtime/core/Clownfish/Test/TestBlob.c
@@ -49,8 +49,8 @@ test_Equals(TestBatchRunner *runner) {
 
     {
         Blob *other = Blob_new("bar", 4);
-        TEST_INT_EQ(runner, Blob_Get_Size(blob), Blob_Get_Size(other),
-                    "same length");
+        TEST_UINT_EQ(runner, Blob_Get_Size(blob), Blob_Get_Size(other),
+                     "same length");
         TEST_FALSE(runner, Blob_Equals(blob, (Obj*)other),
                    "Different content spoils Equals");
         DECREF(other);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestByteBuf.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestByteBuf.c b/runtime/core/Clownfish/Test/TestByteBuf.c
index 6e8063c..bc29bb1 100644
--- a/runtime/core/Clownfish/Test/TestByteBuf.c
+++ b/runtime/core/Clownfish/Test/TestByteBuf.c
@@ -59,8 +59,8 @@ test_Equals(TestBatchRunner *runner) {
 
     {
         ByteBuf *other = BB_new_bytes("bar", 4);
-        TEST_INT_EQ(runner, BB_Get_Size(bb), BB_Get_Size(other),
-                    "same length");
+        TEST_UINT_EQ(runner, BB_Get_Size(bb), BB_Get_Size(other),
+                     "same length");
         TEST_FALSE(runner, BB_Equals(bb, (Obj*)other),
                    "Different content spoils Equals");
         DECREF(other);
@@ -72,10 +72,10 @@ test_Equals(TestBatchRunner *runner) {
 static void
 test_Grow(TestBatchRunner *runner) {
     ByteBuf *bb = BB_new(1);
-    TEST_INT_EQ(runner, BB_Get_Capacity(bb), 8,
+    TEST_UINT_EQ(runner, BB_Get_Capacity(bb), 8,
                 "Allocate in 8-byte increments");
     BB_Grow(bb, 9);
-    TEST_INT_EQ(runner, BB_Get_Capacity(bb), 16,
+    TEST_UINT_EQ(runner, BB_Get_Capacity(bb), 16,
                 "Grow in 8-byte increments");
     DECREF(bb);
 }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestHash.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestHash.c b/runtime/core/Clownfish/Test/TestHash.c
index c5c9c1f..e77c816 100644
--- a/runtime/core/Clownfish/Test/TestHash.c
+++ b/runtime/core/Clownfish/Test/TestHash.c
@@ -80,8 +80,8 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
     }
     TEST_TRUE(runner, Hash_Equals(hash, (Obj*)dupe), "Equals");
 
-    TEST_INT_EQ(runner, Hash_Get_Capacity(hash), starting_cap,
-                "Initial capacity sufficient (no rebuilds)");
+    TEST_UINT_EQ(runner, Hash_Get_Capacity(hash), starting_cap,
+                 "Initial capacity sufficient (no rebuilds)");
 
     for (size_t i = 0; i < 100; i++) {
         String *key  = (String*)Vec_Fetch(expected, i);
@@ -91,8 +91,8 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
 
     TEST_TRUE(runner, Vec_Equals(got, (Obj*)expected),
               "basic Store and Fetch");
-    TEST_INT_EQ(runner, Hash_Get_Size(hash), 100,
-                "size incremented properly by Hash_Store");
+    TEST_UINT_EQ(runner, Hash_Get_Size(hash), 100,
+                 "size incremented properly by Hash_Store");
 
     TEST_TRUE(runner, Hash_Fetch(hash, foo) == NULL,
               "Fetch against non-existent key returns NULL");
@@ -103,18 +103,18 @@ test_Store_and_Fetch(TestBatchRunner *runner) {
               "Hash_Store replaces existing value");
     TEST_FALSE(runner, Hash_Equals(hash, (Obj*)dupe),
                "replacement value spoils equals");
-    TEST_INT_EQ(runner, Hash_Get_Size(hash), 100,
-                "size unaffected after value replaced");
+    TEST_UINT_EQ(runner, Hash_Get_Size(hash), 100,
+                 "size unaffected after value replaced");
 
     TEST_TRUE(runner, Hash_Delete(hash, forty) == stored_foo,
               "Delete returns value");
     DECREF(stored_foo);
-    TEST_INT_EQ(runner, Hash_Get_Size(hash), 99,
-                "size decremented by successful Delete");
+    TEST_UINT_EQ(runner, Hash_Get_Size(hash), 99,
+                 "size decremented by successful Delete");
     TEST_TRUE(runner, Hash_Delete(hash, forty) == NULL,
               "Delete returns NULL when key not found");
-    TEST_INT_EQ(runner, Hash_Get_Size(hash), 99,
-                "size not decremented by unsuccessful Delete");
+    TEST_UINT_EQ(runner, Hash_Get_Size(hash), 99,
+                 "size not decremented by unsuccessful Delete");
     DECREF(Hash_Delete(dupe, forty));
     TEST_TRUE(runner, Vec_Equals(got, (Obj*)expected), "Equals after Delete");
 
@@ -236,7 +236,7 @@ test_store_skips_tombstone(TestBatchRunner *runner) {
     Hash_Delete(hash, one);
     Hash_Store(hash, two, (Obj*)CFISH_TRUE);
 
-    TEST_INT_EQ(runner, Hash_Get_Size(hash), 1, "Store skips tombstone");
+    TEST_UINT_EQ(runner, Hash_Get_Size(hash), 1, "Store skips tombstone");
 
     DECREF(one);
     DECREF(two);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestLockFreeRegistry.c b/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
index 4b0fe1b..b70ff1f 100644
--- a/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
+++ b/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
@@ -123,7 +123,7 @@ test_threads(TestBatchRunner *runner) {
 
         // Fisher-Yates shuffle.
         for (uint32_t j = num_objs - 1; j > 0; j--) {
-            uint32_t r = TestUtils_random_u64() % (j + 1);
+            uint32_t r = (uint32_t)TestUtils_random_u64() % (j + 1);
             uint32_t tmp = nums[j];
             nums[j] = nums[r];
             nums[r] = tmp;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestNum.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestNum.c b/runtime/core/Clownfish/Test/TestNum.c
index 0e88455..0864cd7 100644
--- a/runtime/core/Clownfish/Test/TestNum.c
+++ b/runtime/core/Clownfish/Test/TestNum.c
@@ -178,7 +178,7 @@ test_Equals_and_Compare_To(TestBatchRunner *runner) {
     // NOTICE: When running these tests on x86/x64, it's best to compile
     // with -ffloat-store to avoid excess FPU precision which can hide
     // implementation bugs.
-    S_test_compare_float_int(runner, INT64_MAX * 2.0, INT64_MAX, 1);
+    S_test_compare_float_int(runner, (double)INT64_MAX * 2.0, INT64_MAX, 1);
     S_test_compare_float_int(runner, pow(2.0, 60.0), INT64_C(1) << 60, 0);
     S_test_compare_float_int(runner, pow(2.0, 60.0), (INT64_C(1) << 60) - 1,
                              1);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestString.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestString.c b/runtime/core/Clownfish/Test/TestString.c
index 64d686c..46b50c8 100644
--- a/runtime/core/Clownfish/Test/TestString.c
+++ b/runtime/core/Clownfish/Test/TestString.c
@@ -35,7 +35,7 @@
 #define SMILEY "\xE2\x98\xBA"
 static char smiley[] = { (char)0xE2, (char)0x98, (char)0xBA, 0 };
 static uint32_t smiley_len = 3;
-static uint32_t smiley_cp  = 0x263A;
+static int32_t smiley_cp  = 0x263A;
 
 TestString*
 TestStr_new() {
@@ -49,19 +49,19 @@ S_get_str(const char *string) {
 
 // Surround a smiley with lots of whitespace.
 static String*
-S_smiley_with_whitespace(int *num_spaces_ptr) {
+S_smiley_with_whitespace(size_t *num_spaces_ptr) {
     int32_t spaces[] = {
         ' ',    '\t',   '\r',   '\n',   0x000B, 0x000C, 0x000D, 0x0085,
         0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005,
         0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F,
         0x205F, 0x3000
     };
-    int num_spaces = sizeof(spaces) / sizeof(uint32_t);
+    size_t num_spaces = sizeof(spaces) / sizeof(uint32_t);
 
     CharBuf *buf = CB_new(0);
-    for (int i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
+    for (size_t i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
     CB_Cat_Char(buf, smiley_cp);
-    for (int i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
+    for (size_t i = 0; i < num_spaces; i++) { CB_Cat_Char(buf, spaces[i]); }
 
     String *retval = CB_To_String(buf);
     if (num_spaces_ptr) { *num_spaces_ptr = num_spaces; }
@@ -386,7 +386,7 @@ test_To_ByteBuf(TestBatchRunner *runner) {
 static void
 test_Length(TestBatchRunner *runner) {
     String *string = Str_newf("a%s%sb%sc", smiley, smiley, smiley);
-    TEST_INT_EQ(runner, Str_Length(string), 6, "Length");
+    TEST_UINT_EQ(runner, Str_Length(string), 6, "Length");
     DECREF(string);
 }
 
@@ -465,7 +465,7 @@ test_Get_Ptr8(TestBatchRunner *runner) {
     TEST_TRUE(runner, strcmp(ptr8, "Banana") == 0, "Get_Ptr8");
 
     size_t size = Str_Get_Size(string);
-    TEST_INT_EQ(runner, size, 6, "Get_Size");
+    TEST_UINT_EQ(runner, size, 6, "Get_Size");
 
     DECREF(string);
 }
@@ -580,21 +580,21 @@ test_iterator(TestBatchRunner *runner) {
         StringIterator *iter = Str_Top(string);
 
         StrIter_Next(iter);
-        TEST_INT_EQ(runner, StrIter_Advance(iter, 2), 2,
-                    "Advance returns number of code points");
+        TEST_UINT_EQ(runner, StrIter_Advance(iter, 2), 2,
+                     "Advance returns number of code points");
         TEST_INT_EQ(runner, StrIter_Next(iter), code_points[3],
                     "Advance works");
-        TEST_INT_EQ(runner,
-                    StrIter_Advance(iter, 1000000), num_code_points - 4,
-                    "Advance past end of string");
+        TEST_UINT_EQ(runner,
+                     StrIter_Advance(iter, 1000000), num_code_points - 4,
+                     "Advance past end of string");
 
         StrIter_Prev(iter);
-        TEST_INT_EQ(runner, StrIter_Recede(iter, 2), 2,
-                    "Recede returns number of code points");
+        TEST_UINT_EQ(runner, StrIter_Recede(iter, 2), 2,
+                     "Recede returns number of code points");
         TEST_INT_EQ(runner, StrIter_Prev(iter), code_points[num_code_points-4],
                     "Recede works");
-        TEST_INT_EQ(runner, StrIter_Recede(iter, 1000000), num_code_points - 4,
-                    "Recede past start of string");
+        TEST_UINT_EQ(runner, StrIter_Recede(iter, 1000000), num_code_points - 4,
+                     "Recede past start of string");
 
         DECREF(iter);
     }
@@ -605,24 +605,24 @@ test_iterator(TestBatchRunner *runner) {
 
 static void
 test_iterator_whitespace(TestBatchRunner *runner) {
-    int num_spaces;
+    size_t num_spaces;
     String *ws_smiley = S_smiley_with_whitespace(&num_spaces);
 
     {
         StringIterator *iter = Str_Top(ws_smiley);
-        TEST_INT_EQ(runner, StrIter_Skip_Whitespace(iter), num_spaces,
-                    "Skip_Whitespace");
-        TEST_INT_EQ(runner, StrIter_Skip_Whitespace(iter), 0,
-                    "Skip_Whitespace without whitespace");
+        TEST_UINT_EQ(runner, StrIter_Skip_Whitespace(iter), num_spaces,
+                     "Skip_Whitespace");
+        TEST_UINT_EQ(runner, StrIter_Skip_Whitespace(iter), 0,
+                     "Skip_Whitespace without whitespace");
         DECREF(iter);
     }
 
     {
         StringIterator *iter = Str_Tail(ws_smiley);
-        TEST_INT_EQ(runner, StrIter_Skip_Whitespace_Back(iter), num_spaces,
-                    "Skip_Whitespace_Back");
-        TEST_INT_EQ(runner, StrIter_Skip_Whitespace_Back(iter), 0,
-                    "Skip_Whitespace_Back without whitespace");
+        TEST_UINT_EQ(runner, StrIter_Skip_Whitespace_Back(iter), num_spaces,
+                     "Skip_Whitespace_Back");
+        TEST_UINT_EQ(runner, StrIter_Skip_Whitespace_Back(iter), 0,
+                     "Skip_Whitespace_Back without whitespace");
         DECREF(iter);
     }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/TestVector.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestVector.c b/runtime/core/Clownfish/Test/TestVector.c
index a2a0a1e..d032360 100644
--- a/runtime/core/Clownfish/Test/TestVector.c
+++ b/runtime/core/Clownfish/Test/TestVector.c
@@ -117,7 +117,7 @@ test_Store_Fetch(TestBatchRunner *runner) {
 
     Vec_Store(array, 2, (Obj*)Str_newf("foo"));
     elem = (String*)CERTIFY(Vec_Fetch(array, 2), STRING);
-    TEST_INT_EQ(runner, 3, Vec_Get_Size(array), "Store updates size");
+    TEST_UINT_EQ(runner, 3, Vec_Get_Size(array), "Store updates size");
     TEST_TRUE(runner, Str_Equals_Utf8(elem, "foo", 3), "Store");
 
     elem = (String*)INCREF(elem);
@@ -135,7 +135,7 @@ test_Store_Fetch(TestBatchRunner *runner) {
     array = S_array_with_garbage();
     Vec_Store(array, 40, (Obj*)CFISH_TRUE);
     bool all_null = true;
-    for (int i = 10; i < 40; i++) {
+    for (size_t i = 10; i < 40; i++) {
         if (Vec_Fetch(array, i) != NULL) { all_null = false; }
     }
     TEST_TRUE(runner, all_null, "Out-of-bounds Store clears excised elements");
@@ -147,7 +147,7 @@ test_Push_Pop_Insert(TestBatchRunner *runner) {
     Vector *array = Vec_new(0);
     String *elem;
 
-    TEST_INT_EQ(runner, Vec_Get_Size(array), 0, "size starts at 0");
+    TEST_UINT_EQ(runner, Vec_Get_Size(array), 0, "size starts at 0");
     TEST_TRUE(runner, Vec_Pop(array) == NULL,
               "Pop from empty array returns NULL");
 
@@ -155,34 +155,34 @@ test_Push_Pop_Insert(TestBatchRunner *runner) {
     Vec_Push(array, (Obj*)Str_newf("b"));
     Vec_Push(array, (Obj*)Str_newf("c"));
 
-    TEST_INT_EQ(runner, Vec_Get_Size(array), 3, "size after Push");
+    TEST_UINT_EQ(runner, Vec_Get_Size(array), 3, "size after Push");
     TEST_TRUE(runner, NULL != CERTIFY(Vec_Fetch(array, 2), STRING), "Push");
 
     elem = (String*)CERTIFY(Vec_Pop(array), STRING);
     TEST_TRUE(runner, Str_Equals_Utf8(elem, "c", 1), "Pop");
-    TEST_INT_EQ(runner, Vec_Get_Size(array), 2, "size after Pop");
+    TEST_UINT_EQ(runner, Vec_Get_Size(array), 2, "size after Pop");
     DECREF(elem);
 
     Vec_Insert(array, 0, (Obj*)Str_newf("foo"));
     elem = (String*)CERTIFY(Vec_Fetch(array, 0), STRING);
     TEST_TRUE(runner, Str_Equals_Utf8(elem, "foo", 3), "Insert");
-    TEST_INT_EQ(runner, Vec_Get_Size(array), 3, "size after Insert");
+    TEST_UINT_EQ(runner, Vec_Get_Size(array), 3, "size after Insert");
 
     for (int i = 0; i < 256; ++i) {
         Vec_Push(array, (Obj*)Str_newf("flotsam"));
     }
-    for (int i = 0; i < 512; ++i) {
+    for (size_t i = 0; i < 512; ++i) {
         Vec_Insert(array, i, (Obj*)Str_newf("jetsam"));
     }
-    TEST_INT_EQ(runner, Vec_Get_Size(array), 3 + 256 + 512,
-                "size after exercising Push and Insert");
+    TEST_UINT_EQ(runner, Vec_Get_Size(array), 3 + 256 + 512,
+                 "size after exercising Push and Insert");
 
     DECREF(array);
 }
 
 static void
 test_Insert_All(TestBatchRunner *runner) {
-    size_t i;
+    int64_t i;
 
     {
         Vector *dst    = Vec_new(20);
@@ -211,7 +211,7 @@ test_Insert_All(TestBatchRunner *runner) {
         for (i = 0; i < 10; i++) { Vec_Push(src, (Obj*)Int_new(i + 20)); }
         for (i = 0; i < 10; i++) { Vec_Push(wanted, (Obj*)Int_new(i)); }
         for (i = 0; i < 10; i++) {
-            Vec_Store(wanted, i + 20, (Obj*)Int_new(i + 20));
+            Vec_Store(wanted, (size_t)i + 20, (Obj*)Int_new(i + 20));
         }
 
         Vec_Insert_All(dst, 20, src);
@@ -250,26 +250,26 @@ test_Resize(TestBatchRunner *runner) {
     uint32_t i;
 
     for (i = 0; i < 2; i++) { Vec_Push(array, (Obj*)Str_newf("%u32", i)); }
-    TEST_INT_EQ(runner, Vec_Get_Capacity(array), 3, "Start with capacity 3");
+    TEST_UINT_EQ(runner, Vec_Get_Capacity(array), 3, "Start with capacity 3");
 
     Vec_Resize(array, 4);
-    TEST_INT_EQ(runner, Vec_Get_Size(array), 4, "Resize up");
-    TEST_INT_EQ(runner, Vec_Get_Capacity(array), 4,
+    TEST_UINT_EQ(runner, Vec_Get_Size(array), 4, "Resize up");
+    TEST_UINT_EQ(runner, Vec_Get_Capacity(array), 4,
                 "Resize changes capacity");
 
     Vec_Resize(array, 2);
-    TEST_INT_EQ(runner, Vec_Get_Size(array), 2, "Resize down");
+    TEST_UINT_EQ(runner, Vec_Get_Size(array), 2, "Resize down");
     TEST_TRUE(runner, Vec_Fetch(array, 2) == NULL, "Resize down zaps elem");
 
     Vec_Resize(array, 2);
-    TEST_INT_EQ(runner, Vec_Get_Size(array), 2, "Resize to same size");
+    TEST_UINT_EQ(runner, Vec_Get_Size(array), 2, "Resize to same size");
 
     DECREF(array);
 
     array = S_array_with_garbage();
     Vec_Resize(array, 40);
     bool all_null = true;
-    for (int i = 10; i < 40; i++) {
+    for (size_t i = 10; i < 40; i++) {
         if (Vec_Fetch(array, i) != NULL) { all_null = false; }
     }
     TEST_TRUE(runner, all_null, "Resize clears excised elements");

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/Util/TestMemory.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/Util/TestMemory.c b/runtime/core/Clownfish/Test/Util/TestMemory.c
index 9bab8d4..2800708 100644
--- a/runtime/core/Clownfish/Test/Util/TestMemory.c
+++ b/runtime/core/Clownfish/Test/Util/TestMemory.c
@@ -68,38 +68,38 @@ test_oversize__growth_rate(TestBatchRunner *runner) {
                   average_growth_rate);
     }
 
-    for (int minimum = 1; minimum < 8; minimum++) {
+    for (size_t minimum = 1; minimum < 8; minimum++) {
         uint64_t next_size = Memory_oversize(minimum, sizeof(void*));
         double growth_rate = CHY_U64_TO_DOUBLE(next_size) / (double)minimum;
         TEST_TRUE(runner, growth_rate > 1.2,
-                  "Growth rate is higher for smaller arrays (%d, %.3f)", minimum,
-                  growth_rate);
+                  "Growth rate is higher for smaller arrays (%u, %.3f)",
+                  (unsigned)minimum, growth_rate);
     }
 }
 
 static void
 test_oversize__ceiling(TestBatchRunner *runner) {
-    for (int width = 0; width < 10; width++) {
+    for (unsigned width = 0; width < 10; width++) {
         size_t size = Memory_oversize(SIZE_MAX, width);
         TEST_TRUE(runner, size == SIZE_MAX,
-                  "Memory_oversize hits ceiling at SIZE_MAX (width %d)", width);
+                  "Memory_oversize hits ceiling at SIZE_MAX (width %u)", width);
         size = Memory_oversize(SIZE_MAX - 1, width);
         TEST_TRUE(runner, size == SIZE_MAX,
-                  "Memory_oversize hits ceiling at SIZE_MAX (width %d)", width);
+                  "Memory_oversize hits ceiling at SIZE_MAX (width %u)", width);
     }
 }
 
 static void
 test_oversize__rounding(TestBatchRunner *runner) {
-    int widths[] = { 1, 2, 4, 0 };
+    unsigned widths[] = { 1, 2, 4, 0 };
 
     for (int width_tick = 0; widths[width_tick] != 0; width_tick++) {
-        int width = widths[width_tick];
-        for (int i = 0; i < 25; i++) {
+        unsigned width = widths[width_tick];
+        for (unsigned i = 0; i < 25; i++) {
             size_t size = Memory_oversize(i, width);
             size_t bytes = size * width;
             if (bytes % sizeof(void*) != 0) {
-                FAIL(runner, "Rounding failure for %d, width %d",
+                FAIL(runner, "Rounding failure for %u, width %u",
                      i, width);
                 return;
             }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f6fdb45/runtime/core/Clownfish/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/Util/TestStringHelper.c b/runtime/core/Clownfish/Test/Util/TestStringHelper.c
index b26dc24..64529d4 100644
--- a/runtime/core/Clownfish/Test/Util/TestStringHelper.c
+++ b/runtime/core/Clownfish/Test/Util/TestStringHelper.c
@@ -130,17 +130,17 @@ static void
 test_overlap(TestBatchRunner *runner) {
     size_t result;
     result = StrHelp_overlap("", "", 0, 0);
-    TEST_INT_EQ(runner, result, 0, "two empty strings");
+    TEST_UINT_EQ(runner, result, 0, "two empty strings");
     result = StrHelp_overlap("", "foo", 0, 3);
-    TEST_INT_EQ(runner, result, 0, "first string is empty");
+    TEST_UINT_EQ(runner, result, 0, "first string is empty");
     result = StrHelp_overlap("foo", "", 3, 0);
-    TEST_INT_EQ(runner, result, 0, "second string is empty");
+    TEST_UINT_EQ(runner, result, 0, "second string is empty");
     result = StrHelp_overlap("foo", "foo", 3, 3);
-    TEST_INT_EQ(runner, result, 3, "equal strings");
+    TEST_UINT_EQ(runner, result, 3, "equal strings");
     result = StrHelp_overlap("foo bar", "foo", 7, 3);
-    TEST_INT_EQ(runner, result, 3, "first string is longer");
+    TEST_UINT_EQ(runner, result, 3, "first string is longer");
     result = StrHelp_overlap("foo", "foo bar", 3, 7);
-    TEST_INT_EQ(runner, result, 3, "second string is longer");
+    TEST_UINT_EQ(runner, result, 3, "second string is longer");
 }
 
 


[13/14] lucy-clownfish git commit: Fix compiler warning in Py CFC.

Posted by ma...@apache.org.
Fix compiler warning in Py CFC.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/d8eb00c4
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/d8eb00c4
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/d8eb00c4

Branch: refs/heads/master
Commit: d8eb00c49fa63605f5e423e89a8c0f739316a59b
Parents: 0f6fdb4
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 02:16:04 2016 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 compiler/python/src/cfc/_cfc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/d8eb00c4/compiler/python/src/cfc/_cfc.c
----------------------------------------------------------------------
diff --git a/compiler/python/src/cfc/_cfc.c b/compiler/python/src/cfc/_cfc.c
index 0f6c882..e7e8f3f 100644
--- a/compiler/python/src/cfc/_cfc.c
+++ b/compiler/python/src/cfc/_cfc.c
@@ -177,7 +177,7 @@ static PyObject*
 S_CFCHierarchy_get_dest(PyObject *wrapper, PyObject *unused) {
     CHY_UNUSED_VAR(unused);
     const char *dest = CFCHierarchy_get_dest(S_to_Hierarchy(wrapper));
-    return PyUnicode_DecodeASCII(dest, strlen(dest), NULL);
+    return PyUnicode_DecodeASCII(dest, (Py_ssize_t)strlen(dest), NULL);
 }
 
 static PyObject*


[11/14] lucy-clownfish git commit: Fix conv warnings in CFC test suite.

Posted by ma...@apache.org.
Fix conv warnings in CFC test suite.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/9b7678b1
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/9b7678b1
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/9b7678b1

Branch: refs/heads/master
Commit: 9b7678b10f06f4ebe320ca8a14012d2291554e0c
Parents: 9d3aef8
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 22:31:29 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 compiler/src/CFCTestParamList.c | 4 ++--
 compiler/src/CFCTestParser.c    | 6 +++---
 compiler/src/CFCTestUtil.c      | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9b7678b1/compiler/src/CFCTestParamList.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestParamList.c b/compiler/src/CFCTestParamList.c
index 9dab0b8..5a375af 100644
--- a/compiler/src/CFCTestParamList.c
+++ b/compiler/src/CFCTestParamList.c
@@ -60,7 +60,7 @@ S_run_tests(CFCTest *test) {
         OK(test, CFCParamList_variadic(param_list), "variadic");
         STR_EQ(test, CFCParamList_to_c(param_list),
                "neato_Obj* self, int num, ...", "to_c");
-        INT_EQ(test, CFCParamList_num_vars(param_list), 2, "num_vars");
+        UINT_EQ(test, CFCParamList_num_vars(param_list), 2, "num_vars");
         const char **initial_values
             = CFCParamList_get_initial_values(param_list);
         STR_EQ(test, initial_values[0], "NULL", "initial_values[0]"); 
@@ -78,7 +78,7 @@ S_run_tests(CFCTest *test) {
             = CFCTest_parse_param_list(test, parser, "()");
         CFCParamList_resolve_types(param_list);
         STR_EQ(test, CFCParamList_to_c(param_list), "void", "to_c");
-        INT_EQ(test, CFCParamList_num_vars(param_list), 0, "num_vars");
+        UINT_EQ(test, CFCParamList_num_vars(param_list), 0, "num_vars");
         CFCVariable **variables = CFCParamList_get_variables(param_list);
         OK(test, variables[0] == NULL, "get_variables");
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9b7678b1/compiler/src/CFCTestParser.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestParser.c b/compiler/src/CFCTestParser.c
index 057d5d9..2219dba 100644
--- a/compiler/src/CFCTestParser.c
+++ b/compiler/src/CFCTestParser.c
@@ -228,12 +228,12 @@ S_run_tests(CFCTest *test) {
             "(int foo)",
             "(Obj *foo, Foo **foo_ptr)"
         };
-        for (int i = 0; i < 3; ++i) {
+        for (size_t i = 0; i < 3; ++i) {
             const char *param_list_string = param_list_strings[i];
             CFCParamList *param_list
                 = CFCTest_parse_param_list(test, parser, param_list_string);
-            INT_EQ(test, CFCParamList_num_vars(param_list), i,
-                   "param list num_vars: %d", i);
+            UINT_EQ(test, CFCParamList_num_vars(param_list), i,
+                    "param list num_vars: %u", (unsigned)i);
             CFCBase_decref((CFCBase*)param_list);
         }
     }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9b7678b1/compiler/src/CFCTestUtil.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestUtil.c b/compiler/src/CFCTestUtil.c
index fd431e3..77e7c7b 100644
--- a/compiler/src/CFCTestUtil.c
+++ b/compiler/src/CFCTestUtil.c
@@ -76,7 +76,7 @@ S_run_file_tests(CFCTest *test) {
         OK(test, file != NULL, "can open file");
         char buf[10];
         size_t chars_read = fread(buf, 1, 10, file);
-        INT_EQ(test, chars_read, 3, "read correct number of chars");
+        UINT_EQ(test, chars_read, 3, "read correct number of chars");
         OK(test, memcmp(buf, "foo", 3) == 0, "read correct string");
 
         long file_length = CFCUtil_flength(file);
@@ -88,7 +88,7 @@ S_run_file_tests(CFCTest *test) {
     {
         size_t content_len;
         char *content = CFCUtil_slurp_text(foo_txt, &content_len);
-        INT_EQ(test, content_len, 3, "slurp_text len");
+        UINT_EQ(test, content_len, 3, "slurp_text len");
         OK(test, memcmp(content, "foo", 3) == 0, "slurp_text content");
         FREEMEM(content);
     }