public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "spark at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/29365] Unnecessary anonymous namespace warnings
Date: Tue, 03 Apr 2007 22:50:00 -0000	[thread overview]
Message-ID: <20070403225028.10228.qmail@sourceware.org> (raw)
In-Reply-To: <bug-29365-7796@http.gcc.gnu.org/bugzilla/>



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


  parent reply	other threads:[~2007-04-03 22:50 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-06  6:08 [Bug c++/29365] New: " gcc at magfr dot user dot lysator dot liu dot se
2006-10-06  6:09 ` [Bug c++/29365] " gcc at magfr dot user dot lysator dot liu dot se
2006-10-06 12:59 ` pinskia at gcc dot gnu dot org
2006-10-06 18:36 ` jason at gcc dot gnu dot org
2006-10-06 18:48 ` gcc at magfr dot user dot lysator dot liu dot se
2006-10-06 21:01 ` jason at gcc dot gnu dot org
2006-10-10  3:54 ` bangerth at dealii dot org
2007-03-12  9:37 ` Woebbeking at web dot de
2007-04-03 22:50 ` spark at gcc dot gnu dot org [this message]
2007-04-03 23:11 ` pinskia at gcc dot gnu dot org
2007-04-03 23:19 ` spark at gcc dot gnu dot org
2007-04-03 23:30 ` crowl at google dot com
2007-04-04 16:40 ` patchapp at dberlin dot org
2007-04-16 16:49 ` spark at gcc dot gnu dot org
2007-04-16 18:24 ` pinskia at gcc dot gnu dot org
2007-04-17  6:16 ` gcc at magfr dot user dot lysator dot liu dot se
2007-04-17  6:18 ` gcc at magfr dot user dot lysator dot liu dot se
2007-04-17 16:37 ` spark at gcc dot gnu dot org
2007-04-17 16:51 ` pluto at agmk dot net
2007-04-18  5:25 ` gcc at user dot lysator dot liu dot se
2007-05-03 12:00 ` aaronavay62 at aaronwl dot com
2007-06-05 17:26 ` pluto at agmk dot net
2007-06-05 22:37 ` spark at gcc dot gnu dot org
2007-06-06  4:49 ` pluto at agmk dot net
2007-06-06  9:24 ` pinskia at gcc dot gnu dot org
2007-06-06 10:09 ` pluto at agmk dot net
2007-06-06 11:23 ` manu at gcc dot gnu dot org
2007-06-25 18:13 ` spark at gcc dot gnu dot org
2007-08-20 15:40 ` jason at gcc dot gnu dot org
2007-08-22 17:24 ` jason at gcc dot gnu dot org
2007-08-22 20:40 ` jason at gcc dot gnu dot org
2007-08-22 21:50 ` jason at gcc dot gnu dot org
2007-08-28 19:40 ` pluto at agmk dot net
2007-08-28 20:48   ` Andrew Pinski
2007-08-28 20:48 ` pinskia at gmail dot com
2007-08-28 21:41 ` bangerth at dealii dot org
2007-08-28 22:11   ` Andrew Pinski
2007-08-28 22:11 ` pinskia at gmail dot com
2007-08-29  3:15 ` bangerth at dealii dot org
2007-08-29  8:52   ` Andrew Pinski
2007-08-29 13:19     ` Gabriel Dos Reis
2007-08-29  8:53 ` pinskia at gmail dot com
2007-08-29 13:20 ` gdr at cs dot tamu dot edu
2007-10-22 18:13 ` jason at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070403225028.10228.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).