// Copyright (c) 2025, Zak Fenton // Zak Fenton's libc is licensed under the Mulan PSL v2. You can use this // software according to the terms and conditions of the Mulan PSL v2. // You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 // THIS SOFTWARE IS PROVIDED ON AN “AS IS” BASIS, WITHOUT warranties of // any kind, either express or implied, including but not limited to // non-infringement, merchantability or fit for a particular purpose. // See the Mulan PSL v2 for more details. #ifndef _LIBC_STDARG_H #define _LIBC_STDARG_H #ifdef _ZCC typedef long long** va_list; #define _VA_CHECK() \ if (__builtin_func_callconv != 101) {\ printf("ERROR: Unpacking varargs currently only works with __classic_call (#101). Function %s uses convention %d instead.\n", __func__, __builtin_func_callconv);\ } #define va_start(list,lastarg) \ do {\ _VA_CHECK();\ list = &lastarg;\ list++;\ } while(0) #define va_arg(list,T) \ (*((T*)(list++))) #define va_end(list) \ do {list = (void*)0;} while(0) /* Not new C compiler, use GCC ABI */ #else #define va_list __builtin_va_list #define va_start __builtin_va_start #define va_end __builtin_va_end #define va_arg __builtin_va_arg #endif /* From ifndef at top of file: */ #endif