[Bug libstdc++/36231] ostream includes unistd.h outside namespace std, polluting

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Wed Apr 20 18:42:00 GMT 2011


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely.gcc at gmail dot
                   |                            |com

--- Comment #13 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-04-20 18:42:26 UTC ---
The last time I checked, the problem boiled down to:

  typedef __gthread_mutex_t __c_lock;

in c_io_stdio.h, which we cannot remove right away for ABI reasons, because we
have a __c_lock data member in iostream classes. Of course the member is
normally completely unused these days, thus a possible ABI-safe way to attack
the problem would be replacing the data member with a dummy member of the same
size and alignment, the equivalent of:

  class stream
  {
    union
    {
      char __data[sizeof(__gthread_mutex_t)];
      struct __attribute__((__aligned__ ((__alignof__(__gthread_mutex_t))))) {
} __align;
    } __dummy_member;
  };

In order to figure out those quantities, ie, sizeof(__gthread_mutex_t) and
__alignof__(__gthread_mutex_t) we could probably use something like
[GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS], Ralf, people, what do you think?



More information about the Gcc-bugs mailing list