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.
This commit is contained in:
toonn 2021-10-22 20:16:15 +02:00 committed by Jonathan Ringer
parent 19678c4e90
commit e33c11a557
3 changed files with 19 additions and 31 deletions

View File

@ -1,7 +1,7 @@
From c0ab867bb7888401957539b0348902028a2be6e0 Mon Sep 17 00:00:00 2001
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 stdlib if not defined
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
@ -10,9 +10,24 @@ knock-on effects, for example, breaking the zlib build because of
This should be the lowest impact solution and corresponds to the default
behavior IIUC.
---
include/stdio.h | 3 +++
include/stdlib.h | 3 +++
1 file changed, 3 insertions(+)
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

View File

@ -1,26 +0,0 @@
From 26a721ca68bb06cb815c49f4ac28bb9de8bb2cba Mon Sep 17 00:00:00 2001
From: toonn <toonn@toonn.io>
Date: Tue, 27 Jul 2021 20:03:40 +0200
Subject: [PATCH 2/2] Define TARGET_OS_EMBEDDED in stdio if not defined
---
include/stdio.h | 3 +++
1 file changed, 3 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
--
2.17.2 (Apple Git-113)

View File

@ -4,8 +4,7 @@ appleDerivation' stdenvNoCC {
nativeBuildInputs = [ ed unifdef ];
patches = [
./0001-Define-TARGET_OS_EMBEDDED-in-stdlib-if-not-defined.patch
./0002-Define-TARGET_OS_EMBEDDED-in-stdio-if-not-defined.patch
./0001-Define-TARGET_OS_EMBEDDED-in-std-lib-io-if-not-defin.patch
];
# TODO: asl.h actually comes from syslog project now