Skip to content

Commit

Permalink
scripts(toolchain): fix Bionic modularization for the upcoming Swift 6
Browse files Browse the repository at this point in the history
  • Loading branch information
finagolfin authored and truboxl committed Jul 25, 2024
1 parent e76597a commit 15c0e54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ndk-patches/27/stdio.h.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
--- ./usr/include/stdio.h.orig 2021-08-16 11:48:44.308954400 +0200
+++ ./usr/include/stdio.h 2021-08-16 11:50:00.438924014 +0200
@@ -44,6 +44,9 @@
@@ -44,6 +44,11 @@
#include <stdarg.h>
#include <stddef.h>

+#if !defined(__swift__)
+#include <string.h> /* For strcpy(3) used by ctermid() */
+#endif
+#include <asm/fcntl.h> /* For O_RDWR and other O_* constants */
+
#include <bits/seek_constants.h>
Expand All @@ -28,7 +30,7 @@
#if __ANDROID_API__ >= 24
FILE* _Nullable tmpfile64(void) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
@@ -304,10 +303,15 @@
@@ -304,10 +303,17 @@

#define L_ctermid 1024 /* size for ctermid() */

Expand All @@ -39,11 +41,13 @@
+#define __sferror(p) (((p)->_flags & __SERR) != 0)

+/* Used by perl, fish, and others. */
+#if !defined(__swift__)
+static __inline__ char* _Nonnull ctermid(char* _Nullable s) {
+ if (s == 0) return (char*) "/dev/tty";
+ strcpy(s, "/dev/tty");
+ return s;
+}
+#endif

FILE* fdopen(int __fd, const char* __mode);
int fileno(FILE* __fp);
Expand Down
4 changes: 3 additions & 1 deletion ndk-patches/27/stdlib.h.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
--- ./usr/include/stdlib.h.orig 2021-08-16 11:50:47.432239182 +0200
+++ ./usr/include/stdlib.h 2021-08-16 11:51:31.102222894 +0200
@@ -33,6 +33,7 @@
@@ -33,6 +33,9 @@
#include <bits/wait.h>
#include <malloc.h>
#include <stddef.h>
+#if !defined(__swift__)
+#include <stdint.h>
+endif
#include <sys/cdefs.h>
#include <xlocale.h>

Expand Down

0 comments on commit 15c0e54

Please sign in to comment.