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

[Bug libstdc++/31117] c++locale.o thread-unsafe in libstdc++



------- Comment #21 from craig dot lawson at centrify dot com  2007-03-15 19:07 -------
(In reply to comment #17)
> Why? 

OK, now I know why. Reason is that os_defines.h is included after errno.h.

Here's the include sequence:

  c++locale.cc
    <cerrno>
      /usr/include/errno.h    <-- extern int errno
    <cmath>
      <bits/c++config.h>
        <os_defines.h>        <-- _TS_ERRNO -- too late

I also now know why basic_file.cc gets the errno function:
/usr/include/sys/feature_tests.h defines _POSIX_C_SOURCE to 199506L, and that's
what errno.h needs. When compiling c++locale.cc, _POSIX_C_SOURCE is also set to
the same value, but it happens after errno.h is processed.

Thanks Andrew for -dD. That's a good one.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31117


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