stdarg.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* Copyright (C) 1989, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with GCC; see the file COPYING. If not, write to
  13. the Free Software Foundation, 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA. */
  15. /* As a special exception, if you include this header file into source
  16. files compiled by GCC, this header file does not by itself cause
  17. the resulting executable to be covered by the GNU General Public
  18. License. This exception does not however invalidate any other
  19. reasons why the executable file might be covered by the GNU General
  20. Public License. */
  21. /*
  22. * ISO C Standard: 7.15 Variable arguments <stdarg.h>
  23. */
  24. #if defined(__GNUC__)
  25. #ifndef _STDARG_H
  26. #ifndef _ANSI_STDARG_H_
  27. #ifndef __need___va_list
  28. #define _STDARG_H
  29. #define _ANSI_STDARG_H_
  30. #endif /* not __need___va_list */
  31. #undef __need___va_list
  32. /* Define __gnuc_va_list. */
  33. #ifndef __GNUC_VA_LIST
  34. #define __GNUC_VA_LIST
  35. typedef __builtin_va_list __gnuc_va_list;
  36. #endif
  37. /* Define the standard macros for the user,
  38. if this invocation was from the user program. */
  39. #ifdef _STDARG_H
  40. #define va_start(v,l) __builtin_va_start(v,l)
  41. #define va_end(v) __builtin_va_end(v)
  42. #define va_arg(v,l) __builtin_va_arg(v,l)
  43. #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L || defined(__GXX_EXPERIMENTAL_CXX0X__)
  44. #define va_copy(d,s) __builtin_va_copy(d,s)
  45. #endif
  46. #define __va_copy(d,s) __builtin_va_copy(d,s)
  47. /* Define va_list, if desired, from __gnuc_va_list. */
  48. /* We deliberately do not define va_list when called from
  49. stdio.h, because ANSI C says that stdio.h is not supposed to define
  50. va_list. stdio.h needs to have access to that data type,
  51. but must not use that name. It should use the name __gnuc_va_list,
  52. which is safe because it is reserved for the implementation. */
  53. #ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
  54. #undef _VA_LIST
  55. #endif
  56. #ifdef _BSD_VA_LIST
  57. #undef _BSD_VA_LIST
  58. #endif
  59. #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
  60. /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
  61. so we must avoid testing it and setting it here.
  62. SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
  63. have no conflict with that. */
  64. #ifndef _VA_LIST_
  65. #define _VA_LIST_
  66. #ifdef __i860__
  67. #ifndef _VA_LIST
  68. #define _VA_LIST va_list
  69. #endif
  70. #endif /* __i860__ */
  71. typedef __gnuc_va_list va_list;
  72. #ifdef _SCO_DS
  73. #define __VA_LIST
  74. #endif
  75. #endif /* _VA_LIST_ */
  76. #else /* not __svr4__ || _SCO_DS */
  77. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  78. But on BSD NET2 we must not test or define or undef it.
  79. (Note that the comments in NET 2's ansi.h
  80. are incorrect for _VA_LIST_--see stdio.h!) */
  81. #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
  82. /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
  83. #ifndef _VA_LIST_DEFINED
  84. /* The macro _VA_LIST is used in SCO Unix 3.2. */
  85. #ifndef _VA_LIST
  86. /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
  87. #ifndef _VA_LIST_T_H
  88. /* The macro __va_list__ is used by BeOS. */
  89. #ifndef __va_list__
  90. typedef __gnuc_va_list va_list;
  91. #endif /* not __va_list__ */
  92. #endif /* not _VA_LIST_T_H */
  93. #endif /* not _VA_LIST */
  94. #endif /* not _VA_LIST_DEFINED */
  95. #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
  96. #define _VA_LIST_
  97. #endif
  98. #ifndef _VA_LIST
  99. #define _VA_LIST
  100. #endif
  101. #ifndef _VA_LIST_DEFINED
  102. #define _VA_LIST_DEFINED
  103. #endif
  104. #ifndef _VA_LIST_T_H
  105. #define _VA_LIST_T_H
  106. #endif
  107. #ifndef __va_list__
  108. #define __va_list__
  109. #endif
  110. #endif /* not _VA_LIST_, except on certain systems */
  111. #endif /* not __svr4__ */
  112. #endif /* _STDARG_H */
  113. #endif /* not _ANSI_STDARG_H_ */
  114. #endif /* not _STDARG_H */
  115. #endif /*__GNUC__ */
  116. /* include mingw stuff */
  117. #include <_mingw_stdarg.h>