stdarg.h 4.0 KB

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