This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix for PR objc/47073


This patch fixes PR objc/47073. The (included) testcase crashes the compiler before the fix,
and produces the expected error messages after the fix.


Ok to commit ?

Thanks

Index: objc-act.c
===================================================================
--- objc-act.c  (revision 168278)
+++ objc-act.c  (working copy)
@@ -5965,8 +5965,9 @@ encode_method_prototype (tree method_dec
       /* If a type size is not known, bail out.  */
       if (sz < 0)
        {
-         error ("type %q+D does not have a known size",
-                type);
+         error_at (DECL_SOURCE_LOCATION (method_decl),
+                   "type %qT does not have a known size",
+                   type);
          /* Pretend that the encoding succeeded; the compilation will
             fail nevertheless.  */
          goto finish_encoding;
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 168278)
+++ ChangeLog   (working copy)
@@ -1,3 +1,9 @@
+2010-12-28  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       PR objc/47073
+       * objc-act.c (encode_method_prototype): Fixed both location and
+       format string of error "type %qT does not have a known size".
+
 2010-12-26  Nicola Pero  <nicola.pero@meta-innovation.com>

        * config-lang.in (gtfiles): Added c-family/c-cppbuiltin.c.
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 168278)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2010-12-28  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       PR objc/47073
+       * objc.dg/incomplete-type-1.m: New test.
+
 2010-12-27  Jakub Jelinek  <jakub@redhat.com>

PR c++/46626
Index: testsuite/objc.dg/incomplete-type-1.m
===================================================================
--- testsuite/objc.dg/incomplete-type-1.m (revision 0)
+++ testsuite/objc.dg/incomplete-type-1.m (revision 0)
@@ -0,0 +1,24 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+enum type1;
+struct type2;
+
+@interface MyObject
+- (void) method1: (enum type1)argument;
+- (void) method2: (struct type2)argument;
+@end
+
+@implementation MyObject
+- (void) method1: (enum type1)argument { /* { dg-error "does not have a known size" } */
+ return;
+}
+- (void) method2: (struct type2)argument { /* { dg-error "does not have a known size" } */
+ return;
+}
+@end
+



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]