Opened 7 years ago

Closed 7 years ago

#2175 closed defect (wontfix)

warning ... type uses the anonymous namespace

Reported by: jreed Owned by:
Priority: medium Milestone:
Component: Unclassified Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket:
Estimated Difficulty: 4 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

CXX    libdns___la-rrparamregistry.lo
rrparamregistry.cc:196: warning: 'isc::dns::RRParamRegistryImpl' has a field 'isc::dns::RRParamRegistryImpl::str2typemap' whose type uses the anonymous namespace
rrparamregistry.cc:196: warning: 'isc::dns::RRParamRegistryImpl' has a field 'isc::dns::RRParamRegistryImpl::code2typemap' whose type uses the anonymous namespace
rrparamregistry.cc:196: warning: 'isc::dns::RRParamRegistryImpl' has a field 'isc::dns::RRParamRegistryImpl::str2classmap' whose type uses the anonymous namespace
rrparamregistry.cc:196: warning: 'isc::dns::RRParamRegistryImpl' has a field 'isc::dns::RRParamRegistryImpl::code2classmap' whose type uses the anonymous namespace

This was reported to me by OPS engineer.

Subtickets

Change History (5)

comment:1 in reply to: ↑ description Changed 7 years ago by jinmei

Replying to jreed:

CXX    libdns___la-rrparamregistry.lo
rrparamregistry.cc:196: warning: 'isc::dns::RRParamRegistryImpl' has a field 'isc::dns::RRParamRegistryImpl::str2typemap' whose type uses the anonymous namespace

...

}}}
This was reported to me by OPS engineer.

And what's the problem? Did it cause a build failure? If it's just
about warning, it's most likely a known g++ bug, for which I use a
workaround in configure.ac:

# Certain versions of gcc (g++) have a bug that incorrectly warns about
# the use of anonymous name spaces even if they're closed in a single
# translation unit.  For these versions we have to disable -Werror.

so...can we close this ticket, or is this something new?

comment:2 Changed 7 years ago by naokikambe

Is the g++ bug this? http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29365
In my environment which can produce such warnings, that workaround seemed to work properly.

configure:15941: checking for in-TU anonymous namespace breakage
configure:15955: g++ -c -g -O2 -Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Werror  conftest.cpp >&5
cc1plus: warnings being treated as errors
conftest.cpp:25: warning: 'isc::Bar' has a field 'isc::Bar::foo_' whose type uses the anonymous namespace
configure:15955: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "bind10-devel"
| #define PACKAGE_TARNAME "bind10-devel"
| #define PACKAGE_VERSION "20120712"
| #define PACKAGE_STRING "bind10-devel 20120712"
| #define PACKAGE_BUGREPORT "bind10-dev@isc.org"
| #define PACKAGE_URL ""
| #define PACKAGE "bind10-devel"
| #define VERSION "20120712"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_PYTHON_H 1
| /* end confdefs.h.  */
| namespace { class Foo {}; }
|    namespace isc {class Bar {Foo foo_;};}
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:15961: result: yes}}}

comment:3 Changed 7 years ago by shane

It seems that our current detection is good.

Also nice that warnings are rare enough that users thought it worthwhile to report the ones they saw. :)

As Jinmei mentioned... should we do anything about this? People aren't going to see something in the documentation or FAQ in most cases. One possibility may be to put a warning at the end of our ./configure output:

Your version of gcc will give spurious warnings about anonymous 
namespace problems. This is a bug, and has been fixed in newer 
versions of gcc.

Please ignore these warnings.

You can follow the following link for more details about the error:

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29365

OTOH, most users will probably just ignore these warnings anyway, so maybe "do nothing" is the correct answer.

comment:4 Changed 7 years ago by jinmei

  • Milestone changed from New Tasks to Next-Sprint-Proposed

I just we close this ticket unless Jeremy clarifies what to do.

Let's discuss that at the call.

comment:5 Changed 7 years ago by jinmei

  • Resolution set to wontfix
  • Status changed from new to closed

closing, as commented.

Note: See TracTickets for help on using tickets.