This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: libstdc++ test case ext/headers.cc failed on arm-none-eabi
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Wed, 7 Aug 2013 12:20:55 +0100
- Subject: Re: libstdc++ test case ext/headers.cc failed on arm-none-eabi
- References: <CAHFci282xzqC07Nu03Az+VuwOjm2b3gzDr4Oty-OBW6NKa5ekg at mail dot gmail dot com> <CAH6eHdSqQmRcY8ZXKzQSHAm0+K6N9ztqmj7-o8pdNBG8WvT3NA at mail dot gmail dot com> <52022AA0 dot 4030601 at redhat dot com>
On 7 August 2013 12:08, Florian Weimer wrote:
> On 08/07/2013 01:05 PM, Jonathan Wakely wrote:
>
>> There's not enough context to see what happened, the diagnostic is
>> crap, only showing the macro not where it's used. The macro is not
>> used as a non-static data member initializers except in C++11 mode, so
>> I don't know how that could happen.
>
>
> I think it's used in C++98 mode, too, but we suppress the error because it's
> a system header.
Yep, as I realised just after I sent my reply.
I suspect what's happening is that gthr-default.h is getting included
before a #pragma GCC system_header, so that when the
__GTHREAD_MUTEX_INIT is later used (in a system header) it's treated
as not coming from a system header e.g.
$ cat g.h
typedef int __gthread_mutex_t;
#define INIT 0
$ cat m.h
#include "g.h"
#pragma GCC system_header
class __mutex
{
private:
__gthread_mutex_t _M_mutex = INIT;
public:
__mutex() { }
};
$ cat m.cc
#include "m.h"
int main()
{
__mutex m;
}
$ g++ m.cc
In file included from m.h:1:0,
from m.cc:1:
g.h:2:14: warning: non-static data member initializers only available
with -std=c++11 or -std=gnu++11 [enabled by default]
#define INIT 0
^