Files
macports-ports/textproc/simdutf/files/simdutf-char16_t-fix.patch

41 lines
1.0 KiB
Diff

diff --git a/include/simdutf_c.h b/include/simdutf_c.h
index 7cfc41e..f497e68 100644
--- include/simdutf_c.h
+++ include/simdutf_c.h
@@ -12,17 +12,26 @@
#include <stdbool.h>
#include <stdint.h>
-#ifdef __has_include
- #if __has_include(<uchar.h>)
- #include <uchar.h>
- #else // __has_include(<uchar.h>)
+/* For C API, we need consistent types across C and C++ compilation.
+ In C++, we use the built-in char16_t/char32_t types.
+ In C, we define them as uint16_t/uint32_t. */
+#ifdef __cplusplus
+ /* Undefine any previous macros to use C++ built-in types */
+ #ifdef char16_t
+ #undef char16_t
+ #endif
+ #ifdef char32_t
+ #undef char32_t
+ #endif
+#else
+ /* For C compilation, define as integer types */
+ #ifndef char16_t
#define char16_t uint16_t
+ #endif
+ #ifndef char32_t
#define char32_t uint32_t
- #endif // __has_include(<uchar.h>)
-#else // __has_include(<uchar.h>)
- #define char16_t uint16_t
- #define char32_t uint32_t
-#endif // __has_include
+ #endif
+#endif
#ifdef __cplusplus
extern "C" {