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