[PATCH 1/2] testsuite: New effective-target sleep

Hans-Peter Nilsson <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
See also PR libfortran/125005.  Ok for trunk and gcc-16?
-- >8 --
libgfortran calls sleep, which is not available on all targets.

gcc:
	* doc/sourcebuild.texi (Effective-Target Keywords): Document 'sleep'.

gcc/testsuite:
	* lib/target-supports.exp (check_effective_target_sleep): New.
---
 gcc/doc/sourcebuild.texi              |  3 +++
 gcc/testsuite/lib/target-supports.exp | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 3bccb1384d9f..4ca7a0810ec7 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2838,6 +2838,9 @@ both scalar and vector modes.
 @item alarm
 Target supports @code{alarm}.
 
+@item sleep
+Target supports @code{sleep}.
+
 @item c
 The language for the compiler under test is C.
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index e7165e2e1b8c..1dd2e164daa5 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -14823,6 +14823,17 @@ proc check_effective_target_alarm { } {
     }]
 }
 
+# Return true if sleep is supported on the target.
+
+proc check_effective_target_sleep { } {
+    return [check_no_compiler_messages sleep executable {
+	#include <unistd.h>
+	int main (void) { 
+	  sleep (1);
+	}
+    }]
+}
+
 # Return true if a speculation barrier is defined on the target.
 proc check_effective_target_speculation_barrier_defined { } {
     return [check_no_compiler_messages speculation_barrier_defined assembly {
-- 
2.30.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.