tsvc tests all fail on systems that don't offer a malloc.h, other than
those that explicitly rule that out.  Use the preprocessor to test for
malloc.h's availability.

tsvc.h also expects a definition for struct timeval, but it doesn't
include sys/time.h.  Add a conditional include thereof.

Bootstrapped on x86_64-linux-gnu.  Also tested on ppc- and x86-vx7r2
with gcc-12.


for  gcc/testsuite/ChangeLog

        * gcc.dg/vect/tsvc/tsvc.h: Test for and conditionally include
        malloc.h and sys/time.h.

---
 gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h 
b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
index 75494c24cfa62..cd39c041903dd 100644
--- a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
+++ b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
@@ -11,9 +11,12 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#if !defined(__APPLE__) && !defined(__DragonFly__)
+#if __has_include(<malloc.h>)
 #include <malloc.h>
 #endif
+#if __has_include(<sys/time.h>)
+#include <sys/time.h>
+#endif
 #include <string.h>
 #include <math.h>
 

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

Reply via email to