Skip to content

Commit bf9cb91

Browse files
Alexandre OlivaMarc Poulhiès
authored andcommitted
ada: ppc-vx6: pthread clocks and headers for decls
VxWorks 6 lacks pthread_condattr_setclock, so define CLOCK_RT_Ada to CLOCK_REALTIME to use the dummy definition of __gnat_pthread_condattr_setup in libgnarl/thread.c. socket.c and sysdep.c use FD_ZERO, that relies on bzero on VxWorks 6. We need to include strings.h to get a declaration for bzero, but don't require strings.h to exist, since it's nonstandard. gcc/ada/ChangeLog: * s-oscons-tmplt.c (CLOCK_RT_Ada) [__vxworks]: Define to CLOCK_REALTIME on VxWorks6. * gsocket.h [__vxworks]: Include strings.h if available. * sysdep.c [__vxworks]: Likewise.
1 parent 09eced2 commit bf9cb91

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

gcc/ada/gsocket.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
#include <ioLib.h>
6565
#include <hostLib.h>
6666

67+
#if __has_include ("strings.h")
68+
/* On VxWorks6, FD_ZERO uses bzero, but since it's not a standard header, don't
69+
require it. */
70+
#include "strings.h"
71+
#endif
72+
6773
#define SHUT_RD 0
6874
#define SHUT_WR 1
6975
#define SHUT_RDWR 2

gcc/ada/s-oscons-tmplt.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
19761976
#if defined(__linux__) || defined(__FreeBSD__) \
19771977
|| (defined(_AIX) && defined(_AIXVERSION_530)) \
19781978
|| defined(__DragonFly__) || defined(__QNX__) \
1979-
|| defined (__vxworks)
1979+
|| (defined (__vxworks) && /* VxWorks7 */ defined (_VSB_CONFIG_FILE))
19801980
/** On these platforms use system provided monotonic clock instead of
19811981
** the default CLOCK_REALTIME. We then need to set up cond var attributes
19821982
** appropriately (see thread.c).
@@ -1985,6 +1985,10 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
19851985
** pthread_cond_timedwait (and does not have pthread_condattr_setclock),
19861986
** hence the conditionalization on AIX version above). _AIXVERSION_530
19871987
** is defined in AIX 5.3 and more recent versions.
1988+
**
1989+
** VxWorks6 lacks pthread_condattr_setclock, so define CLOCK_RT_Ada to
1990+
** CLOCK_REALTIME to get the dummy definition of __gnat_pthread_condattr_setup
1991+
** in libgnarl/thread.c.
19881992
**/
19891993
# define CLOCK_RT_Ada "CLOCK_MONOTONIC"
19901994

gcc/ada/sysdep.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
- either they are defined as ENOENT (vx7r2);
4141
- or the corresponding system includes are not provided (Helix Cert). */
4242

43+
#if __has_include ("strings.h")
44+
/* On VxWorks6, FD_ZERO uses bzero, and index is also declared in strings.h,
45+
but since it's not a standard header, don't require it. */
46+
#include "strings.h"
47+
#endif
48+
4349
#if __has_include ("dosFsLib.h")
4450
/* On helix-cert, this include is only provided for RTPs. */
4551
#include "dosFsLib.h"

0 commit comments

Comments
 (0)