sys/types.h is broken for _POSIX_THREADS

Renato Caldas
Tue Feb 23 22:41:00 GMT 2010


I've been trying to compile rtems for a few days, it always failed
with a strange error message. Now I belive I found out why: I had
compiled gcc with --enable-threads.

I managed to find one problem. In sys/types.h there is:

#if defined(_POSIX_THREADS) && !defined(__CYGWIN__)

#if defined(__XMK__)
typedef struct pthread_attr_s {
} pthread_attr_t;


#else /* !defined(__XMK__) */
typedef struct {
#endif /* !defined(__XMK__) */

} pthread_attr_t;


#endif /* defined(_POSIX_THREADS) */

This is clearly broken, because a spurious "} pthread_attr_t" is
placed in the code #if defined(__XMK__). The fix seems to be easy.

I assume thread support is severely broken, or at least severely
untested, right? If so, wouldn't it be wiser to just make sure it is


More information about the Newlib mailing list