This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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 libc/21327] Libstdc++ would like another way to get some POSIX declarations that it currently gets via _GNU_SOURCE


https://sourceware.org/bugzilla/show_bug.cgi?id=21327

--- Comment #2 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
I forgot the following names that are used from <pthread.h> via libgcc's
<gthr-posix.h> header. These are declared unconditionally (even without
_GNU_SOURCE) but ideally libstdc++ wouldn't have to include <pthread.h> to use
these features:

pthread_once_t
PTHREAD_ONCE_INIT
pthread_once

pthread_cond_t
PTHREAD_COND_INITIALIZER
pthread_cond_timedwait

pthread_mutex_t
PTHREAD_MUTEX_INITIALIZER
PTHREAD_RECURSIVE_MUTEX_INITIALIZER
pthread_mutex_lock
pthread_mutex_trylock
pthread_mutex_unlock

On the other hand, I'm not terribly concerned if these names are visible. They
might not be reserved by the C++ standard, but users who expect to be able to
redefine these names for their own uses on a GNU/Linux system are probably not
sane.

I should also say that we use __locale_t from <locale.h>, as well as uselocale.
But that's in the implementation namespace so isn't a problem. If we just had
access to __locale_t and __uselocale that would be fine. The code that uses
freelocale and other APIs are compiled into libstdc++.so so we can use
_GNU_SOURCE there. Since __locale_t is an opaque type we could just declare it
ourselves without including <locale.h> if necessary:

typedef struct __locale_struct *__locale_t;
extern "C" __locale_t __uselocale(__locale_t);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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