This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: _GLIBCXX_ASYNC_ABI_COMPAT and ~_Async_state_common()
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Maxim Yegorushkin <maxim dot yegorushkin at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 2 Oct 2012 11:40:54 +0100
- Subject: Re: _GLIBCXX_ASYNC_ABI_COMPAT and ~_Async_state_common()
- References: <CAMg=2zJ5WooUc2Y5+__U5uGWYHCmHzuwXyRNciR8fk4gEui_zQ@mail.gmail.com>
On 2 October 2012 10:28, Maxim Yegorushkin wrote:
> Hi gcc-help,
>
> I've just switched from gcc-4.7.1 to gcc-4.7.2 and am not getting new
> warning when I link my project:
>
> /usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../x86_64-unknown-linux-gnu/bin/ld:
> warning: while linking
> /home/max/otsquant/build/Linux-x86_64-64.g++-debug/test/trade_scheduler_test:
> symbol 'std::__future_base::_Async_state_common::~_Async_state_common()'
> defined in multiple places (possible ODR violation):
> /usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/future:1431
> from /home/max/otsquant/build/Linux-x86_64-64.g++-debug/obj-mt/trade_scheduler/optimizer.o
> ../../../../gcc-4.7.2-src/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc:89
> from /usr/local/ots/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../lib64/libstdc++.so
>
> Quick grep for "~_Async_state_common" reveals:
>
> class __future_base::_Async_state_common : public __future_base::_State_base
> {
> protected:
> #ifdef _GLIBCXX_ASYNC_ABI_COMPAT
> ~_Async_state_common();
> #else
> ~_Async_state_common() = default;
> #endif
>
> I could not find any documentation for _GLIBCXX_ASYNC_ABI_COMPAT
> macro. What is it for, should I define it to avoid ODR warnings?
Hi Max,
No, it's not for users, it's an internal implementation detail,
defined by src/c++11/compatibility-thread-c++0x.cc when building the
library:
http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/src/c%2B%2B11/compatibility-thread-c%2B%2B0x.cc?view=markup&pathrev=190685
I needed to change the definition of the destructor, but the old
definition was exported from the library and existing code built with
GCC 4.7.1 might refer to that symbol, so when the library is built the
old definition is defined so that code built with older versions of
GCC can still link to the library.
I didn't test the change with Gold, but I think the warning is
harmless. I'll investigate asap.