Fix NOT_I instruction emulation.
Fix 'struct{.float a,b;}' type confusion. Display a more helpful message when too many globals are used. Fix warnings about qcc commandline (eg when -max_regs is used). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5731 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
6ffa59d684
commit
bd29617dce
4 changed files with 39 additions and 25 deletions
|
@ -2852,8 +2852,10 @@ void GLQ1BSP_LightPointValues(model_t *model, const vec3_t point, vec3_t res_dif
|
|||
extern cvar_t r_shadow_realtime_world, r_shadow_realtime_world_lightmaps;
|
||||
#endif
|
||||
|
||||
if (!model->lightdata || r_fullbright.ival)
|
||||
if (!model->lightdata || r_fullbright.ival || model->loadstate != MLS_LOADED)
|
||||
{
|
||||
if (model->loadstate != MLS_LOADED)
|
||||
Sys_Error("GLQ1BSP_LightPointValues: model not loaded...\n");
|
||||
res_diffuse[0] = 0;
|
||||
res_diffuse[1] = 0;
|
||||
res_diffuse[2] = 0;
|
||||
|
|
|
@ -592,7 +592,7 @@ QCC_opcode_t pr_opcodes[] =
|
|||
{7, ">", "GT_FI", PC_RELATION, ASSOC_LEFT, &type_float, &type_integer, &type_integer, OPF_STD},
|
||||
|
||||
{7, "==", "EQ_IF", PC_EQUALITY, ASSOC_LEFT, &type_integer, &type_float, &type_integer, OPF_STD},
|
||||
{7, "==", "EQ_FI", PC_EQUALITY, ASSOC_LEFT, &type_float, &type_integer, &type_float, OPF_STD},
|
||||
{7, "==", "EQ_FI", PC_EQUALITY, ASSOC_LEFT, &type_float, &type_integer, &type_integer, OPF_STD},
|
||||
|
||||
//-------------------------------------
|
||||
//string manipulation.
|
||||
|
@ -1938,7 +1938,7 @@ void QCC_FinaliseTemps(void)
|
|||
if (!opt_overlaptemps || !opt_locals_overlapping)
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS - you'll need to use more optimisations");
|
||||
else
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS");
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS of %u. Increase with eg: -max_regs %u", MAX_REGS, MAX_REGS*2);
|
||||
}
|
||||
|
||||
//finalize alises so they map correctly.
|
||||
|
@ -4404,7 +4404,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
|
|||
case OP_NE_I:
|
||||
return QCC_PR_StatementFlags(&pr_opcodes[OP_NE_FNC], var_a, var_b, NULL, flags&(STFL_PRESERVEA|STFL_PRESERVEB));
|
||||
case OP_NOT_I:
|
||||
return QCC_PR_StatementFlags(&pr_opcodes[OP_NE_FNC], var_a, QCC_MakeIntConst(0), NULL, flags&(STFL_PRESERVEA));
|
||||
return QCC_PR_StatementFlags(&pr_opcodes[OP_EQ_FNC], var_a, QCC_MakeIntConst(0), NULL, flags&(STFL_PRESERVEA));
|
||||
|
||||
case OP_AND_I:
|
||||
case OP_AND_FI:
|
||||
|
@ -10221,8 +10221,8 @@ QCC_sref_t QCC_StoreSRefToRef(QCC_ref_t *dest, QCC_sref_t source, pbool readable
|
|||
QCC_PR_ParseWarning(WARN_STRICTTYPEMISMATCH, "type mismatch: %s %s to %s %s.%s", typea, QCC_GetSRefName(source), typeb, QCC_GetSRefName(dest->base), QCC_GetSRefName(dest->index));
|
||||
QCC_PR_ParsePrintDef(WARN_STRICTTYPEMISMATCH, source.sym);
|
||||
}
|
||||
else if (dest->index.cast)
|
||||
QCC_PR_ParseWarning(WARN_STRICTTYPEMISMATCH, "type mismatch: %s %s to %s[%s]", typea, QCC_GetSRefName(source), typeb, QCC_GetSRefName(dest->base), QCC_GetSRefName(dest->index));
|
||||
else if (dest->index.cast && strcmp("IMMEDIATE", dest->index.sym->name))
|
||||
QCC_PR_ParseWarning(WARN_STRICTTYPEMISMATCH, "type mismatch: %s %s to %s %s[%s]", typea, QCC_GetSRefName(source), typeb, QCC_GetSRefName(dest->base), QCC_GetSRefName(dest->index));
|
||||
else
|
||||
QCC_PR_ParseWarning(WARN_STRICTTYPEMISMATCH, "type mismatch: %s %s to %s %s", typea, QCC_GetSRefName(source), typeb, QCC_GetSRefName(dest->base));
|
||||
}
|
||||
|
|
|
@ -5824,6 +5824,10 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
|||
unsigned int arraysize;
|
||||
char *parmname;
|
||||
|
||||
pbool isnonvirt = false;
|
||||
pbool isstatic = false;
|
||||
pbool isvirt = false;
|
||||
|
||||
if (QCC_PR_CheckToken("{"))
|
||||
{
|
||||
//nameless struct
|
||||
|
@ -5883,9 +5887,6 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
|||
//in qc, functions are assignable references like anything else, so no modifiers means the qc will need to assign to it somewhere.
|
||||
//virtual functions are still references, but we initialise them somewhere
|
||||
//nonvirtual functions and static functions are kinda the same thing
|
||||
pbool isnonvirt = false;
|
||||
pbool isstatic = false;
|
||||
pbool isvirt = false;
|
||||
QCC_sref_t defaultval;
|
||||
if (QCC_PR_CheckToken("}"))
|
||||
{
|
||||
|
@ -5902,13 +5903,18 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
|||
{ //same as last type, unless initial/after-semicolon
|
||||
if (!newparm)
|
||||
QCC_PR_ParseError(ERR_EXPECTED, "element missing type");
|
||||
newparm = QCC_PR_NewType(newparm->name, newparm->type, false);
|
||||
}
|
||||
else
|
||||
{ //new type!
|
||||
if (newparm)
|
||||
QCC_PR_ParseError(ERR_EXPECTED, "missing semi-colon"); //allow a missing semi-colon on functions, for mixed-style functions.
|
||||
|
||||
//reset these...
|
||||
isnonvirt = false;
|
||||
isstatic = false;
|
||||
isvirt = false;
|
||||
|
||||
//parse field modifiers
|
||||
if (QCC_PR_CheckKeyword(1, "public"))
|
||||
/*ispublic = true*/;
|
||||
else if (QCC_PR_CheckKeyword(1, "private"))
|
||||
|
@ -5927,6 +5933,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
|||
// else if (QCC_PR_CheckKeyword(1, "strip"))
|
||||
// isignored = true;
|
||||
|
||||
//now parse the actual type.
|
||||
newparm = QCC_PR_ParseType(false, false);
|
||||
}
|
||||
type = newparm;
|
||||
|
|
|
@ -1130,7 +1130,7 @@ static void QCC_FinaliseDef(QCC_def_t *def)
|
|||
if (!opt_overlaptemps || !opt_locals_overlapping)
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS - you'll need to use more optimisations");
|
||||
else
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS");
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS of %u. Increase with eg: -max_regs %u", MAX_REGS, MAX_REGS*2);
|
||||
}
|
||||
if (def->type->type == ev_vector)
|
||||
((int *)qcc_pr_globals)[numpr_globals] = def->arraysize-1;
|
||||
|
@ -1145,7 +1145,7 @@ static void QCC_FinaliseDef(QCC_def_t *def)
|
|||
if (!opt_overlaptemps || !opt_locals_overlapping)
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS - you'll need to use more optimisations");
|
||||
else
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS");
|
||||
QCC_Error(ERR_TOOMANYGLOBALS, "numpr_globals exceeded MAX_REGS of %u. Increase with eg: -max_regs %u", MAX_REGS, MAX_REGS*2);
|
||||
}
|
||||
}
|
||||
def->ofs += numpr_globals;
|
||||
|
@ -4089,7 +4089,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
if (numsourcefiles < MAXSOURCEFILESLIST)
|
||||
strcpy(sourcefileslist[numsourcefiles++], myargv[i]);
|
||||
else
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "too many -srcfile arguments");
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "too many -srcfile arguments");
|
||||
}
|
||||
}
|
||||
else if ( !strcmp(myargv[i], "-src") )
|
||||
|
@ -4110,19 +4110,19 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
destfile_explicit = true;
|
||||
}
|
||||
else if ( !strcmp(myargv[i], "-qc") )
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Argument %s is experimental", myargv[i]); //compile without linking. output cannot be read by engines.
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Argument %s is experimental", myargv[i]); //compile without linking. output cannot be read by engines.
|
||||
else if ( !strcmp(myargv[i], "-E") )
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Argument %s is experimental", myargv[i]); //preprocess only
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Argument %s is experimental", myargv[i]); //preprocess only
|
||||
else if ( !strcmp(myargv[i], "-progdefs") )
|
||||
; //write progdefs.h
|
||||
else if ( !strcmp(myargv[i], "-copy") )
|
||||
; //copy files / write pak files
|
||||
else if ( !strcmp(myargv[i], "-bspmodels") )
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Argument %s is not supported", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Argument %s is not supported", myargv[i]);
|
||||
else if ( !strcmp(myargv[i], "-h2") || !strcmp(myargv[i], "-fteh2") || !strcmp(myargv[i], "-fte") || !strcmp(myargv[i], "-dp") )
|
||||
; //various targets
|
||||
else if ( !strcmp(myargv[i], "-pak") || !strcmp(myargv[i], "-pak2") )
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Argument %s is not supported", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Argument %s is not supported", myargv[i]);
|
||||
else
|
||||
|
||||
//compiler constant
|
||||
|
@ -4187,7 +4187,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
if (!stricmp(a, "overlap-locals"))
|
||||
opt_locals_overlapping = state;
|
||||
else
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Unrecognised optimisation parameter (%s)", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Unrecognised optimisation parameter (%s)", myargv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4215,7 +4215,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
}
|
||||
|
||||
if (!compiler_flag[p].enabled)
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Unrecognised keyword parameter (%s)", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Unrecognised keyword parameter (%s)", myargv[i]);
|
||||
}
|
||||
else if ( !strnicmp(myargv[i], "-std=", 5))
|
||||
{
|
||||
|
@ -4333,7 +4333,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
keyword_const = keyword_var = keyword_static = keyword_noref = true;
|
||||
}
|
||||
else
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Unrecognised std parameter (%s)", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Unrecognised std parameter (%s)", myargv[i]);
|
||||
}
|
||||
else if ( !strnicmp(myargv[i], "-F", 2) || WINDOWSARG(!strnicmp(myargv[i], "/F", 2)) )
|
||||
{
|
||||
|
@ -4374,7 +4374,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
//currently we always try to write lno files, when filename info isn't stripped
|
||||
if (opt_filenames)
|
||||
{
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Disabling -Ofilenames to satisfy -flno request");
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Disabling -Ofilenames to satisfy -flno request");
|
||||
opt_filenames = false;
|
||||
}
|
||||
}
|
||||
|
@ -4385,7 +4385,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
else if (!stricmp(arg, "bail-on-werror"))
|
||||
;
|
||||
else
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Unrecognised flag parameter (%s)", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Unrecognised flag parameter (%s)", myargv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4398,7 +4398,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
else
|
||||
{
|
||||
if (!QCC_OPCodeSetTargetName(myargv[i]+2))
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Unrecognised target parameter (%s)", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Unrecognised target parameter (%s)", myargv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4489,7 +4489,7 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
qccwarningaction[p] = action;
|
||||
|
||||
if (p < 0)
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Unrecognised warning parameter (%s)", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Unrecognised warning parameter (%s)", myargv[i]);
|
||||
}
|
||||
}
|
||||
else if ( !strcmp(myargv[i], "-stdout") )
|
||||
|
@ -4498,13 +4498,18 @@ static void QCC_PR_CommandLinePrecompilerOptions (void)
|
|||
else if ( !strcmp(myargv[i], "-log") || !strcmp(myargv[i], "-nolog") )
|
||||
{
|
||||
}
|
||||
else if ( !strcmp(myargv[i], "-max_regs") || !strcmp(myargv[i], "-max_strings") || !strcmp(myargv[i], "-max_globals")
|
||||
|| !strcmp(myargv[i], "-max_fields") || !strcmp(myargv[i], "-max_statements") || !strcmp(myargv[i], "-max_functions")
|
||||
|| !strcmp(myargv[i], "-max_types") || !strcmp(myargv[i], "-max_temps") || !strcmp(myargv[i], "-max_macros") )
|
||||
{
|
||||
}
|
||||
else if ( !strcmp(myargv[i], "--version") )
|
||||
{
|
||||
externs->Printf("%s\n", QCC_VersionString());
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else if (*myargv[i] == '-' || WINDOWSARG(*myargv[i] == '/'))
|
||||
QCC_PR_Warning(0, NULL, WARN_BADPARAMS, "Unrecognised parameter (%s)", myargv[i]);
|
||||
QCC_PR_Warning(WARN_BADPARAMS, "cmdline", 0, "Unrecognised parameter (%s)", myargv[i]);
|
||||
else
|
||||
{
|
||||
if (numsourcefiles < MAXSOURCEFILESLIST)
|
||||
|
|
Loading…
Reference in a new issue