public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* std::exception_ptr on Cygwin
@ 2009-05-29  0:37 Piotr Wyderski
  2009-05-29  9:23 ` Andrew Pinski
  0 siblings, 1 reply; 4+ messages in thread
From: Piotr Wyderski @ 2009-05-29  0:37 UTC (permalink / raw)
  To: gcc

It is impossible to use std::exception_ptr and related
functionality on Cygwin in C++0x mode, despite the
fact the necessary classes seem to be implemented.
That is because in <exception> there is a conditional
block:

#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
     && defined(_GLIBCXX_ATOMIC_BUILTINS_4))
#include <exception_ptr.h>
#endif

The macro __GXX_EXPERIMENTAL_CXX0X__ is
defined correctly, as expected, but

_GLIBCXX_ATOMIC_BUILTINS_4

is not, as Cygwin does not use glibc. Its underlying
processor architecture, however, supports the fullest
set of atomic primitives, so is there really a need to
make it glibc-dependent? If I enforce the macro
definition from the command line, then the exception_ptr
-dependent code compiles correctly (but does not link
because of

 undefined reference to `std::__exception_ptr::exception_ptr::~exception_ptr()

and the other non-inline members. I presume
it is not the recommended way.

Best regards
Piotr Wyderski

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: std::exception_ptr on Cygwin
  2009-05-29  0:37 std::exception_ptr on Cygwin Piotr Wyderski
@ 2009-05-29  9:23 ` Andrew Pinski
  2009-05-29 10:07   ` Piotr Wyderski
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2009-05-29  9:23 UTC (permalink / raw)
  To: Piotr Wyderski; +Cc: gcc

On Thu, May 28, 2009 at 4:00 PM, Piotr Wyderski
<piotr.wyderski@gmail.com> wrote:
> is not, as Cygwin does not use glibc. Its underlying
> processor architecture, however, supports the fullest
> set of atomic primitives, so is there really a need to
> make it glibc-dependent? If I enforce the macro
> definition from the command line, then the exception_ptr
> -dependent code compiles correctly (but does not link
> because of

Actually it is not due not to glibc but the default for i686-linux-gnu
and i686-cygwin is really targeting 386 and tuning for generic cpu.
i386 did not have atomic locks at all but 486 and above does.  This
has come up many times in the past too.

-- Pinski

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: std::exception_ptr on Cygwin
  2009-05-29  9:23 ` Andrew Pinski
@ 2009-05-29 10:07   ` Piotr Wyderski
  2009-05-29 10:12     ` Dave Korn
  0 siblings, 1 reply; 4+ messages in thread
From: Piotr Wyderski @ 2009-05-29 10:07 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc

Andrew Pinski wrote:

> i386 did not have atomic locks at all but 486 and above does.

Thanks, now it is obvious to me. So how should
I configure my GCC-trunk build? It seems that
--with-cpu is not enough:

$ gcc -v
Using built-in specs.
Target: i686-pc-cygwin
Configured with: ../configure --prefix=/opt/gcc-4.5-trunk -v --enable-bootstrap
--enable-version-specific-runtime-libs --enable-static --enable-shared --enable-
shared-libgcc --with-gnu-ld --with-gnu-as --enable-sjlj-exceptions --enable-lang
uages=c,c++ --disable-symvers --enable-libjava --disable-nls --with-cpu=core2 --
enable-threads=posix

Best regards
Piotr Wyderski

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: std::exception_ptr on Cygwin
  2009-05-29 10:07   ` Piotr Wyderski
@ 2009-05-29 10:12     ` Dave Korn
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Korn @ 2009-05-29 10:12 UTC (permalink / raw)
  To: Piotr Wyderski; +Cc: Andrew Pinski, gcc

Piotr Wyderski wrote:
> Andrew Pinski wrote:
> 
>> i386 did not have atomic locks at all but 486 and above does.
> 
> Thanks, now it is obvious to me. So how should
> I configure my GCC-trunk build? It seems that
> --with-cpu is not enough:

  You need to look closer at the definition of -mcpu, -mtune and -march.  It's
the arch that selects which instructions may be generated, not the tune/cpu
setting which just controls scheduling optimisation and selection of best
instructions between equally available alternatives.  I use "--with-arch=i686
--with-tune=generic".

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-29  0:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-29  0:37 std::exception_ptr on Cygwin Piotr Wyderski
2009-05-29  9:23 ` Andrew Pinski
2009-05-29 10:07   ` Piotr Wyderski
2009-05-29 10:12     ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).