be a little more relaxed about fteextensions.qc / dpextensions.qc conflicts.
disable ssl3 support because its too outdated. add autocvar intrinsic, so that defining autocvars inline inside code is easier: autocvar(fred, 5) will create the 'fred' cvar and return its current value. does not make sense at global scope. qcc -v -v double-verbose argument will now generate autocvar listings (parses comments / intrinsic 3rd arg to provide a comment). These can be directly copied into your mod's default.cfg file in the appropriate place, if you wish to publicise all such autocvars easily. tweak fteqccgui to not repaint so often. this solves issues with mods with thousands of warnings spamming like crazy and taking ages to compile. these mods exist. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4929 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
a85f3c5c71
commit
c1b23f843b
6 changed files with 235 additions and 53 deletions
|
@ -8,6 +8,20 @@ cvar_t *tls_ignorecertificateerrors;
|
|||
#include <sspi.h>
|
||||
#include <schannel.h>
|
||||
|
||||
#define SP_PROT_TLS1_1_SERVER 0x00000100
|
||||
#define SP_PROT_TLS1_1_CLIENT 0x00000200
|
||||
|
||||
#define SP_PROT_TLS1_2_SERVER 0x00000400
|
||||
#define SP_PROT_TLS1_2_CLIENT 0x00000800
|
||||
|
||||
#define SP_PROT_DTLS_SERVER 0x00010000
|
||||
#define SP_PROT_DTLS_CLIENT 0x00020000
|
||||
|
||||
//avoid the use of outdated/insecure protocols
|
||||
//so no ssl2/ssl3
|
||||
#define USE_PROT_SERVER (SP_PROT_TLS1_SERVER | SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_2_SERVER)
|
||||
#define USE_PROT_CLIENT (SP_PROT_TLS1_CLIENT | SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT)
|
||||
|
||||
//hungarian ensures we hit no macros.
|
||||
static struct
|
||||
{
|
||||
|
@ -61,7 +75,7 @@ void SSL_Init(void)
|
|||
};
|
||||
|
||||
tls_ignorecertificateerrors = Cvar_Get("tls_ignorecertificateerrors", "0", CVAR_NOTFROMSERVER, "TLS");
|
||||
|
||||
|
||||
if (!secur.lib)
|
||||
secur.lib = Sys_LoadLibrary("secur32.dll", secur_functable);
|
||||
if (!crypt.lib)
|
||||
|
@ -526,7 +540,7 @@ static void SSPI_GenServerCredentials(sslfile_t *f)
|
|||
|
||||
memset(&SchannelCred, 0, sizeof(SchannelCred));
|
||||
SchannelCred.dwVersion = SCHANNEL_CRED_VERSION;
|
||||
SchannelCred.grbitEnabledProtocols = (SP_PROT_TLS1|SP_PROT_SSL3) & SP_PROT_SERVERS;
|
||||
SchannelCred.grbitEnabledProtocols = USE_PROT_SERVER;
|
||||
SchannelCred.dwFlags |= SCH_CRED_NO_SYSTEM_MAPPER|SCH_CRED_DISABLE_RECONNECTS; /*don't use windows login info or anything*/
|
||||
|
||||
cred = SSPI_GetServerCertificate();
|
||||
|
@ -585,7 +599,7 @@ static void SSPI_Handshake (sslfile_t *f)
|
|||
|
||||
memset(&SchannelCred, 0, sizeof(SchannelCred));
|
||||
SchannelCred.dwVersion = SCHANNEL_CRED_VERSION;
|
||||
SchannelCred.grbitEnabledProtocols = SP_PROT_TLS1 | SP_PROT_SSL3;
|
||||
SchannelCred.grbitEnabledProtocols = USE_PROT_CLIENT;
|
||||
SchannelCred.dwFlags |= SCH_CRED_NO_DEFAULT_CREDS; /*don't use windows login info or anything*/
|
||||
|
||||
ss = secur.pAcquireCredentialsHandleA (NULL, UNISP_NAME_A, SECPKG_CRED_OUTBOUND, NULL, &SchannelCred, NULL, NULL, &f->cred, &Lifetime);
|
||||
|
|
|
@ -83,7 +83,7 @@ void QCC_FinishCompile(void);
|
|||
|
||||
int comp_nump;char **comp_parms;
|
||||
//void Editor(char *fname, int line, int numparms, char **compileparms);
|
||||
pbool CompileParams(progfuncs_t *progfuncs, int doall, int nump, char **parms)
|
||||
pbool CompileParams(progfuncs_t *progfuncs, void(*cb)(void), int nump, char **parms)
|
||||
{
|
||||
comp_nump = nump;
|
||||
comp_parms = parms;
|
||||
|
@ -103,7 +103,12 @@ pbool CompileParams(progfuncs_t *progfuncs, int doall, int nump, char **parms)
|
|||
return false;
|
||||
|
||||
while(qcc_compileactive)
|
||||
{
|
||||
if (cb)
|
||||
cb();
|
||||
|
||||
QCC_ContinueCompile();
|
||||
}
|
||||
|
||||
PostCompile();
|
||||
|
||||
|
@ -201,7 +206,7 @@ pbool CompileFile(progfuncs_t *progfuncs, const char *filename)
|
|||
// p[2][strlen(p[2])-4] = '\0';
|
||||
// strcat(p[2], "/");
|
||||
|
||||
while (!CompileParams(progfuncs, true, parms, p))
|
||||
while (!CompileParams(progfuncs, NULL, parms, p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -631,7 +631,7 @@ extern int optres_locals_overlapping;
|
|||
extern int optres_logicops;
|
||||
extern int optres_inlines;
|
||||
|
||||
pbool CompileParams(progfuncs_t *progfuncs, int doall, int nump, char **parms);
|
||||
pbool CompileParams(progfuncs_t *progfuncs, void(*cb)(void), int nump, char **parms);
|
||||
|
||||
void QCC_PR_PrintStatement (QCC_statement_t *s);
|
||||
|
||||
|
@ -738,6 +738,7 @@ enum {
|
|||
WARN_STRICTTYPEMISMATCH, //self.think = T_Damage; both are functions, but the arguments/return types/etc differ.
|
||||
WARN_MISUSEDAUTOCVAR, //various issues with autocvar definitions.
|
||||
WARN_IGNORECOMMANDLINE,
|
||||
WARN_COMPATIBILITYHACK, //work around old defs.qc or invalid dpextensions.qc
|
||||
|
||||
ERR_PARSEERRORS, //caused by qcc_pr_parseerror being called.
|
||||
|
||||
|
|
|
@ -4933,6 +4933,43 @@ QCC_sref_t QCC_PR_ParseFunctionCall (QCC_ref_t *funcref) //warning, the func cou
|
|||
|
||||
return result;
|
||||
}
|
||||
else if (!strcmp(funcname, "autocvar") && !QCC_PR_CheckToken(")"))
|
||||
{
|
||||
char autocvarname[256];
|
||||
char *desc = NULL;
|
||||
QCC_FreeTemp(func);
|
||||
QC_snprintfz(autocvarname, sizeof(autocvarname), "autocvar_%s", QCC_PR_ParseName());
|
||||
QCC_PR_Expect(",");
|
||||
e = QCC_PR_Expression(TOP_PRIORITY, EXPR_DISALLOW_COMMA);
|
||||
if (QCC_PR_CheckToken(","))
|
||||
{
|
||||
if (pr_token_type == tt_immediate && pr_immediate_type->type == ev_string)
|
||||
{ //okay, its a string immediate, consume it for the description, being careful to not generate any string immediate defs (which still require an entry in the string table).
|
||||
desc = qccHunkAlloc(strlen(pr_immediate_string)+1);
|
||||
strcpy(desc, pr_immediate_string);
|
||||
QCC_PR_Lex ();
|
||||
}
|
||||
}
|
||||
QCC_PR_Expect(")");
|
||||
d = QCC_PR_GetSRef(e.cast, autocvarname, NULL, true, 0, GDF_USED);
|
||||
if (!d.sym->comment)
|
||||
d.sym->comment = desc;
|
||||
if (!e.sym->constant)
|
||||
QCC_PR_ParseWarning(ERR_BADIMMEDIATETYPE, "autocvar default value is not constant");
|
||||
|
||||
if (d.sym->initialized)
|
||||
{
|
||||
if (memcmp(&d.sym->symboldata[d.ofs], &e.sym->symboldata[e.ofs], d.sym->symbolsize*sizeof(int)))
|
||||
QCC_PR_ParseErrorPrintSRef (ERR_REDECLARATION, d, "autocvar %s was already initialised with another value", autocvarname+9);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&d.sym->symboldata[d.ofs], &e.sym->symboldata[e.ofs], d.sym->symbolsize*sizeof(int));
|
||||
d.sym->initialized = true;
|
||||
}
|
||||
QCC_FreeTemp(e);
|
||||
return d;
|
||||
}
|
||||
else if (!strcmp(funcname, "entnum") && !QCC_PR_CheckToken(")"))
|
||||
{
|
||||
//t = (a/%1) / (nextent(world)/%1)
|
||||
|
@ -5132,20 +5169,22 @@ QCC_sref_t QCC_PR_ParseFunctionCall (QCC_ref_t *funcref) //warning, the func cou
|
|||
if (arg+1==np && !strcmp(QCC_GetSRefName(func), "makestatic"))
|
||||
{
|
||||
//vanilla QC sucks. I want fteextensions.qc to compile with vanilla, yet also result in errors for when the mod fucks up.
|
||||
QCC_PR_ParseWarning (WARN_BADPARAMS, "too few parameters on call to %s. Passing 'self'.", QCC_GetSRefName(func));
|
||||
QCC_PR_ParsePrintSRef (WARN_BADPARAMS, func);
|
||||
QCC_PR_ParseWarning (WARN_COMPATIBILITYHACK, "too few parameters on call to %s. Passing 'self'.", QCC_GetSRefName(func));
|
||||
QCC_PR_ParsePrintSRef (WARN_COMPATIBILITYHACK, func);
|
||||
|
||||
param[arg] = QCC_PR_GetSRef(NULL, "self", NULL, 0, 0, false);
|
||||
paramtypes[arg] = param[arg].cast;
|
||||
arg++;
|
||||
}
|
||||
else if (arg+1==np && !strcmp(QCC_GetSRefName(func), "ai_charge"))
|
||||
{
|
||||
//vanilla QC sucks. I want fteextensions.qc to compile with vanilla, yet also result in errors for when the mod fucks up.
|
||||
QCC_PR_ParseWarning (WARN_BADPARAMS, "too few parameters on call to %s. Passing 0.", QCC_GetSRefName(func));
|
||||
QCC_PR_ParsePrintSRef (WARN_BADPARAMS, func);
|
||||
QCC_PR_ParseWarning (WARN_COMPATIBILITYHACK, "too few parameters on call to %s. Passing 0.", QCC_GetSRefName(func));
|
||||
QCC_PR_ParsePrintSRef (WARN_COMPATIBILITYHACK, func);
|
||||
|
||||
param[arg] = QCC_MakeFloatConst(0);
|
||||
paramtypes[arg] = param[arg].cast;
|
||||
arg++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6284,6 +6323,7 @@ QCC_ref_t *QCC_PR_ParseRefValue (QCC_ref_t *refbuf, QCC_type_t *assumeclass, pbo
|
|||
else if ( (!strcmp(name, "randomv")) ||
|
||||
(!strcmp(name, "sizeof")) ||
|
||||
(!strcmp(name, "entnum")) ||
|
||||
(!strcmp(name, "autocvar")) ||
|
||||
(!strcmp(name, "va_arg")) ||
|
||||
(!strcmp(name, "...")) || //for compat. otherwise wtf?
|
||||
(!strcmp(name, "_")) ) //intrinsics, any old function with no args will do.
|
||||
|
@ -7897,7 +7937,8 @@ QCC_ref_t *QCC_PR_RefExpression (QCC_ref_t *retbuf, int priority, int exprflags)
|
|||
|
||||
if (pr_token_type != tt_punct)
|
||||
{
|
||||
QCC_PR_ParseWarning(WARN_UNEXPECTEDPUNCT, "Expected punctuation");
|
||||
if (priority == TOP_PRIORITY)
|
||||
QCC_PR_ParseWarning(WARN_UNEXPECTEDPUNCT, "Expected punctuation");
|
||||
}
|
||||
|
||||
if (priority == 6)
|
||||
|
@ -11266,6 +11307,19 @@ QCC_def_t *QCC_PR_GetDef (QCC_type_t *type, char *name, struct QCC_function_s *s
|
|||
|
||||
if (!allocate)
|
||||
arraysize = -1;
|
||||
else if (!strncmp(name, "autocvar_", 9))
|
||||
{
|
||||
if (scope)
|
||||
QCC_PR_ParseWarning(WARN_MISUSEDAUTOCVAR, "Autocvar \"%s\" defined with local scope. promoting to global.", name);
|
||||
else if (flags & GDF_CONST)
|
||||
QCC_PR_ParseWarning(WARN_MISUSEDAUTOCVAR, "Autocvar \"%s\" defined as constant. attempting to correct that for you.", name);
|
||||
else if (flags & GDF_STATIC)
|
||||
QCC_PR_ParseWarning(WARN_MISUSEDAUTOCVAR, "Autocvar \"%s\" defined as static. attempting to correct that for you.", name);
|
||||
scope = NULL;
|
||||
flags &= ~(GDF_CONST|GDF_STATIC);
|
||||
if (!(flags & GDF_STRIP))
|
||||
flags |= GDF_USED;
|
||||
}
|
||||
|
||||
if (pHash_Get != &Hash_Get)
|
||||
{
|
||||
|
@ -11345,12 +11399,15 @@ QCC_def_t *QCC_PR_GetDef (QCC_type_t *type, char *name, struct QCC_function_s *s
|
|||
{
|
||||
if (pr_scope || typecmp_lax(def->type, type))
|
||||
{
|
||||
if (!strcmp("droptofloor", def->name))
|
||||
if (!strcmp("droptofloor", def->name) || //vanilla
|
||||
!strcmp("callfunction", def->name) || //should be (..., string name) but dpextensions gets this wrong.
|
||||
!strcmp("trailparticles", def->name) //dp got the two arguments the wrong way. fteqw doesn't care any more, but dp is still wrong.
|
||||
)
|
||||
{
|
||||
//this is a hack. droptofloor was wrongly declared in vanilla qc, which causes problems with replacement extensions.qc.
|
||||
//yes, this is a selfish lazy hack for this, there's probably a better way, but at least we spit out a warning still.
|
||||
QCC_PR_ParseWarning (WARN_LAXCAST, "%s builtin was wrongly defined as %s. ignoring invalid dupe definition",name, TypeName(type, typebuf1, sizeof(typebuf1)));
|
||||
QCC_PR_ParsePrintDef(WARN_LAXCAST, def);
|
||||
QCC_PR_ParseWarning (WARN_COMPATIBILITYHACK, "%s builtin was wrongly defined as %s. ignoring invalid dupe definition",name, TypeName(type, typebuf1, sizeof(typebuf1)));
|
||||
QCC_PR_ParsePrintDef(WARN_COMPATIBILITYHACK, def);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -11424,18 +11481,6 @@ QCC_def_t *QCC_PR_GetDef (QCC_type_t *type, char *name, struct QCC_function_s *s
|
|||
|
||||
ofs = 0;
|
||||
|
||||
if (!strncmp(name, "autocvar_", 9))
|
||||
{
|
||||
if (scope)
|
||||
QCC_PR_ParseWarning(WARN_MISUSEDAUTOCVAR, "Autocvar \"%s\" defined with local scope", name);
|
||||
else if (flags & GDF_CONST)
|
||||
QCC_PR_ParseWarning(WARN_MISUSEDAUTOCVAR, "Autocvar \"%s\" defined as constant", name);
|
||||
else if (flags & GDF_STATIC)
|
||||
QCC_PR_ParseWarning(WARN_MISUSEDAUTOCVAR, "Autocvar \"%s\" defined as static", name);
|
||||
if (!(flags & GDF_STRIP))
|
||||
flags |= GDF_USED;
|
||||
}
|
||||
|
||||
def = QCC_PR_DummyDef(type, name, scope, arraysize, NULL, ofs, true, flags);
|
||||
|
||||
QCC_ForceUnFreeDef(def);
|
||||
|
@ -11808,7 +11853,7 @@ void QCC_PR_ParseInitializerType(int arraysize, QCC_def_t *basedef, QCC_sref_t d
|
|||
tmp = QCC_EvaluateCast(tmp, type, true);
|
||||
}
|
||||
|
||||
if (!pr_scope || basedef->constant || basedef->isstatic)
|
||||
if (!basedef->scope || basedef->constant || basedef->isstatic)
|
||||
{
|
||||
tmp.sym->referenced = true;
|
||||
if (!tmp.sym->constant)
|
||||
|
@ -11828,7 +11873,17 @@ void QCC_PR_ParseInitializerType(int arraysize, QCC_def_t *basedef, QCC_sref_t d
|
|||
{
|
||||
for (i = 0; (unsigned)i < type->size; i++)
|
||||
if (def.sym->symboldata[def.ofs+i]._int != tmp.sym->symboldata[tmp.ofs+i]._int)
|
||||
QCC_PR_ParseErrorPrintSRef (ERR_REDECLARATION, def, "incompatible redeclaration");
|
||||
{
|
||||
if (!def.sym->arraysize && def.cast->type == ev_function && !strcmp(def.sym->name, "parseentitydata") && (functions[def.sym->symboldata[def.ofs+i]._int].builtin == 608 || functions[def.sym->symboldata[def.ofs+i]._int].builtin == 613))
|
||||
{ //dpextensions is WRONG, and claims it to be 608.
|
||||
if (functions[def.sym->symboldata[def.ofs+i]._int].builtin == 608)
|
||||
functions[def.sym->symboldata[def.ofs+i]._int].builtin = 613;
|
||||
QCC_PR_ParseWarning (WARN_COMPATIBILITYHACK, "incompatible redeclaration. Please validate builtin numbers. parseentitydata is #613");
|
||||
QCC_PR_ParsePrintSRef(WARN_COMPATIBILITYHACK, tmp);
|
||||
}
|
||||
else
|
||||
QCC_PR_ParseErrorPrintSRef (ERR_REDECLARATION, def, "incompatible redeclaration");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3836,7 +3836,7 @@ static LRESULT CALLBACK OutputWindowProc(HWND hWnd,UINT message,
|
|||
|
||||
void GUIPrint(HWND wnd, char *msg)
|
||||
{
|
||||
MSG wmsg;
|
||||
// MSG wmsg;
|
||||
int len;
|
||||
static int writing;
|
||||
|
||||
|
@ -3855,12 +3855,14 @@ void GUIPrint(HWND wnd, char *msg)
|
|||
Edit_SetSel(wnd,len,len);
|
||||
Edit_ReplaceSel(wnd,msg);
|
||||
|
||||
/*
|
||||
while (PeekMessage (&wmsg, NULL, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if (!GetMessage (&wmsg, NULL, 0, 0))
|
||||
break;
|
||||
DoTranslateMessage(&wmsg);
|
||||
}
|
||||
*/
|
||||
writing=false;
|
||||
}
|
||||
|
||||
|
@ -4233,12 +4235,6 @@ int GUIprintf(const char *msg, ...)
|
|||
if (*st)
|
||||
outlen = GUIEmitOutputText(outputbox, outlen, st, strlen(st), col);
|
||||
|
||||
while (PeekMessage (&wmsg, NULL, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
if (!GetMessage (&wmsg, NULL, 0, 0))
|
||||
break;
|
||||
DoTranslateMessage(&wmsg);
|
||||
}
|
||||
/*
|
||||
s = st = buf;
|
||||
while(*s)
|
||||
|
@ -4263,6 +4259,17 @@ int Dummyprintf(const char *msg, ...){return 0;}
|
|||
|
||||
#undef Sys_Error
|
||||
|
||||
void compilecb(void)
|
||||
{
|
||||
//used to repaint the output window periodically instead of letting it redraw as stuff gets sent to it. this can save significant time on mods with boatloads of warnings.
|
||||
MSG wmsg;
|
||||
SendMessage(outputbox, WM_SETREDRAW, TRUE, 0);
|
||||
RedrawWindow(outputbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
while (PeekMessage (&wmsg, NULL, 0, 0, PM_REMOVE))
|
||||
DoTranslateMessage(&wmsg);
|
||||
SendMessage(outputbox, WM_SETREDRAW, FALSE, 0);
|
||||
}
|
||||
|
||||
void Sys_Error(const char *text, ...);
|
||||
void RunCompiler(char *args, pbool quick)
|
||||
{
|
||||
|
@ -4329,9 +4336,11 @@ void RunCompiler(char *args, pbool quick)
|
|||
else
|
||||
logfile = NULL;
|
||||
|
||||
SendMessage(outputbox, WM_SETREDRAW, FALSE, 0);
|
||||
|
||||
argc = GUI_BuildParms(args, argv, quick);
|
||||
|
||||
if (CompileParams(&funcs, true, argc, argv))
|
||||
if (CompileParams(&funcs, compilecb, argc, argv))
|
||||
{
|
||||
if (!quick)
|
||||
{
|
||||
|
@ -4341,6 +4350,9 @@ void RunCompiler(char *args, pbool quick)
|
|||
}
|
||||
}
|
||||
|
||||
SendMessage(outputbox, WM_SETREDRAW, TRUE, 0);
|
||||
RedrawWindow(outputbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
|
||||
if (logfile)
|
||||
fclose(logfile);
|
||||
}
|
||||
|
|
|
@ -161,6 +161,8 @@ struct {
|
|||
//126: numfielddefs exceeds limit
|
||||
//127: numpr_globals exceeds limit
|
||||
//128: rededeclared with different parms
|
||||
{" F129", WARN_COMPATIBILITYHACK}, //multiple errors are replaced by this, for compat purposes.
|
||||
|
||||
{" Q203", WARN_MISSINGRETURNVALUE},
|
||||
{" Q204", WARN_WRONGRETURNTYPE},
|
||||
{" Q205", WARN_POINTLESSSTATEMENT},
|
||||
|
@ -191,6 +193,7 @@ struct {
|
|||
{" F307", WARN_STRICTTYPEMISMATCH},
|
||||
{" F308", WARN_TYPEMISMATCHREDECOPTIONAL},
|
||||
{" F309", WARN_IGNORECOMMANDLINE},
|
||||
{" F310", WARN_MISUSEDAUTOCVAR},
|
||||
|
||||
//frikqcc errors
|
||||
//Q608: PrecacheSound: numsounds
|
||||
|
@ -326,7 +329,7 @@ compiler_flag_t compiler_flag[] = {
|
|||
{&flag_msvcstyle, FLAG_MIDCOMPILE,"msvcstyle", "MSVC-style errors", "Generates warning and error messages in a format that msvc understands, to facilitate ide integration."},
|
||||
{&flag_debugmacros, FLAG_MIDCOMPILE,"debugmacros", "Verbose Macro Expansion", "Print out the contents of macros that are expanded. This can help look inside macros that are expanded and is especially handy if people are using preprocessor hacks."},
|
||||
{&flag_filetimes, 0, "filetimes", "Check Filetimes", "Recompiles the progs only if the file times are modified."},
|
||||
{&flag_fasttrackarrays, FLAG_MIDCOMPILE|FLAG_ASDEFAULT,"fastarrays","fast arrays where possible", "Generates extra instructions inside array handling functions to detect engine and use extension opcodes only in supporting engines.\nAdds a global which is set by the engine if the engine supports the extra opcodes. Note that this applies to all arrays or none."},
|
||||
{&flag_fasttrackarrays, FLAG_MIDCOMPILE,"fastarrays", "fast arrays where possible", "Generates extra instructions inside array handling functions to detect engine and use extension opcodes only in supporting engines.\nAdds a global which is set by the engine if the engine supports the extra opcodes. Note that this applies to all arrays or none."},
|
||||
{&flag_assume_integer, FLAG_MIDCOMPILE,"assumeint", "Assume Integers", "Numerical constants are assumed to be integers, instead of floats."},
|
||||
{&pr_subscopedlocals, FLAG_MIDCOMPILE,"subscope", "Subscoped Locals", "Restrict the scope of locals to the block they are actually defined within, as in C."},
|
||||
{&verbose, FLAG_MIDCOMPILE,"verbose", "Verbose", "Lots of extra compiler messages."},
|
||||
|
@ -526,6 +529,8 @@ void QCC_PrintFields (void)
|
|||
int i;
|
||||
QCC_ddef_t *d;
|
||||
|
||||
printf("Fields Listing:\n");
|
||||
|
||||
for (i=0 ; i<numfielddefs ; i++)
|
||||
{
|
||||
d = &fields[i];
|
||||
|
@ -538,6 +543,8 @@ void QCC_PrintGlobals (void)
|
|||
int i;
|
||||
QCC_ddef_t *d;
|
||||
|
||||
printf("Globals Listing:\n");
|
||||
|
||||
for (i=0 ; i<numglobaldefs ; i++)
|
||||
{
|
||||
d = &qcc_globals[i];
|
||||
|
@ -545,6 +552,94 @@ void QCC_PrintGlobals (void)
|
|||
}
|
||||
}
|
||||
|
||||
void QCC_PrintAutoCvars (void)
|
||||
{
|
||||
int i;
|
||||
QCC_ddef_t *d;
|
||||
char *n;
|
||||
|
||||
printf("Auto Cvars:\n");
|
||||
for (i=0 ; i<numglobaldefs ; i++)
|
||||
{
|
||||
d = &qcc_globals[i];
|
||||
n = strings + d->s_name;
|
||||
if (!strncmp(n, "autocvar_", 9))
|
||||
{
|
||||
char *desc;
|
||||
QCC_eval_t *val = &qcc_pr_globals[d->ofs];
|
||||
QCC_def_t *def = QCC_PR_GetDef(NULL, n, NULL, false, 0, 0);
|
||||
n += 9;
|
||||
|
||||
if (def->comment)
|
||||
desc = def->comment;
|
||||
else
|
||||
desc = NULL;
|
||||
|
||||
switch(d->type & ~(DEF_SAVEGLOBAL|DEF_SHARED))
|
||||
{
|
||||
case ev_float:
|
||||
printf ("set %s\t%g%s%s\n", n, val->_float, desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
case ev_vector:
|
||||
printf ("set %s\t\"%g %g %g\"%s%s\n", n, val->vector[0], val->vector[1], val->vector[2], desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
case ev_integer:
|
||||
printf ("set %s\t%i%s%s\n", n, val->_int, desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
case ev_string:
|
||||
printf ("set %s\t\"%s\"%s%s\n", n, strings + val->_int, desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
default:
|
||||
printf ("//set %s\t ?%s%s\n", n, desc?"\t//":"", desc?desc:"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void QCC_PrintFiles (void)
|
||||
{
|
||||
struct
|
||||
{
|
||||
precache_t *list;
|
||||
int count;
|
||||
} precaches[] =
|
||||
{
|
||||
{ precache_sound, numsounds},
|
||||
{ precache_texture, numtextures},
|
||||
{ precache_model, nummodels},
|
||||
{ precache_file, numfiles}
|
||||
};
|
||||
|
||||
int g, i, b;
|
||||
pbool header;
|
||||
|
||||
printf("\nFile lists:\n");
|
||||
for (b = 0; b < 64; b++)
|
||||
{
|
||||
for (header = false, g = 0; g < sizeof(precaches)/sizeof(precaches[0]); g++)
|
||||
{
|
||||
for (i = 0; i < precaches[g].count; i++)
|
||||
{
|
||||
if (precaches[g].list[i].block == b)
|
||||
{
|
||||
if (*precaches[g].list[i].name == '*')
|
||||
continue; //*-prefixed models are not real, and shouldn't be included in file lists.
|
||||
if (!header)
|
||||
{
|
||||
printf("pak%i:\n", b);
|
||||
header=true;
|
||||
}
|
||||
printf("%s\n", precaches[g].list[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (header)
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int encode(int len, int method, char *in, int handle);
|
||||
int WriteSourceFiles(int h, dprograms_t *progs, pbool sourceaswell)
|
||||
{
|
||||
|
@ -679,6 +774,7 @@ void QCC_DetermineNeededSymbols(QCC_def_t *endsyssym)
|
|||
{
|
||||
if (sym->constant && sym->type->type == ev_field && !opt_stripunusedfields)
|
||||
sym->symbolheader->used = true; //fields should always be present, annoyingly enough, as they're often used to silence map warnings.
|
||||
//FIXME: we want to strip these. fte/dp extensions.qc have a LOT of fields that could be stripped.
|
||||
else if (sym->constant && sym->type->type == ev_function)
|
||||
{ //non-builtins must be present, because of spawn functions and other entrypoints.
|
||||
unsigned int fnum = sym->symboldata[sym->ofs]._int;
|
||||
|
@ -1070,7 +1166,7 @@ pbool QCC_WriteData (int crc)
|
|||
Sys_Error("structtype error");
|
||||
}
|
||||
|
||||
for (def = pr.def_head.next ; def ; def = def->next)
|
||||
for (warnedunref = 0, def = pr.def_head.next ; def ; def = def->next)
|
||||
{
|
||||
if ((def->type->type == ev_struct || def->type->type == ev_union || def->arraysize) && def->deftail)
|
||||
{
|
||||
|
@ -1119,23 +1215,13 @@ pbool QCC_WriteData (int crc)
|
|||
{
|
||||
int wt = def->constant?WARN_NOTREFERENCEDCONST:WARN_NOTREFERENCED;
|
||||
pr_scope = def->scope;
|
||||
if (strcmp(def->name, "IMMEDIATE"))
|
||||
if (strcmp(def->name, "IMMEDIATE") && qccwarningaction[wt])
|
||||
{
|
||||
char typestr[256];
|
||||
if (warnedunref == -1)
|
||||
{
|
||||
if (qccwarningaction[wt])
|
||||
pr_warning_count++;
|
||||
}
|
||||
else if (QCC_PR_Warning(wt, strings + def->s_file, def->s_line, "%s %s no references.", TypeName(def->type, typestr, sizeof(typestr)), def->name) && warnedunref != -1)
|
||||
{
|
||||
warnedunref++;
|
||||
if (warnedunref == 10 && !verbose)
|
||||
{
|
||||
QCC_PR_Note(wt, NULL, 0, "Not reporting other unreferenced variables. You can use the noref prefix or pragma to silence these messages as you clearly don't care.");
|
||||
warnedunref = -1;
|
||||
}
|
||||
}
|
||||
if (warnedunref++ >= 10 && !verbose)
|
||||
pr_warning_count++;
|
||||
else
|
||||
QCC_PR_Warning(wt, strings + def->s_file, def->s_line, "%s %s no references.", TypeName(def->type, typestr, sizeof(typestr)), def->name);
|
||||
}
|
||||
pr_scope = NULL;
|
||||
|
||||
|
@ -1259,6 +1345,9 @@ pbool QCC_WriteData (int crc)
|
|||
#endif
|
||||
}
|
||||
|
||||
if (warnedunref > 10 && !verbose)
|
||||
QCC_PR_Note(WARN_NOTREFERENCED, NULL, 0, "suppressed %i more warnings about unreferenced variables, as you clearly don't care about the first 10.", warnedunref-10);
|
||||
|
||||
for (i = 0; i < numglobaldefs; i++)
|
||||
{
|
||||
dd = &qcc_globals[i];
|
||||
|
@ -1533,9 +1622,15 @@ strofs = (strofs+3)&~3;
|
|||
else
|
||||
SafeWrite (h, funcdata, funcdatasize);
|
||||
|
||||
if (verbose >= 2)
|
||||
QCC_PrintFiles();
|
||||
|
||||
if (verbose >= 2)
|
||||
QCC_PrintFields();
|
||||
|
||||
if (verbose >= 2)
|
||||
QCC_PrintAutoCvars();
|
||||
|
||||
switch(outputsttype)
|
||||
{
|
||||
case PST_QTEST:
|
||||
|
|
Loading…
Reference in a new issue