Bug 668178
| Summary: | gcc 4.5 warning | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Sam Varshavchik <mrsam> | ||||
| Component: | gdbm | Assignee: | Honza Horak <hhorak> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | 14 | CC: | hhorak, kevin, kklic, rdieter | ||||
| Target Milestone: | --- | Keywords: | Patch | ||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2011-02-10 15:03:02 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Isn't that a bug in g++? The type doesn't use the anonymous namespace in the first place. The typedef in question is a pointer to an anonymous struct.
In C++, an anonymous struct/class is a class that's, essentially, in an anonymous namespace that is unique to each translation unit. In other words, each C++ module sees "GDBM_FILE" as a unique class.
This example is just a warning. gcc will kick it up a notch, and will outright refuse to compile the following self-contained example:
#include <gdbm.h>
void bar(GDBM_FILE *p)
{
}
$ g++ -c foo.c
foo.c:3:22: error: non-local function ‘void bar(<anonymous struct>**)’ uses anonymous type
Since each C++ module thinks GDBM_FILE is a unique class, it can't have external linkage.
The patch seems to solve the warning issue well. gdbm-1.8.3-8.fc14 has been submitted as an update for Fedora 14. https://admin.fedoraproject.org/updates/gdbm-1.8.3-8.fc14 gdbm-1.8.3-8.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report. |
Created attachment 472369 [details] Patch to quell the warning Description of problem: gcc 4.5 complains when compiling C++ code that include gdbm.h, in some situations. Did not get a response from gdbm's maintainers to the following patch. Version-Release number of selected component (if applicable): gdbm-1.8.3-6 How reproducible: Always Steps to Reproduce: $ cat foo.h #include <gdbm.h> class xx { public: GDBM_FILE dbf; }; [mrsam@octopus tmp]$ cat foo.c #include "foo.h" [mrsam@octopus tmp]$ g++ -c foo.c Actual results: In file included from foo.c:1:0: foo.h:3:10: warning: ‘xx’ has a field ‘xx::dbf’ whose type uses the anonymous namespace Expected results: Compilation without warnings Additional info: