浏览代码

[libc] Use __builtin_va_list et al in stdarg.h

The home-grown versions don't work properly for static variadic
functions, when gcc can choose to use a non-standard calling convention.
tags/v0.9.4
Michael Brown 16 年前
父节点
当前提交
dbf8a02e8f
共有 2 个文件被更改,包括 10 次插入22 次删除
  1. 0
    22
      src/arch/i386/include/stdarg.h
  2. 10
    0
      src/include/stdarg.h

+ 0
- 22
src/arch/i386/include/stdarg.h 查看文件

@@ -1,22 +0,0 @@
1
-#ifndef _STDARG_H
2
-#define _STDARG_H
3
-
4
-typedef void * va_list;
5
-
6
-#define va_start( ap, last ) do {	\
7
-		ap = ( &last + 1 );	\
8
-	} while ( 0 )
9
-
10
-#define va_arg( ap, type ) ({		\
11
-		type *_this = ap;	\
12
-		ap = ( _this + 1 );	\
13
-		*(_this);		\
14
-	})
15
-
16
-#define va_end( ap ) do { } while ( 0 )
17
-
18
-#define va_copy( dest, src ) do {	\
19
-		dest = src;		\
20
-	} while ( 0 )
21
-
22
-#endif /* _STDARG_H */

+ 10
- 0
src/include/stdarg.h 查看文件

@@ -0,0 +1,10 @@
1
+#ifndef _STDARG_H
2
+#define _STDARG_H
3
+
4
+typedef __builtin_va_list va_list;
5
+#define va_start( ap, last ) __builtin_va_start ( ap, last )
6
+#define va_arg( ap, type ) __builtin_va_arg ( ap, type )
7
+#define va_end( ap ) __builtin_va_end ( ap )
8
+#define va_copy( dest, src ) __builtin_va_copy ( dest, src )
9
+
10
+#endif /* _STDARG_H */

正在加载...
取消
保存