3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/0001-Define-TARGET_OS_EMBEDDED-in-std-lib-io-if-not-defin.patch
toonn e33c11a557 Libc: Merge TARGET_OS_EMBEDDED patches
Both patches implement the same fix so they'll probably have to be
removed at the same time. This avoids one of them being left behind.
2021-11-24 15:17:13 -08:00

48 lines
1.4 KiB
Diff

From 187d0e8847d080790b22724352e51de50d214dd8 Mon Sep 17 00:00:00 2001
From: toonn <toonn@toonn.io>
Date: Tue, 27 Jul 2021 15:12:14 +0200
Subject: [PATCH] Define TARGET_OS_EMBEDDED in std{lib,io} if not defined
Originally attempted including `TargetConditionals.h` but this had
knock-on effects, for example, breaking the zlib build because of
`TARGET_OS_MAC` getting defined.
This should be the lowest impact solution and corresponds to the default
behavior IIUC.
---
include/stdio.h | 3 +++
include/stdlib.h | 3 +++
2 files changed, 6 insertions(+)
diff --git a/include/stdio.h b/include/stdio.h
index d0cf7a5..487496e 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -351,6 +351,9 @@ __END_DECLS
/* Additional functionality provided by:
* POSIX.2-1992 C Language Binding Option
*/
+#ifndef TARGET_OS_EMBEDDED
+# define TARGET_OS_EMBEDDED 0
+#endif
#if TARGET_OS_EMBEDDED
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
#else
diff --git a/include/stdlib.h b/include/stdlib.h
index c04d3a7..0b454ba 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -183,6 +183,9 @@ unsigned long long
#ifndef LIBC_ALIAS_SYSTEM
//End-Libc
+#ifndef TARGET_OS_EMBEDDED
+# define TARGET_OS_EMBEDDED 0
+#endif
#if TARGET_OS_EMBEDDED
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
#else
--
2.17.2 (Apple Git-113)