In gcc/: 2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/: 2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2006-03-27 Fariborz Jahanian <fjahanian@apple.com> Radar 4133425 * c-decl.c (undeclared_variable): Issue diagnostic on private 'ivar' access. In gcc/c-family/: 2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2006-03-27 Fariborz Jahanian <fjahanian@apple.com> Radar 4133425 * c-common.h (objc_diagnose_private_ivar): New decl. * stub-objc.c (objc_diagnose_private_ivar): New stub. In gcc/cp/: 2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com> Merge from apple/trunk branch on FSF servers. 2006-03-27 Fariborz Jahanian <fjahanian@apple.com> Radar 4133425 * lex.c (unqualified_name_lookup_error): Issue diagnostic for private 'ivar' access. In gcc/objc/: 2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2006-03-27 Fariborz Jahanian <fjahanian@apple.com> Radar 4133425 * objc-act.c (objc_diagnose_private_ivar): New. In gcc/testsuite/: 2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2006-03-27 Fariborz Jahanian <fjahanian@apple.com> Radar 4133425 * objc.dg/private-1.m: Test modified. * obj-c++.dg/private-1.mm: Test modified. From-SVN: r165601
This commit is contained in:
parent
2e01b76611
commit
90fbfdc31a
|
@ -1,3 +1,13 @@
|
|||
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
Merge from 'apple/trunk' branch on FSF servers.
|
||||
|
||||
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
|
||||
|
||||
Radar 4133425
|
||||
* c-decl.c (undeclared_variable): Issue diagnostic on
|
||||
private 'ivar' access.
|
||||
|
||||
2010-10-17 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR target/46051
|
||||
|
|
|
@ -2961,7 +2961,8 @@ undeclared_variable (location_t loc, tree id)
|
|||
}
|
||||
else
|
||||
{
|
||||
error_at (loc, "%qE undeclared (first use in this function)", id);
|
||||
if (!objc_diagnose_private_ivar (id))
|
||||
error_at (loc, "%qE undeclared (first use in this function)", id);
|
||||
if (!already)
|
||||
{
|
||||
inform (loc, "each undeclared identifier is reported only"
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
Merge from 'apple/trunk' branch on FSF servers.
|
||||
|
||||
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
|
||||
|
||||
Radar 4133425
|
||||
* c-common.h (objc_diagnose_private_ivar): New decl.
|
||||
* stub-objc.c (objc_diagnose_private_ivar): New stub.
|
||||
|
||||
2010-10-17 Iain Sandoe <iains@gcc.gnu.org>
|
||||
|
||||
* c-common.c (c_common_reswords): Add package, RID_AT_PACKAGE.
|
||||
|
|
|
@ -987,6 +987,7 @@ extern void objc_check_global_decl (tree);
|
|||
extern tree objc_common_type (tree, tree);
|
||||
extern bool objc_compare_types (tree, tree, int, tree);
|
||||
extern bool objc_have_common_type (tree, tree, int, tree);
|
||||
extern bool objc_diagnose_private_ivar (tree);
|
||||
extern void objc_volatilize_decl (tree);
|
||||
extern bool objc_type_quals_match (tree, tree);
|
||||
extern tree objc_rewrite_function_call (tree, tree);
|
||||
|
|
|
@ -44,6 +44,11 @@ objc_is_object_ptr (tree ARG_UNUSED (arg))
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool objc_diagnose_private_ivar (tree ARG_UNUSED (arg))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
tree
|
||||
objc_lookup_ivar (tree other, tree ARG_UNUSED (arg))
|
||||
{
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
Merge from apple/trunk branch on FSF servers.
|
||||
|
||||
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
|
||||
|
||||
Radar 4133425
|
||||
* lex.c (unqualified_name_lookup_error): Issue diagnostic
|
||||
for private 'ivar' access.
|
||||
|
||||
2010-10-17 Iain Sandoe <iains@gcc.gnu.org>
|
||||
|
||||
* parser.c (cp_parser_objc_visibility_spec): Update to use visibility
|
||||
|
|
|
@ -449,7 +449,8 @@ unqualified_name_lookup_error (tree name)
|
|||
}
|
||||
else
|
||||
{
|
||||
error ("%qD was not declared in this scope", name);
|
||||
if (!objc_diagnose_private_ivar (name))
|
||||
error ("%qD was not declared in this scope", name);
|
||||
/* Prevent repeated error messages by creating a VAR_DECL with
|
||||
this NAME in the innermost block scope. */
|
||||
if (current_function_decl)
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
Merge from 'apple/trunk' branch on FSF servers.
|
||||
|
||||
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
|
||||
|
||||
Radar 4133425
|
||||
* objc-act.c (objc_diagnose_private_ivar): New.
|
||||
|
||||
2010-10-17 Iain Sandoe <iains@gcc.gnu.org>
|
||||
|
||||
* objc-act.c: Rename 'objc_public_flag' to objc_ivar_visibility and
|
||||
|
|
|
@ -10821,6 +10821,25 @@ generate_objc_image_info (void)
|
|||
finish_var_decl (decl, objc_build_constructor (TREE_TYPE (decl), v));
|
||||
}
|
||||
|
||||
/* Routine is called to issue diagnostic when reference to a private
|
||||
ivar is made and no other variable with same name is found in
|
||||
current scope. */
|
||||
bool
|
||||
objc_diagnose_private_ivar (tree id)
|
||||
{
|
||||
tree ivar;
|
||||
if (!objc_method_context)
|
||||
return false;
|
||||
ivar = is_ivar (objc_ivar_chain, id);
|
||||
if (ivar && is_private (ivar))
|
||||
{
|
||||
error ("instance variable %qs is declared private",
|
||||
IDENTIFIER_POINTER (id));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Look up ID as an instance variable. OTHER contains the result of
|
||||
the C or C++ lookup, which we may want to use instead. */
|
||||
/* Also handle use of property as setter/getter. */
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
Merge from 'apple/trunk' branch on FSF servers.
|
||||
|
||||
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
|
||||
|
||||
Radar 4133425
|
||||
* objc.dg/private-1.m: Test modified.
|
||||
* obj-c++.dg/private-1.mm: Test modified.
|
||||
|
||||
2010-10-17 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR testsuite/45987
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/* Test errors for accessing @private and @protected variables. */
|
||||
/* Based on work by: Nicola Pero <nicola@brainstorm.co.uk>. */
|
||||
|
||||
/* { dg-do compile } */
|
||||
|
||||
#include <objc/objc.h>
|
||||
|
||||
@interface MySuperClass
|
||||
|
@ -36,7 +34,7 @@
|
|||
- (void) test
|
||||
{
|
||||
/* Private variables simply don't exist in the subclass. */
|
||||
_private = 12; /* { dg-error "._private. was not declared in this scope" } */
|
||||
_private = 12; /* { dg-error "instance variable \\'_private\\' is declared private" } */
|
||||
|
||||
_protected = 12; /* Ok */
|
||||
_public = 12; /* Ok */
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
- (void) test
|
||||
{
|
||||
/* Private variables simply don't exist in the subclass. */
|
||||
private = 12;/* { dg-error "undeclared" } */
|
||||
private = 12; /* { dg-error "instance variable" } */
|
||||
/* { dg-message "function it appears in" "" { target *-*-* } { 37 } } */
|
||||
|
||||
protected = 12; /* Ok */
|
||||
|
|
Loading…
Reference in New Issue