]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: New effective-target sleep
authorHans-Peter Nilsson <hp@axis.com>
Thu, 23 Apr 2026 16:12:17 +0000 (18:12 +0200)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Fri, 24 Apr 2026 23:38:29 +0000 (01:38 +0200)
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
gcc/testsuite/lib/target-supports.exp

index 3bccb1384d9fcd75d6009a65faa9f465c4fb9778..0bfcb96814d8cd7903bd4715c3b9d85ac93a97fe 100644 (file)
@@ -2936,6 +2936,9 @@ Target can compile using @code{pthread.h} with no errors or warnings.
 @item pthread_h
 Target has @code{pthread.h}.
 
+@item sleep
+Target supports @code{sleep}.
+
 @item sockets
 Target can compile using @code{sys/socket.h} with no errors or warnings.
 
index e7165e2e1b8c76d3a615abb30560266c1d6151f9..9912c6df233d0540cb8fd70e90be17b30e08897a 100644 (file)
@@ -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 {