stdarg.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* Copyright (C) 1989-2019 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 \
  40. || __cplusplus + 0 >= 201103L
  41. #define va_copy(d,s) __builtin_va_copy(d,s)
  42. #endif
  43. #define __va_copy(d,s) __builtin_va_copy(d,s)
  44. /* Define va_list, if desired, from __gnuc_va_list. */
  45. /* We deliberately do not define va_list when called from
  46. stdio.h, because ANSI C says that stdio.h is not supposed to define
  47. va_list. stdio.h needs to have access to that data type,
  48. but must not use that name. It should use the name __gnuc_va_list,
  49. which is safe because it is reserved for the implementation. */
  50. #ifdef _BSD_VA_LIST
  51. #undef _BSD_VA_LIST
  52. #endif
  53. #if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
  54. /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
  55. so we must avoid testing it and setting it here.
  56. SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
  57. have no conflict with that. */
  58. #ifndef _VA_LIST_
  59. #define _VA_LIST_
  60. #ifdef __i860__
  61. #ifndef _VA_LIST
  62. #define _VA_LIST va_list
  63. #endif
  64. #endif /* __i860__ */
  65. typedef __gnuc_va_list va_list;
  66. #ifdef _SCO_DS
  67. #define __VA_LIST
  68. #endif
  69. #endif /* _VA_LIST_ */
  70. #else /* not __svr4__ || _SCO_DS */
  71. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  72. But on BSD NET2 we must not test or define or undef it.
  73. (Note that the comments in NET 2's ansi.h
  74. are incorrect for _VA_LIST_--see stdio.h!) */
  75. #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
  76. /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
  77. #ifndef _VA_LIST_DEFINED
  78. /* The macro _VA_LIST is used in SCO Unix 3.2. */
  79. #ifndef _VA_LIST
  80. /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
  81. #ifndef _VA_LIST_T_H
  82. /* The macro __va_list__ is used by BeOS. */
  83. #ifndef __va_list__
  84. typedef __gnuc_va_list va_list;
  85. #endif /* not __va_list__ */
  86. #endif /* not _VA_LIST_T_H */
  87. #endif /* not _VA_LIST */
  88. #endif /* not _VA_LIST_DEFINED */
  89. #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
  90. #define _VA_LIST_
  91. #endif
  92. #ifndef _VA_LIST
  93. #define _VA_LIST
  94. #endif
  95. #ifndef _VA_LIST_DEFINED
  96. #define _VA_LIST_DEFINED
  97. #endif
  98. #ifndef _VA_LIST_T_H
  99. #define _VA_LIST_T_H
  100. #endif
  101. #ifndef __va_list__
  102. #define __va_list__
  103. #endif
  104. #endif /* not _VA_LIST_, except on certain systems */
  105. #endif /* not __svr4__ */
  106. #endif /* _STDARG_H */
  107. #endif /* not _ANSI_STDARG_H_ */
  108. #endif /* not _STDARG_H */