void-packages/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch

63 lines
1.7 KiB
Diff

diff --git a/src/fundamental/memory-util-fundamental.h b/src/fundamental/memory-util-fundamental.h
index 78e2dbe..561e05f 100644
--- a/src/fundamental/memory-util-fundamental.h
+++ b/src/fundamental/memory-util-fundamental.h
@@ -1,11 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stddef.h>
-
#if SD_BOOT
# include "efi-string.h"
#else
+# include <stddef.h>
# include <string.h>
#endif
diff --git a/src/fundamental/string-util-fundamental.c b/src/fundamental/string-util-fundamental.c
index a5bafc6..0d7c08a 100644
--- a/src/fundamental/string-util-fundamental.c
+++ b/src/fundamental/string-util-fundamental.c
@@ -4,8 +4,8 @@
# include <ctype.h>
#endif
-#include "macro-fundamental.h"
#include "string-util-fundamental.h"
+#include "macro-fundamental.h"
sd_char *startswith(const sd_char *s, const sd_char *prefix) {
size_t l;
diff --git a/src/boot/efi/efi.h b/src/boot/efi/efi.h
index 5c34668..50fca66 100644
--- a/src/boot/efi/efi.h
+++ b/src/boot/efi/efi.h
@@ -1,6 +1,14 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#if SD_BOOT
+#define __DEFINED_wchar_t
+/* uchar.h/wchar.h are not suitable for freestanding environments. */
+typedef __WCHAR_TYPE__ wchar_t;
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
@@ -9,11 +17,6 @@
#include "macro-fundamental.h"
#if SD_BOOT
-/* uchar.h/wchar.h are not suitable for freestanding environments. */
-typedef __WCHAR_TYPE__ wchar_t;
-typedef __CHAR16_TYPE__ char16_t;
-typedef __CHAR32_TYPE__ char32_t;
-
/* Let's be paranoid and do some sanity checks. */
assert_cc(__STDC_HOSTED__ == 0);
assert_cc(sizeof(bool) == 1);