Files
hackerlibultra/include/compiler/ido/stdarg.h
someone2639 c366e0122a Format the Repo (#3)
* set build options

* remove COMPARE and MDOERN_* switches

* remove tools makefile

* AR patching is gone too since we want a fullly decomped version

* AR is modern

* remove cwd changes

* edit my own tool to fix compile errors

* compile files generated with my own tool instead of the originals

* inline modern_gcc makefile

* port mips toolchain detection logic

* add util.mk for find-command

* remove forced AR order and strip/mdebug removal commands

* add -mabi=32 to as flags

* formatting changes

* add clang format files

* formatting changes

* make libgultra CI work

* install mips gcc too

* add format check tools

* Add formatting to CI

* Add CI (#4)

* make libgultra CI work

* install mips gcc too

* remove make setup

---------

Co-authored-by: someone2639 <someone2639@gmail.com>

* we don't use clang-tidy

* use 120 width for formatting

* a

* address clang-tidy messing up

* test

* align consecutive macros and declarations

* only align macros for now

* SpaceAfterCStyleCast: false

* format headers too

* remove cast space switch because its false by default

* pointers on left

* AlignConsecutiveBitFields: true

* install clang-format and clang-tidy on gh actions

* and clang-tools

* show diff in format check tool

* make CI work

---------

Co-authored-by: someone2639 <someone2639@gmail.com>
🙏
2025-02-17 22:56:09 -05:00

31 lines
1.7 KiB
C

#ifndef _STDARG_H
#define _STDARG_H
typedef char* va_list;
#define _FP 1
#define _INT 0
#define _STRUCT 2
#define _VA_FP_SAVE_AREA 0x10
#define _VA_ALIGN(p, a) (((unsigned int)(((char*)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
#define va_start(vp, parmN) (vp = ((va_list) & parmN + sizeof(parmN)))
#define __va_stack_arg(list, mode) \
(((list) = (char*)_VA_ALIGN(list, __builtin_alignof(mode)) + _VA_ALIGN(sizeof(mode), 4)), \
(((char*)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
#define __va_double_arg(list, mode) \
((((long)list & 0x1) /* 1 byte aligned? */ \
? (list = (char*)((long)list + 7), (char*)((long)list - 6 - _VA_FP_SAVE_AREA)) \
: (((long)list & 0x2) /* 2 byte aligned? */ \
? (list = (char*)((long)list + 10), (char*)((long)list - 24 - _VA_FP_SAVE_AREA)) \
: __va_stack_arg(list, mode))))
#define va_arg(list, mode) \
((mode*)(((__builtin_classof(mode) == _FP && __builtin_alignof(mode) == sizeof(double)) \
? __va_double_arg(list, mode) \
: __va_stack_arg(list, mode))))[-1]
#define va_end(__list)
#endif /* STDARG_H */