Commit a6341d57 by Nicola Pero Committed by Nicola Pero

In gcc/: 2010-09-29 Nicola Pero <nicola.pero@meta-innovation.com>

In gcc/:
2010-09-29  Nicola Pero  <nicola.pero@meta-innovation.com>

        Merge from 'apple/trunk' branch on FSF servers.
        * c-parser.c: Applied change originally in c-parse.in.

        2005-10-04  Fariborz Jahanian <fjahanian@apple.com>

        Radar 4281748
        * c-decl.c (start_decl): Check for redeclaration of class name.
        * c-parse.in (after_type_declarator): Recognize CLASSNAME.

In gcc/c-family/:
2010-09-27  Nicola Pero  <nicola.pero@meta-innovation.com>

        Merge from 'apple/trunk' branch on FSF servers.

        2005-10-04  Fariborz Jahanian <fjahanian@apple.com>

        Radar 4281748
        * c-common.h (objc_check_global_decl): New declaration.
        * stub-objc.c (objc_check_global_decl): New stub.

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

        Merge from 'apple/trunk' branch on FSF servers.

        2005-10-04  Fariborz Jahanian <fjahanian@apple.com>

        Radar 4281748
        * objc-act.c (objc_check_global_decl): New

In gcc/testsuite/:
2010-09-28  Nicola Pero  <nicola.pero@meta-innovation.com>

        Merge from 'apple/trunk' branch on FSF servers.

        2005-10-04  Fariborz Jahanian <fjahanian@apple.com>

        Radar 4281748
        * objc.dg/naming-2.m: Update
        * objc.dg/naming-3.m: New

From-SVN: r164735
parent b14446e2
2010-09-29 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
* c-parser.c: Applied change originally in c-parse.in.
2005-10-04 Fariborz Jahanian <fjahanian@apple.com>
Radar 4281748
* c-decl.c (start_decl): Check for redeclaration of class name.
* c-parse.in (after_type_declarator): Recognize CLASSNAME.
2010-09-29 Steve Ellcey <sje@cup.hp.com>
* config/ia64/ia64.c (ia64_builtin_decl): New.
......@@ -4072,6 +4072,11 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
record_inline_static (input_location, current_function_decl,
decl, csi_modifiable);
if (c_dialect_objc ()
&& (TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == FUNCTION_DECL))
objc_check_global_decl (decl);
/* Add this decl to the current scope.
TEM may equal DECL or it may be a previous decl of the same name. */
tem = pushdecl (decl);
......
2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
2005-10-04 Fariborz Jahanian <fjahanian@apple.com>
Radar 4281748
* c-common.h (objc_check_global_decl): New declaration.
* stub-objc.c (objc_check_global_decl): New stub.
2010-09-29 Joseph Myers <joseph@codesourcery.com>
* c.opt: Don't use VarExists.
......
......@@ -955,6 +955,7 @@ extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char);
extern tree objc_is_class_name (tree);
extern tree objc_is_object_ptr (tree);
extern void objc_check_decl (tree);
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);
......
......@@ -56,6 +56,11 @@ objc_check_decl (tree ARG_UNUSED (decl))
{
}
void
objc_check_global_decl (tree ARG_UNUSED (decl))
{
}
tree
objc_common_type (tree ARG_UNUSED (type1), tree ARG_UNUSED (type2))
{
......
......@@ -2560,7 +2560,8 @@ c_parser_direct_declarator (c_parser *parser, bool type_seen_p, c_dtr_syn kind,
if (kind != C_DTR_ABSTRACT
&& c_parser_next_token_is (parser, CPP_NAME)
&& ((type_seen_p
&& c_parser_peek_token (parser)->id_kind == C_ID_TYPENAME)
&& (c_parser_peek_token (parser)->id_kind == C_ID_TYPENAME
|| c_parser_peek_token (parser)->id_kind == C_ID_CLASSNAME))
|| c_parser_peek_token (parser)->id_kind == C_ID_ID))
{
struct c_declarator *inner
......
2010-09-28 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
2005-10-04 Fariborz Jahanian <fjahanian@apple.com>
Radar 4281748
* objc-act.c (objc_check_global_decl): New
2010-09-29 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_is_reserved_word): Removed.
......
......@@ -1495,6 +1495,14 @@ objc_check_decl (tree decl)
type);
}
void
objc_check_global_decl (tree decl)
{
tree id = DECL_NAME (decl);
if (objc_is_class_name (id) && global_bindings_p())
error ("redeclaration of Objective-C class %qs", IDENTIFIER_POINTER (id));
}
/* Construct a PROTOCOLS-qualified variant of INTERFACE, where INTERFACE may
either name an Objective-C class, or refer to the special 'id' or 'Class'
types. If INTERFACE is not a valid ObjC type, just return it unchanged. */
......
2010-09-28 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
2005-10-04 Fariborz Jahanian <fjahanian@apple.com>
Radar 4281748
* objc.dg/naming-2.m: Update
* objc.dg/naming-3.m: New
2010-09-29 Bernd Schmidt <bernds@codesourcery.com>
PR target/40457
......
......@@ -4,7 +4,7 @@
@interface Foo
@end
float Foo; /* { dg-error "parse error|syntax error|expected" } */
float Foo; /* { dg-error "parse error|syntax error|expected|redeclaration" } */
double Bar;
@interface Bar
......
/* Test for class name same as an unrelated struct field name. */
/* { dg-do compile } */
@interface PassThrough {
}
@end
struct S {
int (*PassThrough)();
};
int main()
{
PassThrough* pt;
struct S s;
s.PassThrough();
}
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