2022-10-19 20:16:13 +00:00
|
|
|
#include "parser.h"
|
|
|
|
|
|
|
|
int SetWarningFlags(const char *opt, void *str, const char *, int flags) {
|
|
|
|
// this is very similar to ToolHelper
|
|
|
|
// might also fail to match
|
|
|
|
unsigned char *ptr;
|
|
|
|
Boolean set;
|
|
|
|
Boolean no;
|
|
|
|
UInt16 flag;
|
|
|
|
|
|
|
|
ptr = (unsigned char *) str;
|
|
|
|
no = (Boolean) ((flags & PARAMPARSEFLAGS_8) >> 3);
|
|
|
|
set = (Boolean) (no ^ 1);
|
|
|
|
|
|
|
|
while (*ptr) {
|
|
|
|
if (*ptr == '+') {
|
|
|
|
set = !no;
|
|
|
|
} else if (*ptr == '-') {
|
|
|
|
set = no;
|
|
|
|
} else if (*ptr == '|') {
|
|
|
|
set = (Boolean) (no ^ 1);
|
|
|
|
} else {
|
|
|
|
flag = (ptr[0] << 8) | ptr[1];
|
|
|
|
|
|
|
|
if (set)
|
|
|
|
pCmdLine.noWarnings = 0;
|
|
|
|
|
|
|
|
switch (flag) {
|
|
|
|
case 'Nw':
|
|
|
|
pCmdLine.noWarnings = set;
|
|
|
|
break;
|
|
|
|
case 'Aw':
|
|
|
|
TargetSetWarningFlags(flag, set);
|
|
|
|
break;
|
|
|
|
case 'Cw':
|
|
|
|
pCmdLine.noCmdLineWarnings = !set;
|
|
|
|
break;
|
|
|
|
case 'We':
|
|
|
|
pCmdLine.warningsAreErrors = set;
|
|
|
|
TargetSetWarningFlags(flag, set);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (!TargetSetWarningFlags(flag, set))
|
|
|
|
CLPFatalError("Bad warning settings in %s (%c%c)\n", str, ptr[0], ptr[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
++ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
++ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
Parser_StorePanels(parseopts.context);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2023-01-11 22:29:53 +00:00
|
|
|
int DisplayWarningOptions(const char *, void *, const char *, int) {
|
2022-10-19 20:16:13 +00:00
|
|
|
Handle h;
|
|
|
|
|
|
|
|
h = NewHandle(0);
|
|
|
|
if (!h)
|
|
|
|
exit(-23);
|
|
|
|
|
|
|
|
HPrintF(h, "Command-line warning options:\n");
|
|
|
|
|
|
|
|
if (pCmdLine.noCmdLineWarnings)
|
|
|
|
HPrintF(h, "\t- no command-line warnings\n");
|
|
|
|
else
|
|
|
|
HPrintF(h, "\t- command-line warnings\n");
|
|
|
|
|
|
|
|
if (pCmdLine.warningsAreErrors)
|
|
|
|
HPrintF(h, "\t- warnings are errors\n");
|
|
|
|
else
|
|
|
|
HPrintF(h, "\t- warnings are not errors\n");
|
|
|
|
|
|
|
|
if (pCmdLine.noWarnings)
|
|
|
|
HPrintF(h, "\t- no warnings at all\n");
|
|
|
|
|
|
|
|
TargetDisplayWarningOptions(h);
|
|
|
|
ShowTextHandle(NULL, h);
|
|
|
|
DisposeHandle(h);
|
|
|
|
return 1;
|
|
|
|
}
|