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-861f7616d084
master
Giel van Schijndel 2009-04-05 22:04:51 +00:00 committed by Git SVN Gateway
parent 9353874ef9
commit 6bdbda9343
1 changed files with 1 additions and 1 deletions

View File

@ -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)