This is the mail archive of the gcc-patches@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]

Re: [patch] PR14172 partial fix


Joseph S. Myers wrote:
On Wed, 17 Nov 2004, Matthew Burgess wrote:


Attached is a patch that partially fixes PR14172.  There are still two cases
(in cp/class.c) where warnings are being output for system headers, but this
fixes the other 6 trivial cases.


Please include testcases for each of these warnings that it is no longer output in system headers.

Whilst working on these testcases it appears my patch is completely bogus.

With the following testcase, the compiler behaves correctly:

--- effc4.h ---
class A
{
public:
    A(int i) {
        _i = i;
    }

private:
    int _i;
};
---

--- effc4.C ---
#include "effc4.h"
int main() {
  return 0;
}
--- effc4.C ---

Adding "#pragma GCC system_header" to effc4.h will suppress the warning.

So, why then, does the following testcase fail (21 lines of warnings are
output, all to do with the internal headers included by <map>)?

--- effc5.C ---
#include <map>
int main() {
  std::map<int, int> myMap;
  return 0;
}
--- effc5.C ---

<map> has the system_header pragma specified, and all it does is include
some internal headers from bits/. Whilst some of the headers in that directory do have the system_header pragma, the ones that <map> includes do not. The obvious (albeit probably incorrect) fix is to add the pragma to those headers that currently omit it. That, strangely enough, has no effect on the warnings being output; nor does adding
'-isystem /usr/include/c++/$gcc-version/bits' to the command line.


I'd appreciate anyones input as to what's going on here, especially any pointers for this clueless newbie as to why some internal headers are classed as system_headers and others aren't.

Thanks,

Matt.


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