ObjC/ObjC++: Fix property encoding on Apple

Nicola Pero nicola.pero@meta-innovation.com
Fri Mar 4 19:09:00 GMT 2011


On 4 Mar 2011, at 16:41, Dominique Dhumieres wrote:

> Nicola,
>
> obj-c++.dg/property/property-encoding-1.mm fails to compile with:  
> [...]
> You need to use the right C++ incantations, [...]

Apologies.  I now did the obvious changes that should make it work in  
both the ObjC
and ObjC++ testsuites, and committed them as obvious.

Please let me know if it still doesn't work!

Thanks

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 170682)
+++ ChangeLog   (working copy)
@@ -1,5 +1,10 @@
  2011-03-04  Nicola Pero  <nicola.pero@meta-innovation.com>

+       * objc.dg/property/property-encoding-1.m: Tidied up testcase.
+       * obj-c++.dg/property/property-encoding-1.mm: Likewise.
+
+2011-03-04  Nicola Pero  <nicola.pero@meta-innovation.com>
+
         * objc.dg/gnu-api-2-property.m: Added tests for  
property_getName()
         and property_getAttributes() if __OBJC2__.
         * obj-c++.dg/gnu-api-2-property.mm: Likewise.
Index: objc.dg/property/property-encoding-1.m
===================================================================
--- objc.dg/property/property-encoding-1.m      (revision 170682)
+++ objc.dg/property/property-encoding-1.m      (working copy)
@@ -89,22 +89,21 @@ void error (objc_property_t p)
  }

  /* Concatenate 3 strings and return the result.  */
-char *concat (char *a, char *b, char *c)
+char *concat (const char *a, const char *b, const char *c)
  {
    /* We happily leak memory here.  This is a test.  */
-  char *x = malloc (sizeof (char) * 128);
+  char *x = (char *)malloc (sizeof (char) * 128);
    snprintf (x, 128, "%s%s%s", a, b, c);
    return x;
  }

  #endif

-int main(int argc, void **args)
+int main (void)
  {
  #ifdef __OBJC2__
    Class c = objc_getClass ("MySubClass");
    objc_property_t p;
-  const char *expected_result;

    p = class_getProperty (c, "char_property");
    /* Usually we expect "Tc,Vchar_property", but if a char is of
Index: obj-c++.dg/property/property-encoding-1.mm
===================================================================
--- obj-c++.dg/property/property-encoding-1.mm  (revision 170682)
+++ obj-c++.dg/property/property-encoding-1.mm  (working copy)
@@ -89,22 +89,21 @@ void error (objc_property_t p)
  }

  /* Concatenate 3 strings and return the result.  */
-char *concat (char *a, char *b, char *c)
+char *concat (const char *a, const char *b, const char *c)
  {
    /* We happily leak memory here.  This is a test.  */
-  char *x = malloc (sizeof (char) * 128);
+  char *x = (char *)malloc (sizeof (char) * 128);
    snprintf (x, 128, "%s%s%s", a, b, c);
    return x;
  }

  #endif

-int main(int argc, char **args)
+int main (void)
  {
  #ifdef __OBJC2__
    Class c = objc_getClass ("MySubClass");
    objc_property_t p;
-  const char *expected_result;

    p = class_getProperty (c, "char_property");
    /* Usually we expect "Tc,Vchar_property", but if a char is of



More information about the Gcc-patches mailing list