]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: ppc-vx6: pthread clocks and headers for decls
authorAlexandre Oliva <oliva@adacore.com>
Wed, 16 Jul 2025 05:01:59 +0000 (02:01 -0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 25 Jul 2025 08:09:37 +0000 (10:09 +0200)
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.

gcc/ada/gsocket.h
gcc/ada/s-oscons-tmplt.c
gcc/ada/sysdep.c

index 79836e8b5b91124f8947101443757010f8a22339..5a553d121dde895f7f37558dcbcf9a14f3e43756 100644 (file)
 #include <ioLib.h>
 #include <hostLib.h>
 
+#if __has_include ("strings.h")
+/* On VxWorks6, FD_ZERO uses bzero, but since it's not a standard header, don't
+   require it.  */
+#include "strings.h"
+#endif
+
 #define SHUT_RD                0
 #define SHUT_WR                1
 #define SHUT_RDWR      2
index 97537ef5e9402f64983e8f0dcd0bb0d8f4356328..7a5e987cefc41629c3eb5778e190759215d60af4 100644 (file)
@@ -1976,7 +1976,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
 #if defined(__linux__) || defined(__FreeBSD__) \
  || (defined(_AIX) && defined(_AIXVERSION_530)) \
  || defined(__DragonFly__) || defined(__QNX__) \
- || defined (__vxworks)
+ || (defined (__vxworks) && /* VxWorks7 */ defined (_VSB_CONFIG_FILE))
 /** On these platforms use system provided monotonic clock instead of
  ** the default CLOCK_REALTIME. We then need to set up cond var attributes
  ** appropriately (see thread.c).
@@ -1985,6 +1985,10 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
  ** pthread_cond_timedwait (and does not have pthread_condattr_setclock),
  ** hence the conditionalization on AIX version above). _AIXVERSION_530
  ** is defined in AIX 5.3 and more recent versions.
+ **
+ ** VxWorks6 lacks pthread_condattr_setclock, so define CLOCK_RT_Ada to
+ ** CLOCK_REALTIME to get the dummy definition of __gnat_pthread_condattr_setup
+ ** in libgnarl/thread.c.
  **/
 # define CLOCK_RT_Ada "CLOCK_MONOTONIC"
 
index 3dc76f9ab1fd785768ae4932f60165798de08ab7..afbb362dff0923565183b0ec0e826e66128c7107 100644 (file)
    - either they are defined as ENOENT (vx7r2);
    - or the corresponding system includes are not provided (Helix Cert).  */
 
+#if __has_include ("strings.h")
+/* On VxWorks6, FD_ZERO uses bzero, and index is also declared in strings.h,
+   but since it's not a standard header, don't require it.  */
+#include "strings.h"
+#endif
+
 #if __has_include ("dosFsLib.h")
 /* On helix-cert, this include is only provided for RTPs.  */
 #include "dosFsLib.h"