Commit Graph

6 Commits

Author SHA1 Message Date
Stephen Heumann 6ba6ad549f 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.)
2022-12-08 19:15:53 -06:00
Stephen Heumann 26d0f2ad35 Add the va_copy macro (from C99).
The previous changes to varargs handling enable this to work.
2021-10-23 22:36:53 -05:00
Stephen Heumann a20d69a211 Revise variable argument handling to better comply with standards.
In the new implementation, variable arguments are not removed until the end of the function. This allows variable argument processing to be restarted, and it prevents the addresses of local variables from changing in the middle of the function. The requirement to turn off stack repair code around varargs functions is also removed.

This fixes #58.
2021-10-23 22:36:34 -05:00
Stephen Heumann 438942692a Make va_arg(ap,double) work correctly.
This was not working because floating-point arguments are really passed in the extended format, but based on the wording in the C standard a type of "double" should still work for arguments passed with that type.

This fixes #29. (The bug report was valid only with respect to double, not float or long double.)
2021-09-03 21:25:20 -05:00
Stephen Heumann 463da80902 Small tweaks to <stdarg.h>.
*Use a typedef rather than a macro definition for va_list. (The C standards specify that va_list is a type, although this would make a practical difference only if someone #undef'd it.)

*Don't include a semicolon in va_start(), so it expands to an expression rather than a statement. This could make a difference in a construct like "if (...) va_start(...); else ...".
2018-08-28 18:58:27 -05:00
Stephen Heumann 3225a54d76 Move ORCACDefs directory to root level. 2017-10-21 20:21:37 -05:00