Commit 8f78939b by Nicola Pero Committed by Nicola Pero

In gcc/objc/: 2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>

In gcc/objc/:
2010-11-01  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objc-act.c (objc_maybe_build_component_ref): Warn about using
        deprecated properties.
        (objc_maybe_printable_name): Support PROPERTY_DECL.
        
In gcc/testsuite/:
2010-11-01  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objc.dg/property/at-property-deprecated-1.m: New.
        * obj-c++.dg/property/at-property-deprecated-1.mm: New.

From-SVN: r166147
parent 7894073c
2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> 2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_maybe_build_component_ref): Warn about using
deprecated properties.
(objc_maybe_printable_name): Support PROPERTY_DECL.
2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented Objective-C 2.0 property accessors. Implemented Objective-C 2.0 property accessors.
* objc-act.h (enum objc_tree_index): Added OCTI_GET_PROPERTY_DECL, * objc-act.h (enum objc_tree_index): Added OCTI_GET_PROPERTY_DECL,
OCTI_SET_PROPERTY_DECL, OCTI_COPY_STRUCT_DECL, OCTI_SET_PROPERTY_DECL, OCTI_COPY_STRUCT_DECL,
......
...@@ -1122,6 +1122,9 @@ objc_maybe_build_component_ref (tree object, tree property_ident) ...@@ -1122,6 +1122,9 @@ objc_maybe_build_component_ref (tree object, tree property_ident)
{ {
tree expression; tree expression;
if (TREE_DEPRECATED (x))
warn_deprecated_use (x, NULL_TREE);
expression = build2 (PROPERTY_REF, TREE_TYPE(x), object, x); expression = build2 (PROPERTY_REF, TREE_TYPE(x), object, x);
SET_EXPR_LOCATION (expression, input_location); SET_EXPR_LOCATION (expression, input_location);
TREE_SIDE_EFFECTS (expression) = 1; TREE_SIDE_EFFECTS (expression) = 1;
...@@ -11224,6 +11227,13 @@ objc_maybe_printable_name (tree decl, int v ATTRIBUTE_UNUSED) ...@@ -11224,6 +11227,13 @@ objc_maybe_printable_name (tree decl, int v ATTRIBUTE_UNUSED)
case CLASS_METHOD_DECL: case CLASS_METHOD_DECL:
return IDENTIFIER_POINTER (DECL_NAME (decl)); return IDENTIFIER_POINTER (DECL_NAME (decl));
break; break;
/* This happens when printing a deprecation warning for a
property. We may want to consider some sort of pretty
printing (eg, include the class name where it was declared
?). */
case PROPERTY_DECL:
return IDENTIFIER_POINTER (PROPERTY_NAME (decl));
break;
default: default:
return NULL; return NULL;
break; break;
......
2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> 2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/property/at-property-deprecated-1.m: New.
* obj-c++.dg/property/at-property-deprecated-1.mm: New.
2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented Objective-C 2.0 property accessors. Implemented Objective-C 2.0 property accessors.
* objc.dg/property/at-property-6.m: Use nonatomic properties to * objc.dg/property/at-property-6.m: Use nonatomic properties to
avoid testing more complex accessors in this testcase which is not avoid testing more complex accessors in this testcase which is not
......
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
/* { dg-do compile } */
/* Test that properties can be deprecated. */
#include <stdlib.h>
#include <objc/objc.h>
#include <objc/runtime.h>
@interface MyRootClass
{
Class isa;
int a;
}
@property int a __attribute__((deprecated));
+ (id) initialize;
+ (id) alloc;
- (id) init;
@end
@implementation MyRootClass
+ (id) initialize { return self; }
+ (id) alloc { return class_createInstance (self, 0); }
- (id) init { return self; }
@synthesize a;
@end
int main (void)
{
MyRootClass *object = [[MyRootClass alloc] init];
object.a = 40; /* { dg-warning ".a. is deprecated .declared at " } */
if (object.a != 40) /* { dg-warning ".a. is deprecated .declared at " } */
abort ();
return (0);
}
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
/* { dg-do compile } */
/* Test that properties can be deprecated. */
#include <stdlib.h>
#include <objc/objc.h>
#include <objc/runtime.h>
@interface MyRootClass
{
Class isa;
int a;
}
@property int a __attribute__((deprecated));
+ (id) initialize;
+ (id) alloc;
- (id) init;
@end
@implementation MyRootClass
+ (id) initialize { return self; }
+ (id) alloc { return class_createInstance (self, 0); }
- (id) init { return self; }
@synthesize a;
@end
int main (void)
{
MyRootClass *object = [[MyRootClass alloc] init];
object.a = 40; /* { dg-warning ".a. is deprecated .declared at " } */
if (object.a != 40) /* { dg-warning ".a. is deprecated .declared at " } */
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment