[macruby-changes] [4372] MacRuby/trunk/bs.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 22 14:44:24 PDT 2010


Revision: 4372
          http://trac.macosforge.org/projects/ruby/changeset/4372
Author:   lsansonetti at apple.com
Date:     2010-07-22 14:44:23 -0700 (Thu, 22 Jul 2010)
Log Message:
-----------
make sure 64-bit only functions are ignored when running in 32-bit (fixes <rdar://problem/8220694>)

Modified Paths:
--------------
    MacRuby/trunk/bs.c

Modified: MacRuby/trunk/bs.c
===================================================================
--- MacRuby/trunk/bs.c	2010-07-21 07:00:57 UTC (rev 4371)
+++ MacRuby/trunk/bs.c	2010-07-22 21:44:23 UTC (rev 4372)
@@ -165,17 +165,20 @@
 }
 
 static inline char *
+get_type64_attribute(xmlTextReaderPtr reader)
+{
+  return (char *)xmlTextReaderGetAttribute(reader, (xmlChar *)"type64");
+}
+
+static inline char *
 get_type_attribute(xmlTextReaderPtr reader)
 {
-  xmlChar * value;
-
 #if __LP64__
-  value = xmlTextReaderGetAttribute(reader, (xmlChar *)"type64");
-  if (value == NULL)
+  char *value = get_type64_attribute(reader);
+  if (value != NULL)
+    return value;
 #endif
-  value = xmlTextReaderGetAttribute(reader, (xmlChar *)"type");
-
-  return (char *)value;
+  return (char *)xmlTextReaderGetAttribute(reader, (xmlChar *)"type");
 }
 
 static void
@@ -959,6 +962,14 @@
               }
               else {
                 free(bs_retval);
+#if !defined(__LP64__)
+		if (get_type64_attribute(reader) != NULL) {
+		    // The function has no 32-bit return value type and we
+		    // run in 32-bit mode. We just ignore it.
+		    func = NULL;
+		    break;
+		}
+#endif
                 BAIL("function '%s' return value defined without type", 
                      func->name);
               }
@@ -1139,7 +1150,10 @@
         }
  
         case BS_XML_FUNCTION: 
-        { 
+        {
+          if (func == NULL) {
+            break;
+          }
           for (i = 0; i < func->args_count; i++) {
             if (args[i].type == NULL)
               BAIL("function '%s' argument #%d type not provided", 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100722/0abc58c6/attachment.html>


More information about the macruby-changes mailing list