From d3c515c40b9ec0133787388ae7df037e88a95f73 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:18:49 -0700
Subject: [PATCH] ada: libgnarl: adaint: fix sched.h inclusion for musl

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
 gcc/ada/adaint.c | 6 +++++-
 gcc/ada/adaint.h | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 1fcfae165a7..67318e647ed 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -95,6 +95,11 @@
 #include <sys/pstat.h>
 #endif
 
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
 #ifdef __PikeOS__
 #define __BSD_VISIBLE 1
 #endif
@@ -3476,7 +3481,6 @@ __gnat_lwp_self (void)
 #endif
 
 #if defined (__linux__)
-#include <sched.h>
 
 /* glibc versions earlier than 2.7 do not define the routines to handle
    dynamically allocated CPU sets. For these targets, we use the static
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 3df12b5f956..26a489f2b78 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -40,6 +40,11 @@ extern "C" {
 #include "mingw32.h"
 #endif
 
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
 #include <dirent.h>
 
 /*  Constants used for the form parameter encoding values  */
-- 
2.50.1

