stdarg.h 711 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef _STDARG_H
  2. #define _STDARG_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define __NEED_va_list
  7. #include <bits/alltypes.h>
  8. #define __VA_ALIGNED_SIZE(x) ((sizeof(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
  9. #define va_start(ap, last) ((ap) = (void *)(((char *)&(last)) + __VA_ALIGNED_SIZE(last)))
  10. #define va_end(ap) ((void)0)
  11. #define va_copy(dest, src) ((dest) = (src))
  12. #if 0
  13. #define va_arg(ap, type) \
  14. ( ((ap) = (va_list)((char *)(ap) + sizeof(type))), \
  15. *(type *)(void *)((char *)(ap) - sizeof(type)) )
  16. #endif
  17. #define va_arg(ap, type) \
  18. ( ((ap) = (va_list)((char *)(ap) + __VA_ALIGNED_SIZE(type))), \
  19. *(type *)(void *)((char *)(ap) - __VA_ALIGNED_SIZE(type)) )
  20. #ifdef __cplusplus
  21. }
  22. #endif
  23. #endif