2022-10-19 20:16:13 +00:00
|
|
|
#include "parser.h"
|
|
|
|
|
|
|
|
PExtraWarningC pExtraWarningC = {0};
|
|
|
|
Pragma warningPragmas[] = {
|
|
|
|
&pExtraWarningC.warn_largeargs, "warn_largeargs", 0,
|
|
|
|
&pExtraWarningC.warn_padding, "warn_padding", 0,
|
|
|
|
&pExtraWarningC.warn_resultnotused, "warn_resultnotused", 0,
|
|
|
|
&pExtraWarningC.warn_ptr_int_conv, "warn_ptr_int_conv", 0,
|
|
|
|
&pExtraWarningC.warn_no_side_effect, "warn_no_side_effect", 0,
|
|
|
|
0, 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
int TargetSetWarningFlags(short val, Boolean set) {
|
|
|
|
switch (val) {
|
|
|
|
case 'Ip': pWarningC.warn_illpragma = set; break;
|
|
|
|
case 'Ed': pWarningC.warn_emptydecl = set; break;
|
|
|
|
case 'Pu': pWarningC.warn_possunwant = set; break;
|
|
|
|
case 'Uv': pWarningC.warn_unusedvar = set; break;
|
|
|
|
case 'Ua': pWarningC.warn_unusedarg = set; break;
|
|
|
|
case 'Ec': pWarningC.warn_extracomma = set; break;
|
2023-01-11 22:29:53 +00:00
|
|
|
case 'Pd': pWarningC.pedantic = set; break;
|
2022-10-19 20:16:13 +00:00
|
|
|
case 'Hv': pWarningC.warn_hidevirtual = set; break;
|
|
|
|
case 'Ic': pWarningC.warn_implicitconv = set; break;
|
|
|
|
case 'Ni': pWarningC.warn_notinlined = set; break;
|
|
|
|
case 'Sc': pWarningC.warn_structclass = set; break;
|
2023-01-11 22:29:53 +00:00
|
|
|
case 'Pa': pExtraWarningC.warn_padding = set ? PR_ON : PR_OFF; break;
|
|
|
|
case 'Nu': pExtraWarningC.warn_resultnotused = set ? PR_ON : PR_OFF; break;
|
|
|
|
case 'Se': pExtraWarningC.warn_no_side_effect = set ? PR_ON : PR_OFF; break;
|
|
|
|
case 'PI': pExtraWarningC.warn_ptr_int_conv = set ? PR_ON : PR_OFF; break;
|
|
|
|
case 'La': pExtraWarningC.warn_largeargs = set ? PR_ON : PR_OFF; break;
|
2022-10-19 20:16:13 +00:00
|
|
|
case 'We': pWarningC.warningerrors = set; break;
|
|
|
|
case 'Cp': pFrontEndC.checkprotos = set; break;
|
|
|
|
default: return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TargetDisplayWarningOptions(Handle txt) {
|
|
|
|
HPrintF(txt, "C language warning options:\n");
|
|
|
|
|
|
|
|
if (pWarningC.warn_illpragma)
|
|
|
|
HPrintF(txt, "\t- illegal pragmas\n");
|
|
|
|
if (pWarningC.warn_emptydecl)
|
|
|
|
HPrintF(txt, "\t- empty declarations\n");
|
|
|
|
if (pWarningC.warn_possunwant)
|
|
|
|
HPrintF(txt, "\t- possible unwanted effects\n");
|
|
|
|
if (pWarningC.warn_unusedvar)
|
|
|
|
HPrintF(txt, "\t- unused variables\n");
|
|
|
|
if (pWarningC.warn_unusedarg)
|
|
|
|
HPrintF(txt, "\t- unused arguments\n");
|
|
|
|
if (pWarningC.warn_extracomma)
|
|
|
|
HPrintF(txt, "\t- extra commas\n");
|
|
|
|
if (pWarningC.pedantic)
|
|
|
|
HPrintF(txt, "\t- pedantic\n");
|
|
|
|
if (pWarningC.warn_hidevirtual)
|
|
|
|
HPrintF(txt, "\t- hidden virtual functions\n");
|
|
|
|
if (pWarningC.warn_implicitconv)
|
|
|
|
HPrintF(txt, "\t- implicit conversions\n");
|
|
|
|
if (pWarningC.warn_notinlined)
|
|
|
|
HPrintF(txt, "\t- 'inline' not performed\n");
|
|
|
|
if (pWarningC.warn_structclass)
|
|
|
|
HPrintF(txt, "\t- struct/class conflict\n");
|
2023-01-11 22:29:53 +00:00
|
|
|
if (pExtraWarningC.warn_largeargs == 1)
|
2022-10-19 20:16:13 +00:00
|
|
|
HPrintF(txt, "\t- large args passed to unprototyped functions\n");
|
2023-01-11 22:29:53 +00:00
|
|
|
if (pExtraWarningC.warn_padding == 1)
|
2022-10-19 20:16:13 +00:00
|
|
|
HPrintF(txt, "\t- padding added between struct members\n");
|
2023-01-11 22:29:53 +00:00
|
|
|
if (pExtraWarningC.warn_resultnotused == 1)
|
2022-10-19 20:16:13 +00:00
|
|
|
HPrintF(txt, "\t- result of non-void function call not used\n");
|
2023-01-11 22:29:53 +00:00
|
|
|
if (pExtraWarningC.warn_no_side_effect == 1)
|
2022-10-19 20:16:13 +00:00
|
|
|
HPrintF(txt, "\t- use of expressions as statements without side effects\n");
|
2023-01-11 22:29:53 +00:00
|
|
|
if (pExtraWarningC.warn_ptr_int_conv == 1)
|
2022-10-19 20:16:13 +00:00
|
|
|
HPrintF(txt, "\t- implicit integer/pointer conversions\n");
|
|
|
|
if (pFrontEndC.checkprotos)
|
|
|
|
HPrintF(txt, "\t- checking prototypes\n");
|
|
|
|
|
|
|
|
if (pWarningC.warningerrors)
|
|
|
|
HPrintF(txt, "\t- warnings are errors\n");
|
|
|
|
else
|
|
|
|
HPrintF(txt, "\t- warnings are not errors\n");
|
|
|
|
}
|