Fix up some more C compat issues. And some general qcc bugfixes that would have affected qc code too.
This commit is contained in:
parent
0df247d4c1
commit
247f186a68
14 changed files with 881 additions and 323 deletions
|
@ -3,7 +3,7 @@ int Grep(const char *filename, const char *string);
|
|||
void EditFile(const char *name, int line, pbool setcontrol);
|
||||
|
||||
void GUI_SetDefaultOpts(void);
|
||||
int GUI_BuildParms(const char *args, const char **argv, pbool quick);
|
||||
int GUI_BuildParms(const char *args, const char **argv, int argv_size, pbool quick);
|
||||
|
||||
//unsigned char *PDECL QCC_ReadFile (const char *fname, void *buffer, int len, size_t *sz);
|
||||
int QCC_RawFileSize (const char *fname);
|
||||
|
|
|
@ -475,10 +475,13 @@ enum qcop_e {
|
|||
OP_ADD_FP,
|
||||
OP_ADD_PI,
|
||||
OP_ADD_IP,
|
||||
OP_ADD_PU,
|
||||
OP_ADD_UP,
|
||||
|
||||
OP_SUB_SI,
|
||||
OP_SUB_PF,
|
||||
OP_SUB_PI,
|
||||
OP_SUB_PU,
|
||||
|
||||
OP_SUB_PP,
|
||||
|
||||
|
|
|
@ -1640,20 +1640,20 @@ static casecmprange_t casecmprange[] =
|
|||
casecmprange_i //func
|
||||
};
|
||||
|
||||
#define RUNAWAYCHECK() \
|
||||
#define RUNAWAYCHECK() \
|
||||
if (!--*runaway) \
|
||||
{ \
|
||||
prinst.pr_xstatement = st-pr_statements; \
|
||||
{ \
|
||||
prinst.pr_xstatement = st-pr_statements; \
|
||||
PR_RunError (&progfuncs->funcs, "runaway loop error\n");\
|
||||
PR_StackTrace(&progfuncs->funcs,false); \
|
||||
externs->Printf ("runaway loop error\n"); \
|
||||
while(prinst.pr_depth > prinst.exitdepth) \
|
||||
PR_LeaveFunction(progfuncs); \
|
||||
PR_StackTrace(&progfuncs->funcs,false); \
|
||||
externs->Printf ("runaway loop error\n"); \
|
||||
while(prinst.pr_depth > prinst.exitdepth) \
|
||||
PR_LeaveFunction(progfuncs); \
|
||||
prinst.spushed = 0; \
|
||||
return -1; \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
#if defined(FTE_TARGET_WEB) || defined(SIMPLE_QCVM)
|
||||
#if defined(SIMPLE_QCVM)
|
||||
static int PR_NoDebugVM(progfuncs_t *fte_restrict progfuncs)
|
||||
{
|
||||
char stack[4*1024];
|
||||
|
@ -1691,7 +1691,7 @@ static int PR_ExecuteCode16 (progfuncs_t *fte_restrict progfuncs, int s, int *ft
|
|||
st = &pr_statements16[s];
|
||||
while (progfuncs->funcs.debug_trace || prinst.watch_ptr || prinst.profiling)
|
||||
{
|
||||
#if defined(FTE_TARGET_WEB) || defined(SIMPLE_QCVM)
|
||||
#if defined(SIMPLE_QCVM)
|
||||
reeval16:
|
||||
//this can generate huge functions, so disable it on systems that can't realiably cope with such things (IE initiates an unwanted denial-of-service attack when pointed our javascript, and firefox prints a warning too)
|
||||
prinst.pr_xstatement = st-pr_statements16;
|
||||
|
@ -1716,7 +1716,7 @@ static int PR_ExecuteCode16 (progfuncs_t *fte_restrict progfuncs, int s, int *ft
|
|||
|
||||
static int PR_ExecuteCode32 (progfuncs_t *fte_restrict progfuncs, int s, int *fte_restrict runaway)
|
||||
{
|
||||
#if defined(FTE_TARGET_WEB) ||defined(SIMPLE_QCVM)
|
||||
#if defined(SIMPLE_QCVM)
|
||||
//this can generate huge functions, so disable it on systems that can't realiably cope with such things (IE initiates an unwanted denial-of-service attack when pointed our javascript, and firefox prints a warning too)
|
||||
prinst.pr_xstatement = s;
|
||||
PR_RunError (&progfuncs->funcs, "32bit qc statement support was disabled for this platform.\n");
|
||||
|
|
|
@ -169,7 +169,7 @@ typedef struct prinst_s
|
|||
int pr_depth;
|
||||
|
||||
//locals
|
||||
#define LOCALSTACK_SIZE 65536 //in words
|
||||
#define LOCALSTACK_SIZE (65536*16) //in words
|
||||
int *localstack;
|
||||
int localstack_used;
|
||||
int spushed; //extra
|
||||
|
|
|
@ -409,9 +409,10 @@ typedef struct QCC_type_s
|
|||
unsigned int size; //FIXME: make bytes, for bytes+shorts
|
||||
pbool typedefed:1; //name is in the typenames list.
|
||||
pbool vargs:1; //function has vargs
|
||||
pbool vargtodouble:1; //promote floats to double when passing vargs (set according to flag_assume_double, on the def's type, so it can be enabled/disabled as required to deal with builtins
|
||||
pbool vargcount:1; //function has special varg count param
|
||||
unsigned int bits;//valid for bitfields (and structs).
|
||||
unsigned int align:7;
|
||||
unsigned int bits;//valid for bitfields (and structs).
|
||||
const char *name;
|
||||
const char *aname;
|
||||
|
||||
|
@ -472,6 +473,7 @@ typedef struct QCC_def_s
|
|||
pbool subscoped_away:1; //this local is no longer linked into the locals hash table. don't do remove it twice.
|
||||
// pbool followptr:1; //float &foo;
|
||||
pbool strip:1; //info about this def should be stripped. it may still consume globals space however, and its storage can still be used, its just not visible.
|
||||
pbool nostrip:1; //don't strip reflection data for this symbol.
|
||||
pbool allowinline:1; //calls to this function will attempt to inline the specified function. requires const, supposedly.
|
||||
pbool used:1; //if it remains 0, it may be stripped. this is forced for functions and fields. commonly 0 on fields.
|
||||
pbool unused:1; //silently strip it if it wasn't referenced.
|
||||
|
@ -484,6 +486,8 @@ typedef struct QCC_def_s
|
|||
pbool initialized:1; //true when a declaration included "= immediate".
|
||||
pbool isextern:1; //fteqw-specific lump entry
|
||||
pbool isparameter:1; //its an engine parameter (thus preinitialised).
|
||||
pbool addressed:1; //warned about it once, back off now.
|
||||
pbool autoderef:1; //like C++'s int &foo; - probably local pointers to alloca memory.
|
||||
const char *deprecated; //reason its deprecated (or empty for no reason given)
|
||||
|
||||
int fromstatement; //statement that it is valid from.
|
||||
|
@ -506,10 +510,15 @@ typedef struct
|
|||
enum{
|
||||
REF_GLOBAL, //(global.ofs) - use vector[2] is an array ref or vector_z
|
||||
REF_ARRAY, //(global.ofs+wordoffset) - constant offsets should be direct references, variable offsets will generally result in function calls
|
||||
REF_ARRAYHEAD,//(global) - like REF_ARRAY, but otherwise convert to a pointer.
|
||||
REF_POINTER,//*(pointerdef+wordindex) - maths...
|
||||
REF_ARRAYHEAD,//(global) - like REF_ARRAY, but otherwise convert to a pointer. check arraysize for length.
|
||||
|
||||
REF_POINTER,//*(pointerdef+alignindex) - maths...
|
||||
REF_POINTERARRAY,//(pointerdef+alignindex) - head of an array. &REF_POINTER but with array size info. cannot be directly assigned to.
|
||||
|
||||
REF_FIELD, //(entity.field) - reading is a single load, writing requires address+storep
|
||||
|
||||
REF_STRING, //"hello"[1]=='e' - special opcodes, or str2chr builtin, or something
|
||||
|
||||
REF_NONVIRTUAL, //(global.ofs) - identical to global except for function calls, where index can be used to provide the 'newself' for the call.
|
||||
REF_THISCALL, //(global.ofs) - identical to global except for function calls, where index is used as the first argument.
|
||||
REF_ACCESSOR //buf_create()[5]
|
||||
|
@ -519,6 +528,7 @@ typedef struct
|
|||
unsigned int bitofs; //for bitfields.
|
||||
QCC_sref_t index;
|
||||
QCC_type_t *cast; //entity.float is float, not pointer.
|
||||
unsigned int arraysize; //for sizeof/boundchecks, not much else.
|
||||
struct accessor_s *accessor; //the accessor field of base that we're trying to use
|
||||
int postinc; //+1 or -1
|
||||
pbool readonly; //for whatever reason, like base being a const
|
||||
|
@ -656,6 +666,8 @@ extern pbool keyword_integer;
|
|||
extern pbool keyword_long;
|
||||
extern pbool keyword_signed;
|
||||
extern pbool keyword_unsigned;
|
||||
extern pbool keyword_register;
|
||||
extern pbool keyword_volatile;
|
||||
extern pbool keyword_state;
|
||||
extern pbool keyword_string;
|
||||
extern pbool keyword_struct;
|
||||
|
@ -683,6 +695,7 @@ extern pbool keyword_using;
|
|||
|
||||
extern pbool keyword_unused;
|
||||
extern pbool keyword_used;
|
||||
extern pbool keyword_local;
|
||||
extern pbool keyword_static;
|
||||
extern pbool keyword_nonstatic;
|
||||
extern pbool keyword_ignore;
|
||||
|
@ -794,7 +807,7 @@ QCC_type_t *QCC_PR_PointerType (QCC_type_t *pointsto);
|
|||
const char *QCC_VarAtOffset(QCC_sref_t ref);
|
||||
|
||||
void QCC_PrioritiseOpcodes(void);
|
||||
int QCC_PR_IntConstExpr(void);
|
||||
long QCC_PR_IntConstExpr(void);
|
||||
|
||||
#ifndef COMMONINLINES
|
||||
pbool QCC_PR_CheckImmediate (const char *string);
|
||||
|
@ -876,6 +889,7 @@ enum {
|
|||
WARN_DEADCODE,
|
||||
WARN_UNREACHABLECODE,
|
||||
WARN_NOTSTANDARDBEHAVIOUR,
|
||||
WARN_BOUNDS,
|
||||
WARN_DUPLICATEPRECOMPILER,
|
||||
WARN_IDENTICALPRECOMPILER,
|
||||
WARN_FORMATSTRING, //sprintf
|
||||
|
@ -888,9 +902,11 @@ enum {
|
|||
WARN_EXTENSION_USED, //extension that frikqcc also understands
|
||||
WARN_IFSTRING_USED,
|
||||
WARN_IFVECTOR_DISABLED, //if(vector) does if(vector_x) if ifvector is disabled
|
||||
WARN_SLOW_LARGERETURN, //just a perf warning. also requires working pointers but that'll give opcode errors
|
||||
WARN_LAXCAST, //some errors become this with a compiler flag
|
||||
WARN_TYPEMISMATCHREDECOPTIONAL,
|
||||
WARN_UNDESIRABLECONVENTION,
|
||||
WARN_UNSAFELOCALPOINTER,
|
||||
WARN_SAMENAMEASGLOBAL,
|
||||
WARN_CONSTANTCOMPARISON,
|
||||
WARN_DIVISIONBY0,
|
||||
|
@ -1100,6 +1116,8 @@ void QCC_PR_NewLine (pbool incomment);
|
|||
#define GDF_SCANLOCAL 256 //don't use the locals hash table
|
||||
#define GDF_POSTINIT 512 //field must be initialised at the end of the compile (allows arrays to be extended later)
|
||||
#define GDF_PARAMETER 1024
|
||||
#define GDF_AUTODEREF 2048 //for hidden pointers (alloca-ed locals)
|
||||
#define GDF_ALIAS 4096
|
||||
QCC_def_t *QCC_PR_GetDef (QCC_type_t *type, const char *name, struct QCC_function_s *scope, pbool allocate, int arraysize, unsigned int flags);
|
||||
QCC_sref_t QCC_PR_GetSRef (QCC_type_t *type, const char *name, struct QCC_function_s *scope, pbool allocate, int arraysize, unsigned int flags);
|
||||
void QCC_FreeTemp(QCC_sref_t t);
|
||||
|
|
|
@ -620,7 +620,7 @@ const char *QCC_ReadParm (const char *check)
|
|||
return myargv[i+1];
|
||||
}
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -366,21 +366,18 @@ static int ParsePrecompilerIf(int level)
|
|||
{ //simple token...
|
||||
if (!strncmp(pr_file_p, "defined", 7))
|
||||
{
|
||||
pbool brackets;
|
||||
pr_file_p+=7;
|
||||
while (*pr_file_p == ' ' || *pr_file_p == '\t')
|
||||
pr_file_p++;
|
||||
if (*pr_file_p != '(')
|
||||
{
|
||||
eval = false;
|
||||
QCC_PR_ParseError(ERR_EXPECTED, "no opening bracket after defined\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
pr_file_p++;
|
||||
brackets = *pr_file_p == '(';
|
||||
pr_file_p += brackets;
|
||||
|
||||
QCC_PR_SimpleGetToken();
|
||||
eval = !!QCC_PR_CheckCompConstDefined(pr_token);
|
||||
QCC_PR_SimpleGetToken();
|
||||
eval = !!QCC_PR_CheckCompConstDefined(pr_token);
|
||||
|
||||
if (brackets)
|
||||
{
|
||||
while (*pr_file_p == ' ' || *pr_file_p == '\t')
|
||||
pr_file_p++;
|
||||
if (*pr_file_p != ')')
|
||||
|
@ -986,6 +983,12 @@ static pbool QCC_PR_Precompiler(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (pr_error_count) //if we had an error, don't keep including more stuff that'll hide the actual error.
|
||||
{
|
||||
pr_file_p = "";
|
||||
QCC_PR_ParseError(0, NULL);
|
||||
}
|
||||
|
||||
QCC_FindBestInclude(pr_token, compilingfile, true);
|
||||
|
||||
if (*pr_file_p == '\r')
|
||||
|
@ -1028,6 +1031,12 @@ static pbool QCC_PR_Precompiler(void)
|
|||
msg[a] = 0;
|
||||
pr_file_p++;
|
||||
|
||||
if (pr_error_count) //if we had an error, don't keep including more stuff that'll hide the actual error.
|
||||
{
|
||||
pr_file_p = "";
|
||||
QCC_PR_ParseError(0, NULL);
|
||||
}
|
||||
|
||||
QCC_FindBestInclude(msg, compilingfile, false);
|
||||
|
||||
QCC_PR_SkipToEndOfLine(true);
|
||||
|
@ -1613,6 +1622,8 @@ int QCC_PR_LexEscapedCodepoint(void)
|
|||
}
|
||||
else if (c == '\\')
|
||||
c = '\\';
|
||||
else if (c == '?') //triglyphs are dumb.
|
||||
c = '?';
|
||||
else if (c == '\'')
|
||||
c = '\'';
|
||||
else if (c >= '0' && c <= '9')
|
||||
|
@ -2310,8 +2321,16 @@ static void QCC_PR_LexVector (void)
|
|||
{//extended character constant
|
||||
pr_file_p++;
|
||||
pr_token_type = tt_immediate;
|
||||
pr_immediate_type = type_float;
|
||||
pr_immediate._float = QCC_PR_LexEscapedCodepoint();
|
||||
if (flag_assume_integer)
|
||||
{
|
||||
pr_immediate_type = type_integer;
|
||||
pr_immediate._int = QCC_PR_LexEscapedCodepoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
pr_immediate_type = type_float;
|
||||
pr_immediate._float = QCC_PR_LexEscapedCodepoint();
|
||||
}
|
||||
if (*pr_file_p != '\'')
|
||||
QCC_PR_ParseError (ERR_INVALIDVECTORIMMEDIATE, "Bad character constant");
|
||||
pr_file_p++;
|
||||
|
@ -2321,25 +2340,38 @@ static void QCC_PR_LexVector (void)
|
|||
{
|
||||
int b = utf8_check(pr_file_p, &pr_immediate._int); //utf-8 codepoint.
|
||||
pr_token_type = tt_immediate;
|
||||
pr_immediate_type = type_float;
|
||||
if (flag_qccx)
|
||||
QCC_PR_ParseWarning(WARN_DENORMAL, "char constant: denormal");
|
||||
if (flag_assume_integer)
|
||||
pr_immediate_type = type_integer;
|
||||
else
|
||||
pr_immediate._float = pr_immediate._int;
|
||||
{
|
||||
pr_immediate_type = type_float;
|
||||
if (flag_qccx)
|
||||
QCC_PR_ParseWarning(WARN_DENORMAL, "char constant: denormal");
|
||||
else
|
||||
pr_immediate._float = pr_immediate._int;
|
||||
}
|
||||
pr_file_p+=b+1;
|
||||
return;
|
||||
}
|
||||
else if (pr_file_p[1] == '\'')
|
||||
{//character constant
|
||||
pr_token_type = tt_immediate;
|
||||
pr_immediate_type = type_float;
|
||||
if (flag_qccx)
|
||||
if (flag_assume_integer)
|
||||
{
|
||||
QCC_PR_ParseWarning(WARN_DENORMAL, "char constant: denormal");
|
||||
pr_immediate._int = pr_file_p[0];
|
||||
pr_immediate_type = type_integer;
|
||||
pr_immediate._int = (unsigned char)pr_file_p[0];
|
||||
}
|
||||
else
|
||||
pr_immediate._float = pr_file_p[0];
|
||||
{
|
||||
pr_immediate_type = type_float;
|
||||
if (flag_qccx)
|
||||
{
|
||||
QCC_PR_ParseWarning(WARN_DENORMAL, "char constant: denormal");
|
||||
pr_immediate._int = pr_file_p[0];
|
||||
}
|
||||
else
|
||||
pr_immediate._float = pr_file_p[0];
|
||||
}
|
||||
pr_file_p+=2;
|
||||
return;
|
||||
}
|
||||
|
@ -2985,7 +3017,7 @@ void QCC_PR_PreProcessor_Define(pbool append)
|
|||
{
|
||||
int nl;
|
||||
nl = pr_file_p-s;
|
||||
while(qcc_iswhitesameline(s[nl]))
|
||||
while(nl > 0 && qcc_iswhitesameline(s[nl-1]))
|
||||
nl--;
|
||||
if (cnst->numparams >= MAXCONSTANTPARAMS)
|
||||
QCC_PR_ParseError(ERR_MACROTOOMANYPARMS, "May not have more than %i parameters to a macro", MAXCONSTANTPARAMS);
|
||||
|
@ -3166,6 +3198,9 @@ so if present, the preceeding \\\n and following \\\n must become an actual \n i
|
|||
d++;
|
||||
s++;
|
||||
}
|
||||
|
||||
while (d>dbuf && qcc_iswhitesameline(d[-1]))
|
||||
d--;
|
||||
*d = '\0';
|
||||
|
||||
cnst->value = dbuf;
|
||||
|
@ -4601,7 +4636,12 @@ static int typecmp_strict(QCC_type_t *a, QCC_type_t *b)
|
|||
i = a->num_parms;
|
||||
while(i-- > 0)
|
||||
{
|
||||
if (STRCMP(a->params[i].paramname, b->params[i].paramname))
|
||||
if (!a->params[i].paramname || !b->params[i].paramname)
|
||||
{
|
||||
if (a->params[i].paramname || b->params[i].paramname)
|
||||
return 1; //two array types getting compared?
|
||||
}
|
||||
else if (STRCMP(a->params[i].paramname, b->params[i].paramname))
|
||||
return 1;
|
||||
if (typecmp_strict(a->params[i].type, b->params[i].type))
|
||||
return 1;
|
||||
|
@ -4779,10 +4819,13 @@ QCC_type_t *QCC_PR_DuplicateType(QCC_type_t *in, pbool recurse)
|
|||
memcpy(out->params, in->params, sizeof(*out->params) * out->num_parms);
|
||||
out->accessors = in->accessors;
|
||||
out->size = in->size;
|
||||
out->bits = in->bits;
|
||||
out->align = in->align;
|
||||
out->num_parms = in->num_parms;
|
||||
out->name = in->name;
|
||||
out->parentclass = in->parentclass;
|
||||
out->vargs = in->vargs;
|
||||
out->vargtodouble = in->vargtodouble;
|
||||
out->vargcount = in->vargcount;
|
||||
|
||||
return out;
|
||||
|
@ -4873,6 +4916,8 @@ char *TypeName(QCC_type_t *type, char *buffer, int buffersize)
|
|||
pbool vargs = type->vargs;
|
||||
unsigned int i;
|
||||
Q_strlcat(buffer, type->aux_type->name, buffersize);
|
||||
if (type->vargtodouble)
|
||||
Q_strlcat(buffer, "(*)", buffersize); //make it distinctly C-ey
|
||||
Q_strlcat(buffer, "(", buffersize);
|
||||
for (i = 0; i < type->num_parms; )
|
||||
{
|
||||
|
@ -5059,27 +5104,52 @@ QCC_type_t *QCC_PR_MakeThiscall(QCC_type_t *orig, QCC_type_t *thistype)
|
|||
return orig;
|
||||
}
|
||||
|
||||
QCC_type_t *QCC_PR_ParseArrayType(QCC_type_t *basetype, int *arraysize)
|
||||
{
|
||||
int dims = 0;
|
||||
unsigned long dim[64];
|
||||
dim[0] = 0;
|
||||
do
|
||||
{
|
||||
if (dims == sizeof(dim)/sizeof(dim[0]))
|
||||
QCC_PR_ParseError(ERR_NOTANAME, "too many dimensions");
|
||||
dim[dims] = QCC_PR_IntConstExpr();
|
||||
if (!dim[dims])
|
||||
QCC_PR_ParseError(ERR_NOTANAME, "cannot cope with 0-sized arrays");
|
||||
dims++;
|
||||
QCC_PR_Expect("]");
|
||||
} while (QCC_PR_CheckToken("["));
|
||||
while(dims-- > 1)
|
||||
basetype = QCC_GenArrayType(basetype, dim[dims]);
|
||||
*arraysize = dim[0];
|
||||
return basetype;
|
||||
}
|
||||
|
||||
//expects a ( to have already been parsed.
|
||||
QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
||||
{
|
||||
QCC_type_t *ftype, *t;
|
||||
QCC_type_t *ftype = NULL, *t;
|
||||
char *name;
|
||||
int definenames = !recursivefunctiontype;
|
||||
int numparms = 0;
|
||||
struct QCC_typeparam_s paramlist[MAX_PARMS+MAX_EXTRA_PARMS];
|
||||
|
||||
if (QCC_PR_PeekToken("*"))
|
||||
return NULL; //C pointer-to-function. this ain't the args.
|
||||
|
||||
recursivefunctiontype++;
|
||||
|
||||
ftype = QCC_PR_NewType(type_function->name, ev_function, false);
|
||||
|
||||
ftype->aux_type = returntype; // return type
|
||||
ftype->num_parms = 0;
|
||||
|
||||
if (definenames)
|
||||
pr_parm_argcount_name = NULL;
|
||||
|
||||
if (QCC_PR_CheckToken (")"))
|
||||
{
|
||||
if (!ftype)
|
||||
{
|
||||
ftype = QCC_PR_NewType(type_function->name, ev_function, false);
|
||||
ftype->aux_type = returntype; // return type
|
||||
ftype->num_parms = 0;
|
||||
}
|
||||
if (!flag_qcfuncs)
|
||||
ftype->vargs = true; //'void name()' is vargs/undefined in C89 (disallowed in c99, interpreted as void in c23).
|
||||
}
|
||||
|
@ -5087,8 +5157,9 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
|||
{
|
||||
do
|
||||
{
|
||||
pbool foundinout;
|
||||
if (ftype->num_parms>=MAX_PARMS+MAX_EXTRA_PARMS)
|
||||
int inout = -1;
|
||||
pbool isopt = false;
|
||||
if (numparms>=MAX_PARMS+MAX_EXTRA_PARMS)
|
||||
QCC_PR_ParseError(ERR_TOOMANYTOTALPARAMETERS, "Too many parameters. Sorry. (limit is %i)\n", MAX_PARMS+MAX_EXTRA_PARMS);
|
||||
|
||||
if (QCC_PR_CheckToken ("..."))
|
||||
|
@ -5096,50 +5167,56 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
|||
t = QCC_PR_ParseType(false, true, false); //the evil things I do...
|
||||
if (!t)
|
||||
{
|
||||
if (!ftype)
|
||||
{
|
||||
ftype = QCC_PR_NewType(type_function->name, ev_function, false);
|
||||
ftype->aux_type = returntype; // return type
|
||||
ftype->num_parms = 0;
|
||||
}
|
||||
ftype->vargs = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{ //its a ... followed by a type... don't bug out...
|
||||
{ //its a ... followed by a type...
|
||||
//undo the damage from having parsed the ... already.
|
||||
t = QCC_PR_FieldType(t);
|
||||
t = QCC_PR_FieldType(t);
|
||||
t = QCC_PR_FieldType(t);
|
||||
paramlist[numparms].type = t;
|
||||
foundinout = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foundinout = false;
|
||||
paramlist[numparms].optional = false;
|
||||
paramlist[numparms].isvirtual = false;
|
||||
paramlist[numparms].out = false;
|
||||
|
||||
pbool maybename = numparms==0;
|
||||
while(1)
|
||||
{
|
||||
if (!paramlist[numparms].optional && QCC_PR_CheckKeyword(keyword_optional, "optional"))
|
||||
paramlist[numparms].optional = true;
|
||||
else if (!foundinout && QCC_PR_CheckKeyword(keyword_inout, "inout"))
|
||||
{
|
||||
paramlist[numparms].out = true;
|
||||
foundinout = true;
|
||||
}
|
||||
else if (!foundinout && QCC_PR_CheckKeyword(keyword_inout, "out"))
|
||||
{
|
||||
paramlist[numparms].out = 2; //not really supported, but parsed for readability.
|
||||
foundinout = true;
|
||||
}
|
||||
else if (!foundinout && QCC_PR_CheckKeyword(keyword_inout, "in"))
|
||||
{
|
||||
paramlist[numparms].out = false;
|
||||
foundinout = true;
|
||||
}
|
||||
if (!isopt && QCC_PR_CheckKeyword(keyword_optional, "optional"))
|
||||
isopt = true;
|
||||
else if (inout<0 && QCC_PR_CheckKeyword(keyword_inout, "inout"))
|
||||
inout = true;
|
||||
else if (inout<0 && QCC_PR_CheckKeyword(keyword_inout, "out"))
|
||||
inout = 2;
|
||||
else if (inout<0 && QCC_PR_CheckKeyword(keyword_inout, "in"))
|
||||
inout = false;
|
||||
else
|
||||
break;
|
||||
maybename=false; //if we parsed something meaningful then its not a `void(name)(type)` thing
|
||||
}
|
||||
|
||||
t = QCC_PR_ParseType(false, false, false);
|
||||
t = QCC_PR_ParseType(false, maybename, false);
|
||||
if (!t)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!ftype)
|
||||
{
|
||||
ftype = QCC_PR_NewType(type_function->name, ev_function, false);
|
||||
ftype->aux_type = returntype; // return type
|
||||
ftype->num_parms = 0;
|
||||
}
|
||||
|
||||
paramlist[numparms].optional = isopt;
|
||||
paramlist[numparms].isvirtual = false;
|
||||
paramlist[numparms].out = inout>=0?inout:0;
|
||||
paramlist[numparms].defltvalue.cast = NULL;
|
||||
paramlist[numparms].ofs = 0;
|
||||
paramlist[numparms].arraysize = 0;
|
||||
|
@ -5153,10 +5230,9 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
|||
if (paramlist[numparms].type->type == ev_void)
|
||||
break; //float(void) has no actual args
|
||||
|
||||
if (!foundinout && QCC_PR_CheckToken("&"))
|
||||
if (inout < 0 && QCC_PR_CheckToken("&"))
|
||||
{ //accept c++ syntax, at least on arguments. its not quite the same, but it'll do.
|
||||
paramlist[numparms].out = true;
|
||||
foundinout = true;
|
||||
}
|
||||
|
||||
// type->name = "FUNC PARAMETER";
|
||||
|
@ -5178,6 +5254,8 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
|||
|
||||
QCC_PR_Expect("(");
|
||||
paramlist[numparms].type = QCC_PR_ParseFunctionType(false, paramlist[numparms].type);
|
||||
if (!paramlist[numparms].type)
|
||||
QCC_PR_ParseError(ERR_BADNOTTYPE, "expected function arg list");
|
||||
}
|
||||
else
|
||||
name = QCC_PR_ParseName ();
|
||||
|
@ -5194,12 +5272,21 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
|||
}
|
||||
else
|
||||
{ //proper array
|
||||
paramlist[numparms].arraysize = QCC_PR_IntConstExpr();
|
||||
if (!paramlist[numparms].arraysize)
|
||||
QCC_PR_ParseError(ERR_NOTANAME, "cannot cope with 0-sized arrays");
|
||||
QCC_PR_Expect("]");
|
||||
int arraysize;
|
||||
paramlist[numparms].type = QCC_PR_ParseArrayType(paramlist[numparms].type, &arraysize);
|
||||
|
||||
if (flag_qcfuncs)
|
||||
paramlist[numparms].arraysize = arraysize;
|
||||
else
|
||||
paramlist[numparms].type = QCC_PointerTypeTo(paramlist[numparms].type); //just turn it into a pointer and ditch the top-level size. C style.
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag_qcfuncs)
|
||||
{ //if its an array type, promote it to pointer here.
|
||||
if (t->type == ev_union && t->num_parms == 1 && !t->params[0].paramname)
|
||||
paramlist[numparms].type = QCC_PointerTypeTo(t->params[0].type);
|
||||
}
|
||||
}
|
||||
else if (definenames)
|
||||
strcpy (pr_parm_names[numparms], "");
|
||||
|
@ -5229,14 +5316,12 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
|||
else
|
||||
QCC_PR_Expect (")");
|
||||
}
|
||||
ftype->vargtodouble = flag_assume_double;
|
||||
ftype->num_parms = numparms;
|
||||
ftype->params = qccHunkAlloc(sizeof(*ftype->params) * numparms);
|
||||
memcpy(ftype->params, paramlist, sizeof(*ftype->params) * numparms);
|
||||
recursivefunctiontype--;
|
||||
|
||||
if (returntype->size > 3 && !autoprototype) //fixme: handle properly, without breaking __out
|
||||
QCC_PR_ParseWarning(WARN_UNDESIRABLECONVENTION, "Unable to handle functions returning structures larger than a vector. Will truncate.");
|
||||
|
||||
if (newtype)
|
||||
return ftype;
|
||||
return QCC_PR_FindType (ftype);
|
||||
|
@ -5720,19 +5805,15 @@ static QCC_type_t *QCC_PR_ParseStruct(etype_t structtype)
|
|||
else
|
||||
parmname = QCC_PR_ParseName();
|
||||
definedsomething = true;
|
||||
while (QCC_PR_CheckToken("["))
|
||||
{
|
||||
int nsize=QCC_PR_IntConstExpr();
|
||||
if (arraysize)
|
||||
type = QCC_GenArrayType(type, arraysize);
|
||||
if (!nsize)
|
||||
QCC_PR_ParseError(ERR_NOTANAME, "cannot cope with 0-sized arrays");
|
||||
QCC_PR_Expect("]");
|
||||
arraysize = nsize;
|
||||
}
|
||||
if (QCC_PR_CheckToken("["))
|
||||
type = QCC_PR_ParseArrayType(type, &arraysize); //Checks for [][y][x] arrays.
|
||||
|
||||
if (QCC_PR_CheckToken("("))
|
||||
{
|
||||
type = QCC_PR_ParseFunctionType(false, type);
|
||||
if (!type)
|
||||
QCC_PR_ParseError(ERR_BADNOTTYPE, "expected function arg list");
|
||||
}
|
||||
}
|
||||
|
||||
if (type == newt || ((type->type == ev_struct || type->type == ev_union) && !type->size))
|
||||
|
@ -6096,6 +6177,8 @@ QCC_type_t *QCC_PR_ParseEntClass(void)
|
|||
else if (!flag_qcfuncs && basetype == newt && QCC_PR_CheckToken("("))
|
||||
{
|
||||
newparm = QCC_PR_ParseFunctionType(false, type_void);
|
||||
if (!newparm)
|
||||
QCC_PR_ParseError(ERR_BADNOTTYPE, "expected function arg list");
|
||||
parmname = classname;
|
||||
arraysize = 0;
|
||||
}
|
||||
|
@ -6114,6 +6197,8 @@ QCC_type_t *QCC_PR_ParseEntClass(void)
|
|||
{
|
||||
//int fnc(), fld; is valid.
|
||||
newparm = QCC_PR_ParseFunctionType(false, basetype);
|
||||
if (!newparm)
|
||||
QCC_PR_ParseError(ERR_BADNOTTYPE, "expected function arg list");
|
||||
}
|
||||
else
|
||||
newparm = basetype;
|
||||
|
@ -6519,6 +6604,8 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail, pbool ignoreptr)
|
|||
QCC_PR_ParseWarning (WARN_IGNOREDKEYWORD, "ignoring unsupported const keyword");
|
||||
silentfail = false; //FIXME
|
||||
}
|
||||
if (QCC_PR_CheckKeyword(keyword_volatile, "volatile")) //we don't really support this - everything is volatile.
|
||||
silentfail = false;
|
||||
|
||||
if (QCC_PR_PeekToken ("...") ) //this is getting stupid
|
||||
{
|
||||
|
@ -6735,6 +6822,8 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail, pbool ignoreptr)
|
|||
#define longlongbits 64
|
||||
#define longbits (flag_ILP32?32:64)
|
||||
|
||||
if (QCC_PR_CheckKeyword(keyword_register, "register")) //allow a leading register keyword. technically EVERYTHING is a register in qc, so we can just ignore this.
|
||||
isokay = true;
|
||||
while(true)
|
||||
{
|
||||
if (!isunsigned && !issigned && QCC_PR_CheckKeyword(keyword_signed, "signed"))
|
||||
|
@ -6831,6 +6920,8 @@ wasctype:
|
|||
{
|
||||
type_inlinefunction = true;
|
||||
type = QCC_PR_ParseFunctionType(newtype, type);
|
||||
if (!type)
|
||||
QCC_PR_ParseError(ERR_BADNOTTYPE, "expected function arg list");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -6728,7 +6728,7 @@ void compilecb(void)
|
|||
void Sys_Error(const char *text, ...);
|
||||
void RunCompiler(char *args, pbool quick)
|
||||
{
|
||||
const char *argv[128];
|
||||
const char *argv[256];
|
||||
int argc;
|
||||
progexterns_t ext;
|
||||
progfuncs_t funcs;
|
||||
|
@ -6795,9 +6795,10 @@ void RunCompiler(char *args, pbool quick)
|
|||
if (SplitterGet(outputbox))
|
||||
SendMessage(outputbox, WM_SETREDRAW, FALSE, 0);
|
||||
|
||||
argc = GUI_BuildParms(args, argv, quick);
|
||||
|
||||
if (CompileParams(&funcs, outputbox?compilecb:NULL, argc, argv))
|
||||
argc = GUI_BuildParms(args, argv, sizeof(argv)/sizeof(argv[0]), quick);
|
||||
if (!argc)
|
||||
ext.Printf("Too many args\n");
|
||||
else if (CompileParams(&funcs, outputbox?compilecb:NULL, argc, argv))
|
||||
{
|
||||
if (!quick)
|
||||
{
|
||||
|
|
|
@ -2093,7 +2093,7 @@ static int Dummyprintf(const char *msg, ...){return 0;}
|
|||
void RunCompiler(const char *args, pbool quick)
|
||||
{
|
||||
static FILE *logfile;
|
||||
const char *argv[128];
|
||||
const char *argv[256];
|
||||
int argc;
|
||||
|
||||
mainwnd->docs.saveAll();
|
||||
|
@ -2122,9 +2122,10 @@ void RunCompiler(const char *args, pbool quick)
|
|||
else
|
||||
logfile = NULL;
|
||||
|
||||
argc = GUI_BuildParms(args, argv, quick);
|
||||
|
||||
if (CompileParams(&guiprogfuncs, NULL, argc, argv))
|
||||
argc = GUI_BuildParms(args, argv, sizeof(argv)/sizeof(argv[0]), quick);
|
||||
if (!argc)
|
||||
guiprogexterns.Printf("Too many args\n");
|
||||
else if (CompileParams(&guiprogfuncs, NULL, argc, argv))
|
||||
{
|
||||
if (!quick)
|
||||
{
|
||||
|
@ -2613,4 +2614,4 @@ static void DebuggerStart(void)
|
|||
// GUIprintf("Child is running\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -939,7 +939,7 @@ void GUI_RevealOptions(void)
|
|||
|
||||
|
||||
|
||||
int GUI_BuildParms(const char *args, const char **argv, pbool quick)//, char *forceoutputfile)
|
||||
int GUI_BuildParms(const char *args, const char **argv, int argv_size, pbool quick)//, char *forceoutputfile)
|
||||
{
|
||||
static char param[2048];
|
||||
int paramlen = 0;
|
||||
|
@ -1030,6 +1030,9 @@ int GUI_BuildParms(const char *args, const char **argv, pbool quick)//, char *fo
|
|||
while (*args <= ' '&& *args)
|
||||
args++;
|
||||
|
||||
if (argc >= argv_size)
|
||||
return 0;
|
||||
|
||||
for (next = args; *next>' '; next++)
|
||||
;
|
||||
strncpy(param+paramlen, args, next-args);
|
||||
|
|
|
@ -264,10 +264,14 @@ struct {
|
|||
//Q618: Ran out of mem pointer space (malloc failure again)
|
||||
|
||||
//we can put longer alternative names here...
|
||||
{" field-redeclared", WARN_REMOVEDWARNING},
|
||||
{" deprecated", WARN_DEPRECATEDVARIABLE},
|
||||
{" field-redeclared", WARN_REMOVEDWARNING},
|
||||
{" deprecated", WARN_DEPRECATEDVARIABLE},
|
||||
{" bounds", WARN_BOUNDS},
|
||||
|
||||
{" unimplemented", WARN_IGNOREDKEYWORD},
|
||||
{" octal", WARN_OCTAL_IMMEDIATE},
|
||||
{" unimplemented", WARN_IGNOREDKEYWORD},
|
||||
{" localptr", WARN_UNSAFELOCALPOINTER},
|
||||
{" largereturn", WARN_SLOW_LARGERETURN},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
@ -357,9 +361,12 @@ compiler_flag_t compiler_flag[] = {
|
|||
{&keyword_char, nondefaultkeyword, "char", "Keyword: char", "Disables the 'char' keyword."},
|
||||
{&keyword_signed, nondefaultkeyword, "signed", "Keyword: signed", "Disables the 'signed' keyword."},
|
||||
{&keyword_unsigned, defaultkeyword, "unsigned", "Keyword: unsigned", "Disables the 'unsigned' keyword."},
|
||||
{&keyword_register, nondefaultkeyword, "register", "Keyword: register", "Disables the 'register' keyword."},
|
||||
{&keyword_volatile, nondefaultkeyword, "volatile", "Keyword: volatile", "Disables the 'volatile' keyword."},
|
||||
{&keyword_noref, defaultkeyword, "noref", "Keyword: noref", "Disables the 'noref' keyword."}, //nowhere else references this, don't warn about it.
|
||||
{&keyword_unused, nondefaultkeyword, "unused", "Keyword: unused", "Disables the 'unused' keyword. 'unused' means that the variable is unused, you're aware that its unused, and you'd rather not know about all the warnings this results in."},
|
||||
{&keyword_used, nondefaultkeyword, "used", "Keyword: used", "Disables the 'used' keyword. 'used' means that the variable is used even if the qcc can't see how - thus preventing it from ever being stripped."},
|
||||
{&keyword_local, defaultkeyword, "local", "Keyword: local", "Disables the 'local' keyword."},
|
||||
{&keyword_static, defaultkeyword, "static", "Keyword: static", "Disables the 'static' keyword. 'static' means that a variable has altered scope. On globals, the variable is visible only to the current .qc file. On locals, the variable's value does not change between calls to the function. On class variables, specifies that the field is a scoped global instead of a local. On class functions, specifies that 'this' is expected to be invalid and that the function will access any memembers via it."},
|
||||
{&keyword_nonstatic, defaultkeyword, "nonstatic", "Keyword: nonstatic", "Disables the 'nonstatic' keyword. 'nonstatic' acts upon globals+functions, reverting the defaultstatic pragma on a per-variable basis. For use by people who prefer to keep their APIs explicit."},
|
||||
{&keyword_ignore, nondefaultkeyword, "ignore", "Keyword: ignore", "Disables the 'ignore' keyword. 'ignore' is expected to typically be hidden behind a 'csqconly' define, and in such a context can be used to conditionally compile functions a little more gracefully. The opposite of the 'used' keyword. These variables/functions/members are ALWAYS stripped, and effectively ignored."},
|
||||
|
@ -1546,9 +1553,10 @@ static void QCC_FinaliseDef(QCC_def_t *def)
|
|||
QCC_Error(ERR_INTERNAL, "unknown reloc type... %s", def->type->name);
|
||||
}
|
||||
|
||||
if (def->deftail)
|
||||
{
|
||||
QCC_def_t *prev, *sub;
|
||||
for (prev = def, sub = prev->next; sub && prev != def->deftail; sub = (prev=sub)->next)
|
||||
for (prev = def, sub = prev->next; prev != def->deftail; sub = (prev=sub)->next)
|
||||
{
|
||||
if (sub->reloc && !sub->used)
|
||||
{ //make sure any children are finalised properly if they're relocs.
|
||||
|
@ -2025,7 +2033,7 @@ static pbool QCC_WriteData (int crc)
|
|||
{
|
||||
if (!local->used)
|
||||
{ //all params should have been assigned space. logically we could have safely omitted the last ones, but blurgh.
|
||||
QCC_PR_Warning(ERR_INTERNAL, local->filen, local->s_line, "Argument %s was not marked used.\n", local->name);
|
||||
QCC_PR_Warning(ERR_INTERNAL, local->filen, local->s_line, "Argument %s was not marked used.", local->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2235,12 +2243,15 @@ static pbool QCC_WriteData (int crc)
|
|||
continue;
|
||||
}
|
||||
else if (def->type->type == ev_pointer && (def->symboldata[0]._int & 0x80000000))
|
||||
def->name = ""; //reloc, can't strip it (engine needs to fix em up), but can clear its name.
|
||||
{
|
||||
if (opt_constant_names && !def->nostrip)
|
||||
def->name = ""; //reloc, can't strip it (engine needs to fix em up), but can clear its name.
|
||||
}
|
||||
else if (def->scope && !def->scope->privatelocals && !def->isstatic)
|
||||
continue; //def is a local, which got shared and should be 0...
|
||||
else if ((def->scope||def->constant||(flag_noreflection&&strncmp(def->name, "autocvar_", 9))) && (def->type->type != ev_string || (strncmp(def->name, "dotranslate_", 12) && opt_constant_names_strings)))
|
||||
else if (((opt_constant_names&&(def->scope||def->constant))||(flag_noreflection&&strncmp(def->name, "autocvar_", 9))) && (def->type->type != ev_string || (strncmp(def->name, "dotranslate_", 12) && opt_constant_names_strings)))
|
||||
{
|
||||
if (opt_constant_names)
|
||||
if (!def->nostrip)
|
||||
{
|
||||
if (def->type->type == ev_string)
|
||||
optres_constant_names_strings += strlen(def->name);
|
||||
|
@ -3671,7 +3682,7 @@ static void QCC_PR_BeginCompilation (void *memory, int memsize)
|
|||
type_floatfunction->aux_type = type_float;
|
||||
|
||||
type_bfloat = QCC_PR_NewType("__bfloat", ev_boolean, true); type_bfloat->parentclass = type_float; //has value 0.0 or 1.0
|
||||
type_bint = QCC_PR_NewType("__bint", ev_boolean, true); type_bint->parentclass = type_uint; //has value 0 or 1
|
||||
type_bint = QCC_PR_NewType("__bint", ev_boolean, true); type_bint->parentclass = type_integer; //has value 0 or 1
|
||||
|
||||
//type_field->aux_type = type_float;
|
||||
|
||||
|
@ -4000,6 +4011,7 @@ static unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
int f;
|
||||
unsigned short crc;
|
||||
// int c;
|
||||
pbool hassystemfield = false;
|
||||
|
||||
file[0] = '\0';
|
||||
|
||||
|
@ -4016,7 +4028,7 @@ static unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
ADD_CRC(" */\n\ntypedef struct");
|
||||
ADD_ONLY(" globalvars_s");
|
||||
ADD_CRC(qcva("\n{"));
|
||||
ADD_ONLY("\tint pad;\n"
|
||||
ADD_ONLY("\n\tint ofs_null;\n"
|
||||
"\tint ofs_return[3];\n" //makes it easier with the get globals func
|
||||
"\tint ofs_parm0[3];\n"
|
||||
"\tint ofs_parm1[3];\n"
|
||||
|
@ -4035,6 +4047,8 @@ static unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
continue;
|
||||
// if (d->symbolheader->ofs<RESERVED_OFS)
|
||||
// continue;
|
||||
if (d->symbolheader != d)
|
||||
continue;
|
||||
|
||||
switch (d->type->type)
|
||||
{
|
||||
|
@ -4103,7 +4117,10 @@ static unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
ADD_CRC(qcva("\tint\t%s;\n",d->name));
|
||||
break;
|
||||
}
|
||||
hassystemfield = true;
|
||||
}
|
||||
if (!hassystemfield)
|
||||
ADD_ONLY(qcva("\tint\tplaceholder_; //no system fields\n"));
|
||||
ADD_CRC("} entvars_t;\n\n");
|
||||
|
||||
/*
|
||||
|
@ -4690,12 +4707,12 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
keyword_asm = false;
|
||||
keyword_break = keyword_continue = keyword_for = keyword_goto = keyword_const = keyword_extern = keyword_static = true;
|
||||
keyword_switch = keyword_case = keyword_default = true;
|
||||
keyword_accessor = keyword_class = keyword_var = keyword_inout = keyword_optional = keyword_state = keyword_inline = keyword_nosave = keyword_shared = keyword_noref = keyword_unused = keyword_used = keyword_nonstatic = keyword_ignore = keyword_strip = false;
|
||||
keyword_accessor = keyword_class = keyword_var = keyword_inout = keyword_optional = keyword_state = keyword_inline = keyword_nosave = keyword_shared = keyword_noref = keyword_unused = keyword_used = keyword_local = keyword_nonstatic = keyword_ignore = keyword_strip = false;
|
||||
|
||||
keyword_vector = keyword_entity = keyword_float = keyword_string = false; //not to be confused with actual types, but rather the absence of the keyword local.
|
||||
keyword_integer = keyword_enumflags = false;
|
||||
keyword_float = keyword_int = keyword_typedef = keyword_struct = keyword_union = keyword_enum = true;
|
||||
keyword_double = keyword_long = keyword_short = keyword_char = keyword_signed = keyword_unsigned = true;
|
||||
keyword_double = keyword_long = keyword_short = keyword_char = keyword_signed = keyword_unsigned = keyword_register = keyword_volatile = true;
|
||||
keyword_thinktime = keyword_until = keyword_loop = false;
|
||||
|
||||
flag_ILP32 = true; //C code generally expects intptr_t==size_t==long, we'll get better compat if we don't give it surprises.
|
||||
|
@ -4781,6 +4798,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
}
|
||||
else if (!strcmp(myargv[i]+5, "hcc") || !strcmp(myargv[i]+5, "hexenc"))
|
||||
{
|
||||
qcc_framerate = 20;
|
||||
flag_ifvector = flag_vectorlogic = false;
|
||||
flag_macroinstrings = false;
|
||||
|
||||
|
@ -5162,6 +5180,7 @@ static void QCC_SetDefaultProperties (void)
|
|||
qccwarningaction[WARN_NOTUTF8] = WA_IGNORE;
|
||||
qccwarningaction[WARN_UNINITIALIZED] = WA_IGNORE; //not sure about this being ignored by default.
|
||||
qccwarningaction[WARN_SELFNOTTHIS] = WA_IGNORE;
|
||||
qccwarningaction[WARN_UNSAFELOCALPOINTER] = WA_IGNORE; //only an issue with recursion. and annoying.
|
||||
qccwarningaction[WARN_EVILPREPROCESSOR] = WA_ERROR; //evil people do evil things. evil must be thwarted!
|
||||
qccwarningaction[WARN_IDENTICALPRECOMPILER] = WA_IGNORE;
|
||||
qccwarningaction[WARN_DENORMAL] = WA_ERROR; //DAZ provides a speedup on modern machines, so any engine compiled for sse2+ will have problems with denormals, so make their use look serious.
|
||||
|
|
|
@ -61,11 +61,10 @@ extern QCC_type_t *type_intpointer;
|
|||
extern QCC_type_t *type_floatfield;// = {ev_field/*, &def_field*/, NULL, &type_float};
|
||||
QCC_type_t *QCC_PR_NewType (char *name, int basictype, pbool typedefed);
|
||||
|
||||
#if 0
|
||||
|
||||
jmp_buf decompilestatementfailure;
|
||||
|
||||
#if 0
|
||||
|
||||
QCC_type_t **ofstype;
|
||||
qbyte *ofsflags;
|
||||
|
||||
|
|
|
@ -751,7 +751,7 @@ void runtest(const char *progsname, const char **args)
|
|||
ext.globalbuiltins = builtins;
|
||||
|
||||
pf = InitProgs(&ext);
|
||||
pf->Configure(pf, 1024*1024, 1, false); //memory quantity of 1mb. Maximum progs loadable into the instance of 1
|
||||
pf->Configure(pf, 1024*1024*64, 1, false); //memory quantity of 1mb. Maximum progs loadable into the instance of 1
|
||||
//If you support multiple progs types, you should tell the VM the offsets here, via RegisterFieldVar
|
||||
pn = pf->LoadProgs(pf, progsname); //load the progs.
|
||||
if (pn < 0)
|
||||
|
@ -853,7 +853,7 @@ int main(int argc, const char **argv)
|
|||
const char *dat = NULL;
|
||||
if (argc < 2)
|
||||
{
|
||||
printf("Invalid arguments!\nPlease run as, for example:\n%s testprogs.dat -srcfile progs.src\nThe first argument is the name of the progs.dat to run, the remaining arguments are the qcc args to use", argv[0]);
|
||||
printf("Invalid arguments!\nPlease run as, for example:\n%s testprogs.dat -srcfile progs.src\nThe first argument is the name of the progs.dat to run, the remaining arguments are the qcc args to use\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue