add va_copy macro, conforming to c99 7.15.1.2
This commit is contained in:
parent
7364a96b28
commit
a654b94db8
8 changed files with 13 additions and 3 deletions
|
@ -7,5 +7,5 @@ typedef char *va_list;
|
||||||
(char *)(&(start)+1))
|
(char *)(&(start)+1))
|
||||||
#define va_end(list)
|
#define va_end(list)
|
||||||
#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
|
#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
|
||||||
|
#define va_copy(dst, src) ((dst) = (src))
|
||||||
#endif /* __STDARG */
|
#endif /* __STDARG */
|
||||||
|
|
|
@ -7,5 +7,6 @@ typedef char *va_list;
|
||||||
#define va_end(list)
|
#define va_end(list)
|
||||||
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
|
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
|
||||||
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
|
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
|
||||||
|
#define va_copy(dst, src) ((dst) = (src))
|
||||||
|
|
||||||
#endif /* __STDARG */
|
#endif /* __STDARG */
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
|
|
||||||
typedef char *va_list;
|
typedef char *va_list;
|
||||||
|
|
||||||
#define va_start(list, start) list = (sizeof(start)<8 ? (char *)((long long *)&(start)+1) : \
|
#define va_start(list, start) \
|
||||||
(char *)(&(start)+1))
|
(list = (sizeof(start)<8 ? \
|
||||||
|
(char *)((long long *)&(start)+1) : \
|
||||||
|
(char *)(&(start)+1)))
|
||||||
#define va_end(list)
|
#define va_end(list)
|
||||||
#define va_arg(list, mode)\
|
#define va_arg(list, mode)\
|
||||||
((sizeof(mode) == 1)?\
|
((sizeof(mode) == 1)?\
|
||||||
|
@ -14,5 +16,7 @@ typedef char *va_list;
|
||||||
(sizeof(mode) == 4)?\
|
(sizeof(mode) == 4)?\
|
||||||
((mode*)(list += 8))[-2]:\
|
((mode*)(list += 8))[-2]:\
|
||||||
((mode*)(list += sizeof(mode)))[-1])
|
((mode*)(list += sizeof(mode)))[-1])
|
||||||
|
#define va_copy(dst, src) \
|
||||||
|
((dst) = (src))
|
||||||
|
|
||||||
#endif /* __STDARG */
|
#endif /* __STDARG */
|
||||||
|
|
|
@ -7,5 +7,6 @@ typedef char *va_list;
|
||||||
(char *)(&(start)+1))
|
(char *)(&(start)+1))
|
||||||
#define va_end(list)
|
#define va_end(list)
|
||||||
#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
|
#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
|
||||||
|
#define va_copy(dst, src) ((dst) = (src))
|
||||||
|
|
||||||
#endif /* __STDARG */
|
#endif /* __STDARG */
|
||||||
|
|
|
@ -14,5 +14,6 @@ typedef char *va_list;
|
||||||
(sizeof(mode) == 4)?\
|
(sizeof(mode) == 4)?\
|
||||||
((mode*)(list += 8))[-2]:\
|
((mode*)(list += 8))[-2]:\
|
||||||
((mode*)(list += sizeof(mode)))[-1])
|
((mode*)(list += sizeof(mode)))[-1])
|
||||||
|
#define va_copy(dst, src) ((dst) = (src))
|
||||||
|
|
||||||
#endif /* __STDARG */
|
#endif /* __STDARG */
|
||||||
|
|
|
@ -7,5 +7,6 @@ typedef char *va_list;
|
||||||
#define va_end(list)
|
#define va_end(list)
|
||||||
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
|
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
|
||||||
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
|
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
|
||||||
|
#define va_copy(dst, src) ((dst) = (src))
|
||||||
|
|
||||||
#endif /* __STDARG */
|
#endif /* __STDARG */
|
||||||
|
|
|
@ -7,5 +7,6 @@ typedef char *va_list;
|
||||||
#define va_end(list)
|
#define va_end(list)
|
||||||
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
|
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
|
||||||
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
|
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
|
||||||
|
#define va_copy(dst, src) ((dst) = (src))
|
||||||
|
|
||||||
#endif /* __STDARG */
|
#endif /* __STDARG */
|
||||||
|
|
|
@ -7,5 +7,6 @@ typedef char *va_list;
|
||||||
#define va_end(list)
|
#define va_end(list)
|
||||||
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
|
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
|
||||||
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
|
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
|
||||||
|
#define va_copy(dst, src) ((dst) = (src))
|
||||||
|
|
||||||
#endif /* __STDARG */
|
#endif /* __STDARG */
|
||||||
|
|
Loading…
Reference in a new issue