stdarg.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* Copyright (C) 1989-2015 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 3, 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. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. /*
  19. * ISO C Standard: 7.15 Variable arguments <stdarg.h>
  20. */
  21. #ifndef _STDARG_H
  22. #ifndef _ANSI_STDARG_H_
  23. #ifndef __need___va_list
  24. #define _STDARG_H
  25. #define _ANSI_STDARG_H_
  26. #endif /* not __need___va_list */
  27. #undef __need___va_list
  28. /* Define __gnuc_va_list. */
  29. #ifndef __GNUC_VA_LIST
  30. #define __GNUC_VA_LIST
  31. typedef __builtin_va_list __gnuc_va_list;
  32. #endif
  33. /* Define the standard macros for the user,
  34. if this invocation was from the user program. */
  35. #ifdef _STDARG_H
  36. #define va_start(v,l) __builtin_va_start(v,l)
  37. #define va_end(v) __builtin_va_end(v)
  38. #define va_arg(v,l) __builtin_va_arg(v,l)
  39. #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L || defined(__GXX_EXPERIMENTAL_CXX0X__)
  40. #define va_copy(d,s) __builtin_va_copy(d,s)
  41. #endif
  42. #define __va_copy(d,s) __builtin_va_copy(d,s)
  43. /* Define va_list, if desired, from __gnuc_va_list. */
  44. /* We deliberately do not define va_list when called from
  45. stdio.h, because ANSI C says that stdio.h is not supposed to define
  46. va_list. stdio.h needs to have access to that data type,
  47. but must not use that name. It should use the name __gnuc_va_list,
  48. which is safe because it is reserved for the implementation. */
  49. #ifdef _BSD_VA_LIST
  50. #undef _BSD_VA_LIST
  51. #endif
  52. #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
  53. /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
  54. so we must avoid testing it and setting it here.
  55. SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
  56. have no conflict with that. */
  57. #ifndef _VA_LIST_
  58. #define _VA_LIST_
  59. #ifdef __i860__
  60. #ifndef _VA_LIST
  61. #define _VA_LIST va_list
  62. #endif
  63. #endif /* __i860__ */
  64. typedef __gnuc_va_list va_list;
  65. #ifdef _SCO_DS
  66. #define __VA_LIST
  67. #endif
  68. #endif /* _VA_LIST_ */
  69. #else /* not __svr4__ || _SCO_DS */
  70. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  71. But on BSD NET2 we must not test or define or undef it.
  72. (Note that the comments in NET 2's ansi.h
  73. are incorrect for _VA_LIST_--see stdio.h!) */
  74. #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
  75. /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
  76. #ifndef _VA_LIST_DEFINED
  77. /* The macro _VA_LIST is used in SCO Unix 3.2. */
  78. #ifndef _VA_LIST
  79. /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
  80. #ifndef _VA_LIST_T_H
  81. /* The macro __va_list__ is used by BeOS. */
  82. #ifndef __va_list__
  83. typedef __gnuc_va_list va_list;
  84. #endif /* not __va_list__ */
  85. #endif /* not _VA_LIST_T_H */
  86. #endif /* not _VA_LIST */
  87. #endif /* not _VA_LIST_DEFINED */
  88. #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
  89. #define _VA_LIST_
  90. #endif
  91. #ifndef _VA_LIST
  92. #define _VA_LIST
  93. #endif
  94. #ifndef _VA_LIST_DEFINED
  95. #define _VA_LIST_DEFINED
  96. #endif
  97. #ifndef _VA_LIST_T_H
  98. #define _VA_LIST_T_H
  99. #endif
  100. #ifndef __va_list__
  101. #define __va_list__
  102. #endif
  103. #endif /* not _VA_LIST_, except on certain systems */
  104. #endif /* not __svr4__ */
  105. #endif /* _STDARG_H */
  106. #endif /* not _ANSI_STDARG_H_ */
  107. #endif /* not _STDARG_H */