[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] [PATCH] Adjust va_list to work with musl
From: |
Steffen Nurpmeso |
Subject: |
[Tinycc-devel] [PATCH] Adjust va_list to work with musl |
Date: |
Sat, 30 Sep 2017 00:16:21 +0200 |
Date: |
Sat, 30 Sep 2017 00:11:59 +0200 |
User-agent: |
mail v14.9.4 |
---
include/stdarg.h | 12 +++++++-----
libtcc.c | 2 +-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/stdarg.h b/include/stdarg.h
index 9adfc61..e347763 100644
--- a/include/stdarg.h
+++ b/include/stdarg.h
@@ -18,17 +18,19 @@ typedef struct {
/* Avoid conflicting definition for va_list on musl libc */
#ifndef __DEFINED_va_list
-typedef __va_list_struct va_list[1];
+typedef struct{char pad[32];} va_list;
#define __DEFINED_va_list
#endif
void __va_start(__va_list_struct *ap, void *fp);
void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align);
-#define va_start(ap, last) __va_start(ap, __builtin_frame_address(0))
-#define va_arg(ap, type) \
- (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type),
__alignof__(type))))
-#define va_copy(dest, src) (*(dest) = *(src))
+#define va_start(ap, last) \
+ __va_start((__va_list_struct*)&ap, __builtin_frame_address(0))
+#define va_arg(ap, type) \
+ (*(type *)(__va_arg((__va_list_struct*)&ap, __builtin_va_arg_types(type),\
+ sizeof(type), __alignof__(type))))
+#define va_copy(dest, src) ((dest) = (src))
#define va_end(ap)
/* avoid conflicting definition for va_list on Macs. */
diff --git a/libtcc.c b/libtcc.c
index 41c814d..fe47841 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -854,7 +854,7 @@ LIBTCCAPI TCCState *tcc_new(void)
#endif
#if defined(TCC_MUSL)
- tcc_define_symbol(s, "__builtin_va_list", "void *");
+ tcc_define_symbol(s, "__builtin_va_list", "struct {char pad[32];}");
#endif /* TCC_MUSL */
#ifdef TCC_TARGET_PE
--
2.14.2
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
- [Tinycc-devel] [PATCH] Adjust va_list to work with musl,
Steffen Nurpmeso <=