[RFA] Suppress warning about redundant decl when first decl is a friend.
Nick Clifton
nickc@cambridge.redhat.com
Mon May 14 02:45:00 GMT 2001
Hi Guys,
I would like permission to apply the following patch. It suppresses
a warning message about a redundant decl, when the first decl is a
friend. The message (prior to this patch) could be generated by
compiling the following test program with -Wredundant-decl enabled:
class Foo
{
friend void bar (Foo);
public:
};
extern void bar (Foo);
Cheers
Nick
2001-05-14 Nick Clifton <nickc@cambridge.redhat.com>
* decl.c (duplicate_decls): Suppress warning about duplicate
decls if the first decl is a friend.
Index: gcc/cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.783
diff -p -r1.783 decl.c
*** decl.c 2001/05/12 10:37:48 1.783
--- decl.c 2001/05/14 09:43:42
*************** duplicate_decls (newdecl, olddecl)
*** 3457,3463 ****
/* Don't warn about extern decl followed by definition. */
&& !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl))
/* Don't warn about friends, let add_friend take care of it. */
! && ! DECL_FRIEND_P (newdecl))
{
cp_warning ("redundant redeclaration of `%D' in same scope", newdecl);
cp_warning_at ("previous declaration of `%D'", olddecl);
--- 3457,3463 ----
/* Don't warn about extern decl followed by definition. */
&& !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl))
/* Don't warn about friends, let add_friend take care of it. */
! && ! (DECL_FRIEND_P (newdecl) || DECL_FRIEND_P (olddecl)))
{
cp_warning ("redundant redeclaration of `%D' in same scope", newdecl);
cp_warning_at ("previous declaration of `%D'", olddecl);
More information about the Gcc-patches
mailing list