gthr-vxworks-thread.c fails to compile for vxworks 5.x:
libgcc/config/gthr-vxworks-thread.c:268:14: error: 'VX_USR_TASK_OPTIONS'
undeclared (first use in this function)
268 | options &= VX_USR_TASK_OPTIONS;
| ^~~~~~~~~~~~~~~~~~~
libgcc/config/gthr-vxworks-thread.c:282:3: error: unknown type name 'TASK_ID'
282 | TASK_ID task_id = taskCreate (NULL,
| ^~~~~~~
As for __GTHREAD_HAS_COND, use __GTHREAD_CXX0X to guard the actual
contents of gthr-vxworks-thread.c. That should also allow dropping the
t-gthr-vxworksae fragment and simply use t-gthr-vxworks.
---
libgcc/config/gthr-vxworks-thread.c | 4 ++++
libgcc/config/gthr-vxworks.h | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/libgcc/config/gthr-vxworks-thread.c
b/libgcc/config/gthr-vxworks-thread.c
index 8544b03dd18..183198577eb 100644
--- a/libgcc/config/gthr-vxworks-thread.c
+++ b/libgcc/config/gthr-vxworks-thread.c
@@ -30,6 +30,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If
not, see
#include "gthr.h"
#include <taskLib.h>
+#if __GTHREAD_CXX0X
+
#define __TIMESPEC_TO_NSEC(timespec) \
((long long)timespec.tv_sec * 1000000000 + (long long)timespec.tv_nsec)
@@ -347,3 +349,5 @@ __gthread_detach (__gthread_t __threadid)
return OK;
}
+
+#endif
diff --git a/libgcc/config/gthr-vxworks.h b/libgcc/config/gthr-vxworks.h
index 91e3d94ac67..14e7d54b022 100644
--- a/libgcc/config/gthr-vxworks.h
+++ b/libgcc/config/gthr-vxworks.h
@@ -263,7 +263,7 @@ extern int __gthread_cond_wait_recursive (__gthread_cond_t
*cond,
/* We do not support C++0x threads on that VxWorks 653, which we can
recognize by VTHREADS being defined. */
-#ifndef VTHREADS
+#if _VXWORKS_MAJOR_GE(6) && !defined(VTHREADS)
#define __GTHREADS_CXX0X 1
@@ -326,7 +326,7 @@ extern int __gthread_detach (__gthread_t thread);
extern __gthread_t __gthread_self (void);
-#endif
+#endif /* _VXWORKS_MAJOR_GE(6) && !defined(VTHREADS) */
#ifdef __cplusplus
}
--
2.23.0