This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/29365] Unnecessary anonymous namespace warnings



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]