From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10264 invoked by alias); 3 Apr 2007 22:50:37 -0000 Received: (qmail 10229 invoked by uid 48); 3 Apr 2007 22:50:28 -0000 Date: Tue, 03 Apr 2007 22:50:00 -0000 Message-ID: <20070403225028.10228.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/29365] Unnecessary anonymous namespace warnings In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "spark at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-04/txt/msg00256.txt.bz2 ------- Comment #8 from spark at gcc dot gnu dot org 2007-04-03 23:50 ------- The following patch addresses the problem. Do we want to add a flag to control this ? --- a/gcc/cp/decl2.c Mon Apr 02 15:48:00 2007 +0000 +++ b/gcc/cp/decl2.c Tue Apr 03 22:45:49 2007 +0000 @@ -1860,9 +1860,13 @@ constrain_class_visibility (tree type) int subvis = type_visibility (ftype); if (subvis == VISIBILITY_ANON) - warning (0, "\ + { + if (strcmp (main_input_filename, + DECL_SOURCE_FILE (TYPE_MAIN_DECL (ftype)))) + warning (0, "\ %qT has a field %qD whose type uses the anonymous namespace", - type, t); + type, t); + } else if (IS_AGGR_TYPE (ftype) && vis < VISIBILITY_HIDDEN && subvis >= VISIBILITY_HIDDEN) @@ -1877,9 +1881,13 @@ constrain_class_visibility (tree type) int subvis = type_visibility (TREE_TYPE (t)); if (subvis == VISIBILITY_ANON) - warning (0, "\ + { + if (strcmp (main_input_filename, + DECL_SOURCE_FILE (TYPE_MAIN_DECL (TREE_TYPE (t))))) + warning (0, "\ %qT has a base %qT whose type uses the anonymous namespace", - type, TREE_TYPE (t)); + type, TREE_TYPE (t)); + } else if (vis < VISIBILITY_HIDDEN && subvis >= VISIBILITY_HIDDEN) warning (OPT_Wattributes, "\ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29365