aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-10-27 04:37:47 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-10-27 04:37:47 +0000
commitf614132bc795c4773957e0d7fec7ee9dfd127274 (patch)
tree6ea8370f843d34af7151be0a948bae894059845f /gcc/objc
parent3e1484c9ee7d218f9e07f13916cbeb0ada3164c2 (diff)
downloadgcc-f614132bc795c4773957e0d7fec7ee9dfd127274.zip
gcc-f614132bc795c4773957e0d7fec7ee9dfd127274.tar.gz
gcc-f614132bc795c4773957e0d7fec7ee9dfd127274.tar.bz2
In gcc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_at_property): Renamed to c_parser_objc_at_property_declaration. Updated calls to objc_add_property_variable, now objc_add_property_declaration. Code rewritten to be much more robust in recovering from syntax errors. Added comments. (c_parser_objc_property_attrlist): Removed. (c_parser_external_declaration): Updated calls to c_parser_objc_at_property, now c_parser_objc_at_property_declaration. (c_parser_objc_methodprotolist): Same change. In gcc/c-family/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * c-common.h (objc_add_property_variable): Renamed to objc_add_property_declaration. Added location argument. * stub-objc.c (objc_add_property_variable): Same change. In gcc/cp/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_property_decl): Renamed to cp_parser_objc_struct_declaration. Return the parsed trees instead of calling objc_add_property_variable directly. Detect missing or invalid declspecs. Implemented attributes. Do not eat the ';' at the end. Exit loop whenever a non-comma is parsed, not just EOF. (cp_parser_objc_at_property): Renamed to cp_parser_objc_at_property_declaration. Updated calls to objc_add_property_variable, now objc_add_property_declaration, and to cp_parser_objc_property_decl, now cp_parser_objc_struct_declaration. Rewritten all code to be more robust in dealing with syntax errors, and almost identical to the one in c_parser_objc_at_property_declaration. (cp_parser_objc_property_attrlist): Removed. (cp_parser_objc_method_prototype_list): Updated call to cp_parser_objc_at_property. (cp_parser_objc_method_definition_list): Same change. (cp_parser_objc_class_ivars): Detect a number of invalid declarations of instance variables and produce errors when they are found. In gcc/objc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_add_property_variable): Renamed to objc_add_property_declaration. Added location argument. Updated warnings and errors to use it. Use error, not fatal_error, if a property declaration is found outside an interface or implementation context. In gcc/testsuite/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/property/at-property-1.m: New. * objc.dg/property/at-property-2.m: New. * objc.dg/property/at-property-3.m: New. * objc.dg/ivar-invalid-type-1.m: New. * obj-c++.dg/property/at-property-1.mm: New. * obj-c++.dg/property/at-property-2.mm: New. * obj-c++.dg/property/at-property-3.mm: New. * obj-c++.dg/ivar-invalid-type-1.mm: New. * objc.dg/property/property-neg-6.m: Updated testcase for updates in error reporting. From-SVN: r165996
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/ChangeLog8
-rw-r--r--gcc/objc/objc-act.c24
2 files changed, 20 insertions, 12 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 9e79359..de29539 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,11 @@
+2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-act.c (objc_add_property_variable): Renamed to
+ objc_add_property_declaration. Added location argument. Updated
+ warnings and errors to use it. Use error, not fatal_error, if a
+ property declaration is found outside an interface or
+ implementation context.
+
2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_build_keyword_decl): Updated comments. Do not
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 242fe17..efdf17f 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -871,7 +871,7 @@ objc_set_property_attr (location_t loc, objc_property_attribute_kind attr,
*/
void
-objc_add_property_variable (tree decl)
+objc_add_property_declaration (location_t location, tree decl)
{
tree property_decl;
tree x;
@@ -882,7 +882,7 @@ objc_add_property_variable (tree decl)
interface = lookup_interface (CLASS_NAME (objc_implementation_context));
if (!interface)
{
- error ("no class property can be implemented without an interface");
+ error_at (location, "no class property can be implemented without an interface");
return;
}
if (TREE_CODE (objc_implementation_context) == CATEGORY_IMPLEMENTATION_TYPE)
@@ -891,14 +891,14 @@ objc_add_property_variable (tree decl)
CLASS_SUPER_NAME (objc_implementation_context));
if (!interface)
{
- error ("no category property can be implemented without an interface");
+ error_at (location, "no category property can be implemented without an interface");
return;
}
}
}
else if (!objc_interface_context)
{
- fatal_error ("property declaration not in @interface or @implementation context");
+ error_at (location, "property declaration not in @interface or @implementation context");
return;
}
@@ -923,13 +923,13 @@ objc_add_property_variable (tree decl)
/* Issue error if property and an ivar name match. */
if (TREE_CODE (objc_interface_context) == CLASS_INTERFACE_TYPE
&& is_ivar (CLASS_IVARS (objc_interface_context), DECL_NAME (decl)))
- error ("property %qD may not have the same name as an ivar in the class", decl);
+ error_at (location, "property %qD may not have the same name as an ivar in the class", decl);
/* must check for duplicate property declarations. */
for (x = CLASS_PROPERTY_DECL (objc_interface_context); x; x = TREE_CHAIN (x))
{
if (PROPERTY_NAME (x) == DECL_NAME (decl))
{
- error ("duplicate property declaration %qD", decl);
+ error_at (location, "duplicate property declaration %qD", decl);
return;
}
}
@@ -945,26 +945,26 @@ objc_add_property_variable (tree decl)
break;
if (!x)
{
- error ("no declaration of property %qD found in the interface", decl);
+ error_at (location, "no declaration of property %qD found in the interface", decl);
return;
}
/* readonlys must also match. */
if (PROPERTY_READONLY (x) != PROPERTY_READONLY (property_decl))
{
- error ("property %qD %<readonly%> attribute conflicts with its"
- " interface version", decl);
+ error_at (location, "property %qD %<readonly%> attribute conflicts with its"
+ " interface version", decl);
}
/* copies must also match. */
if (PROPERTY_COPIES (x) != PROPERTY_COPIES (property_decl))
{
- error ("property %qD %<copies%> attribute conflicts with its"
- " interface version", decl);
+ error_at (location, "property %qD %<copies%> attribute conflicts with its"
+ " interface version", decl);
}
/* Cannot have readonly and setter attribute for the same property. */
if (PROPERTY_READONLY (property_decl) == boolean_true_node &&
PROPERTY_SETTER_NAME (property_decl))
{
- warning (0, "a %<readonly%> property cannot have a setter (ignored)");
+ warning_at (location, 0, "a %<readonly%> property cannot have a setter (ignored)");
PROPERTY_SETTER_NAME (property_decl) = NULL_TREE;
}
/* Add the property to the list of properties for current implementation. */