Change va_start to not depend on the last fixed argument.

This is necessary to work correctly if the last fixed argument is of type double and #pragma extensions bit 1 is clear. It will also be necessary for C23, where va_start does not require the LastFixedParm argument. (For now, however, we stick with the pre-C23 definition of va_start where that argument needs to be supplied, even though it is now ignored.)
This commit is contained in:
Stephen Heumann 2022-12-08 19:15:53 -06:00
parent fb5a2fcf33
commit 6ba6ad549f
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ typedef char *__va_list[2];
typedef __va_list va_list;
#define va_end(ap) __record_va_info(ap)
#define va_start(ap,LastFixedParm) ((void) ((ap)[0] = (char *) (&LastFixedParm + 1), (ap)[1] = (char *)&__orcac_va_info))
#define va_start(ap,LastFixedParm) ((void) ((ap)[0] = (char *)__orcac_va_info[1], (ap)[1] = (char *)&__orcac_va_info))
#define va_arg(ap,type) _Generic(*(type *)0, \
double: (type)((long double *)((ap)[0] += sizeof(long double)))[-1], \
default: ((type *)((ap)[0] += sizeof(type)))[-1])