sys/types.h is broken for _POSIX_THREADS

Renato Caldas seventhguardian@gmail.com
Tue Feb 23 22:41:00 GMT 2010


Hello,

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
disabled?

Cheers,
  Renato



More information about the Newlib mailing list