Hiroshi Nakamura <nakahiro / gmail.com> wrote:
> I re-apply r33078 and additional fixes at r33147. I tested it against
> Rails 3.1.0 and confirmed that it passes all of full tests except
> PG/MySQL/SQLite things which I don't installed properly.
> 
> Please evaluate it!

I got the following with r33147 on gcc (Debian 4.6.1-4) 4.6.1:

../variable.c: In function °∆autoload_defined_p°«:
../variable.c:1613:5: error: implicit declaration of function °∆rb_autoloading_value°« [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

Moving the definition of autoload_defined_p() after the definition of
rb_autoloading_value() trivially fixes my build:

--- a/variable.c
+++ b/variable.c
@@ -1601,18 +1601,6 @@ check_autoload_required(VALUE mod, ID id, const char **loadingpath)
     return 0;
 }
 
-static int
-autoload_defined_p(VALUE mod, ID id)
-{
-    struct st_table *tbl = RCLASS_CONST_TBL(mod);
-    st_data_t val;
-
-    if (!tbl || !st_lookup(tbl, (st_data_t)id, &val) || ((rb_const_entry_t*)val)->value != Qundef) {
-	return 0;
-    }
-    return !rb_autoloading_value(mod, id, NULL);
-}
-
 int
 rb_autoloading_value(VALUE mod, ID id, VALUE* value)
 {
@@ -1633,6 +1621,18 @@ rb_autoloading_value(VALUE mod, ID id, VALUE* value)
     return 0;
 }
 
+static int
+autoload_defined_p(VALUE mod, ID id)
+{
+    struct st_table *tbl = RCLASS_CONST_TBL(mod);
+    st_data_t val;
+
+    if (!tbl || !st_lookup(tbl, (st_data_t)id, &val) || ((rb_const_entry_t*)val)->value != Qundef) {
+	return 0;
+    }
+    return !rb_autoloading_value(mod, id, NULL);
+}
+
 struct autoload_const_set_args {
     VALUE mod;
     ID id;
-- 
Eric Wong