aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/stub-objc.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2020-10-31 20:53:34 +0000
committerIain Sandoe <iain@sandoe.co.uk>2020-11-06 19:49:23 +0000
commit9a34a5cce6b50fc3527e7c7ab356808ed435883c (patch)
treea1b114d1c1f375371c8eb1cf69025a15d99dfb80 /gcc/c-family/stub-objc.c
parent6c282c14d1be0bba2bf5d49acd074b349f28ad17 (diff)
downloadgcc-9a34a5cce6b50fc3527e7c7ab356808ed435883c.zip
gcc-9a34a5cce6b50fc3527e7c7ab356808ed435883c.tar.gz
gcc-9a34a5cce6b50fc3527e7c7ab356808ed435883c.tar.bz2
Objective-C/C++ (parsers) : Update @property attribute parsing.
At present, we are missing parsing and checking for around half of the property attributes in use. The existing ad hoc scheme for the parser's communication with the Objective C validation is not suitable for extending to cover all the missing cases. Additionally: 1/ We were declaring errors in two cases that the reference implementation warns (or is silent). I've elected to warn for both those cases, (Wattributes) it could be that we should implement Wobjc-xxx-property warning masks (TODO). 2/ We were emitting spurious complaints about missing property attributes when these were not being parsed because we gave up on the first syntax error. 3/ The quality of the diagnostic locations was poor (that's true for much of Objective-C, we will have to improve it as we modernise areas). We continue to attempt to keep the code, warning and error output similar (preferably identical output) between the C and C++ front ends. The interface to the Objective-C-specific parts of the parsing is simplified to a vector of parsed (but not fully-checked) property attributes, this will simplify the addition of new attributes. gcc/c-family/ChangeLog: * c-objc.h (enum objc_property_attribute_group): New (enum objc_property_attribute_kind): New. (OBJC_PROPATTR_GROUP_MASK): New. (struct property_attribute_info): Small class encapsulating parser output from property attributes. (objc_prop_attr_kind_for_rid): New (objc_add_property_declaration): Simplify interface. * stub-objc.c (enum rid): Dummy type. (objc_add_property_declaration): Simplify interface. (objc_prop_attr_kind_for_rid): New. gcc/c/ChangeLog: * c-parser.c (c_parser_objc_at_property_declaration): Improve parsing fidelity. Associate better location info with @property attributes. Clean up the interface to objc_add_property_declaration (). gcc/cp/ChangeLog: * parser.c (cp_parser_objc_at_property_declaration): Improve parsing fidelity. Associate better location info with @property attributes. Clean up the interface to objc_add_property_declaration (). gcc/objc/ChangeLog: * objc-act.c (objc_prop_attr_kind_for_rid): New. (objc_add_property_declaration): Adjust to consume the parser output using a vector of parsed attributes. gcc/testsuite/ChangeLog: * obj-c++.dg/property/at-property-1.mm: Adjust expected diagnostics. * obj-c++.dg/property/at-property-29.mm: Likewise. * obj-c++.dg/property/at-property-4.mm: Likewise. * obj-c++.dg/property/property-neg-2.mm: Likewise. * objc.dg/property/at-property-1.m: Likewise. * objc.dg/property/at-property-29.m: Likewise. * objc.dg/property/at-property-4.m: Likewise. * objc.dg/property/at-property-5.m: Likewise. * objc.dg/property/property-neg-2.m: Likewise.
Diffstat (limited to 'gcc/c-family/stub-objc.c')
-rw-r--r--gcc/c-family/stub-objc.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/c-family/stub-objc.c b/gcc/c-family/stub-objc.c
index d017acf..2f53557 100644
--- a/gcc/c-family/stub-objc.c
+++ b/gcc/c-family/stub-objc.c
@@ -23,6 +23,12 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
+#include "vec.h"
+
+/* Provide a dummy type for the RID enum used as an argument to
+ objc_prop_attr_kind_for_rid () */
+enum rid { DUMMY };
+
#include "c-objc.h"
tree
@@ -314,14 +320,8 @@ objc_get_class_ivars (tree ARG_UNUSED (name))
void
objc_add_property_declaration (location_t ARG_UNUSED (location),
tree ARG_UNUSED (decl),
- bool ARG_UNUSED (parsed_property_readonly),
- bool ARG_UNUSED (parsed_property_readwrite),
- bool ARG_UNUSED (parsed_property_assign),
- bool ARG_UNUSED (parsed_property_retain),
- bool ARG_UNUSED (parsed_property_copy),
- bool ARG_UNUSED (parsed_property_nonatomic),
- tree ARG_UNUSED (parsed_property_getter_ident),
- tree ARG_UNUSED (parsed_property_setter_ident))
+ vec<property_attribute_info *>&
+ /*prop_attr_list*/)
{
}
@@ -465,3 +465,8 @@ void
objc_maybe_warn_exceptions (location_t ARG_UNUSED (loc))
{
}
+
+enum objc_property_attribute_kind objc_prop_attr_kind_for_rid (enum rid)
+{
+ return OBJC_PROPERTY_ATTR_UNKNOWN;
+}