Allow code passing and retrieving of enums as vararg parameters in C++ as well.
In C++ enums are treated differently from integers in some cases, causing GCC to emit some rather nasty abort()-like code (x86/x64 instruction "ud2a") when used as the type for va_arg(). This was the compiler message generated: {{{ stack.c:339: warning: ‘INTERP_TYPE’ is promoted to ‘int’ when passed through ‘...’ stack.c:339: note: (so you should pass ‘int’ not ‘INTERP_TYPE’ to ‘va_arg’) stack.c:339: note: if this code is reached, the program will abort }}} NOTE: Compiling as C++ now works (as does the produced code), using: {{{./configure CC=g++ CFLAGS=-fpermissive --enable-debug=relaxed}}} git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6957 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
9353874ef9
commit
6bdbda9343
|
@ -336,7 +336,7 @@ BOOL stackPopParams(unsigned int numParams, ...)
|
|||
for (i = 0; i < numParams; i++)
|
||||
{
|
||||
INTERP_VAL *psVal = psCurr->aVals + index;
|
||||
INTERP_TYPE type = va_arg(args, INTERP_TYPE);
|
||||
INTERP_TYPE type = (INTERP_TYPE)va_arg(args, int);
|
||||
void * pData = va_arg(args, void *);
|
||||
|
||||
switch (type)
|
||||
|
|
Loading…
Reference in New Issue