stdargGnu.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:4k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* stdargGnu.h - Ansi C standard arguments header file */
  2. /*
  3. modification history
  4. --------------------
  5. 01b,03mar98,jmb  clean-up
  6. 01a,27feb98,jmb  A simplified version of stdarg.h from Cygwin32, Beta 18.
  7. */
  8. /*
  9. DESCRIPTION
  10. This file contains macros and typedefs for varargs.  
  11. Note:  This file should not be included directly!  The correct file
  12. to include is <stdarg.h>. 
  13. This file was derived from the cygwin32-b18 version of gcc/ginclude/stdarg.h.
  14. */
  15. #ifndef __INCstdargh
  16. Bug!! Please use #include <stdarg.h>
  17. #endif
  18. #ifndef __INCstdargGnuh
  19. #define __INCstdargGnuh
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /* stdarg.h for GNU.
  24.    Note that the type used in va_arg is supposed to match the
  25.    actual type **after default promotions**.
  26.    Thus, va_arg (..., short) is not valid.  */
  27. #ifndef _STDARG_H
  28. #ifndef _ANSI_STDARG_H_
  29. #ifndef __need___va_list
  30. #define _STDARG_H
  31. #define _ANSI_STDARG_H_
  32. #endif /* not __need___va_list */
  33. #undef __need___va_list
  34. /* Define __gnuc_va_list.  */
  35. #ifndef __GNUC_VA_LIST
  36. #define __GNUC_VA_LIST
  37. typedef void *__gnuc_va_list;
  38. #endif
  39. /* Define the standard macros for the user,
  40.    if this invocation was from the user program.  */
  41. #ifdef _STDARG_H
  42. /* Amount of space required in an argument list for an arg of type TYPE.
  43.    TYPE may alternatively be an expression whose type is used.  */
  44. #define __va_rounded_size(TYPE)  
  45.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  46. #define va_start(AP, LASTARG) 
  47.  (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
  48. #undef va_end
  49. void va_end (__gnuc_va_list); /* Defined in libgcc.a */
  50. #define va_end(AP) ((void)0)
  51. /* We cast to void * and then to TYPE * because this avoids
  52.    a warning about increasing the alignment requirement.  */
  53. /* CYGNUS LOCAL mn10200/law */
  54. /* END CYGNUS LOCAL */
  55. /* This is for little-endian machines; small args are padded upward.  */
  56. #define va_arg(AP, TYPE)
  57.  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),
  58.   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
  59. /* Copy __gnuc_va_list into another variable of this type.  */
  60. #define __va_copy(dest, src) (dest) = (src)
  61. #endif /* _STDARG_H */
  62. #ifdef _STDARG_H
  63. /* Define va_list, if desired, from __gnuc_va_list. */
  64. /* We deliberately do not define va_list when called from
  65.    stdio.h, because ANSI C says that stdio.h is not supposed to define
  66.    va_list.  stdio.h needs to have access to that data type, 
  67.    but must not use that name.  It should use the name __gnuc_va_list,
  68.    which is safe because it is reserved for the implementation.  */
  69. #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
  70. #undef _VA_LIST
  71. #endif
  72. #ifdef _BSD_VA_LIST
  73. #undef _BSD_VA_LIST
  74. #endif
  75. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  76.    But on BSD NET2 we must not test or define or undef it.
  77.    (Note that the comments in NET 2's ansi.h
  78.    are incorrect for _VA_LIST_--see stdio.h!)  */
  79. #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
  80. /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
  81. #ifndef _VA_LIST_DEFINED
  82. /* The macro _VA_LIST is used in SCO Unix 3.2.  */
  83. #ifndef _VA_LIST
  84. /* The macro _VA_LIST_T_H is used in the Bull dpx2  */
  85. #ifndef _VA_LIST_T_H
  86. typedef __gnuc_va_list va_list;
  87. #endif /* not _VA_LIST_T_H */
  88. #endif /* not _VA_LIST */
  89. #endif /* not _VA_LIST_DEFINED */
  90. #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
  91. #define _VA_LIST_
  92. #endif
  93. #ifndef _VA_LIST
  94. #define _VA_LIST
  95. #endif
  96. #ifndef _VA_LIST_DEFINED
  97. #define _VA_LIST_DEFINED
  98. #endif
  99. #ifndef _VA_LIST_T_H
  100. #define _VA_LIST_T_H
  101. #endif
  102. #endif /* not _VA_LIST_, except on certain systems */
  103. #endif /* _STDARG_H */
  104. #endif /* not _ANSI_STDARG_H_ */
  105. #endif /* not _STDARG_H */
  106. #ifdef __cplusplus
  107. }
  108. #endif
  109. #endif /* __INCstdargGnuh */