Add a --warnings-as-errors to cl65.
This commit is contained in:
122
src/cl65/main.c
122
src/cl65/main.c
@@ -898,7 +898,8 @@ static void Usage (void)
|
|||||||
" --version\t\t\tPrint the version number\n"
|
" --version\t\t\tPrint the version number\n"
|
||||||
" --verbose\t\t\tVerbose mode\n"
|
" --verbose\t\t\tVerbose mode\n"
|
||||||
" --zeropage-label name\t\tDefine and export a ZEROPAGE segment label\n"
|
" --zeropage-label name\t\tDefine and export a ZEROPAGE segment label\n"
|
||||||
" --zeropage-name seg\t\tSet the name of the ZEROPAGE segment\n",
|
" --zeropage-name seg\t\tSet the name of the ZEROPAGE segment\n"
|
||||||
|
" --warnings-as-errors\t\tTreat warnings as errors\n",
|
||||||
ProgName);
|
ProgName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1435,65 +1436,76 @@ static void OptZeropageName (const char* Opt attribute ((unused)), const char* A
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void OptWarningsAsErrors (const char* Opt attribute ((unused)),
|
||||||
|
const char* Arg attribute ((unused)))
|
||||||
|
/* Handle the --warnings-as-errors option */
|
||||||
|
{
|
||||||
|
CmdAddArg (&CA65, "--warnings-as-errors");
|
||||||
|
CmdAddArg (&LD65, "--warnings-as-errors");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main (int argc, char* argv [])
|
int main (int argc, char* argv [])
|
||||||
/* Utility main program */
|
/* Utility main program */
|
||||||
{
|
{
|
||||||
/* Program long options */
|
/* Program long options */
|
||||||
static const LongOpt OptTab[] = {
|
static const LongOpt OptTab[] = {
|
||||||
{ "--add-source", 0, OptAddSource },
|
{ "--add-source", 0, OptAddSource },
|
||||||
{ "--all-cdecl", 0, OptAllCDecl },
|
{ "--all-cdecl", 0, OptAllCDecl },
|
||||||
{ "--asm-args", 1, OptAsmArgs },
|
{ "--asm-args", 1, OptAsmArgs },
|
||||||
{ "--asm-define", 1, OptAsmDefine },
|
{ "--asm-define", 1, OptAsmDefine },
|
||||||
{ "--asm-include-dir", 1, OptAsmIncludeDir },
|
{ "--asm-include-dir", 1, OptAsmIncludeDir },
|
||||||
{ "--bin-include-dir", 1, OptBinIncludeDir },
|
{ "--bin-include-dir", 1, OptBinIncludeDir },
|
||||||
{ "--bss-label", 1, OptBssLabel },
|
{ "--bss-label", 1, OptBssLabel },
|
||||||
{ "--bss-name", 1, OptBssName },
|
{ "--bss-name", 1, OptBssName },
|
||||||
{ "--cc-args", 1, OptCCArgs },
|
{ "--cc-args", 1, OptCCArgs },
|
||||||
{ "--cfg-path", 1, OptCfgPath },
|
{ "--cfg-path", 1, OptCfgPath },
|
||||||
{ "--check-stack", 0, OptCheckStack },
|
{ "--check-stack", 0, OptCheckStack },
|
||||||
{ "--code-label", 1, OptCodeLabel },
|
{ "--code-label", 1, OptCodeLabel },
|
||||||
{ "--code-name", 1, OptCodeName },
|
{ "--code-name", 1, OptCodeName },
|
||||||
{ "--codesize", 1, OptCodeSize },
|
{ "--codesize", 1, OptCodeSize },
|
||||||
{ "--color", 1, OptColor },
|
{ "--color", 1, OptColor },
|
||||||
{ "--config", 1, OptConfig },
|
{ "--config", 1, OptConfig },
|
||||||
{ "--cpu", 1, OptCPU },
|
{ "--cpu", 1, OptCPU },
|
||||||
{ "--create-dep", 1, OptCreateDep },
|
{ "--create-dep", 1, OptCreateDep },
|
||||||
{ "--create-full-dep", 1, OptCreateFullDep },
|
{ "--create-full-dep", 1, OptCreateFullDep },
|
||||||
{ "--data-label", 1, OptDataLabel },
|
{ "--data-label", 1, OptDataLabel },
|
||||||
{ "--data-name", 1, OptDataName },
|
{ "--data-name", 1, OptDataName },
|
||||||
{ "--debug", 0, OptDebug },
|
{ "--debug", 0, OptDebug },
|
||||||
{ "--debug-info", 0, OptDebugInfo },
|
{ "--debug-info", 0, OptDebugInfo },
|
||||||
{ "--feature", 1, OptFeature },
|
{ "--feature", 1, OptFeature },
|
||||||
{ "--force-import", 1, OptForceImport },
|
{ "--force-import", 1, OptForceImport },
|
||||||
{ "--help", 0, OptHelp },
|
{ "--help", 0, OptHelp },
|
||||||
{ "--include-dir", 1, OptIncludeDir },
|
{ "--include-dir", 1, OptIncludeDir },
|
||||||
{ "--ld-args", 1, OptLdArgs },
|
{ "--ld-args", 1, OptLdArgs },
|
||||||
{ "--lib-path", 1, OptLibPath },
|
{ "--lib-path", 1, OptLibPath },
|
||||||
{ "--list-targets", 0, OptListTargets },
|
{ "--list-targets", 0, OptListTargets },
|
||||||
{ "--listing", 1, OptListing },
|
{ "--listing", 1, OptListing },
|
||||||
{ "--list-bytes", 1, OptListBytes },
|
{ "--list-bytes", 1, OptListBytes },
|
||||||
{ "--mapfile", 1, OptMapFile },
|
{ "--mapfile", 1, OptMapFile },
|
||||||
{ "--memory-model", 1, OptMemoryModel },
|
{ "--memory-model", 1, OptMemoryModel },
|
||||||
{ "--module", 0, OptModule },
|
{ "--module", 0, OptModule },
|
||||||
{ "--module-id", 1, OptModuleId },
|
{ "--module-id", 1, OptModuleId },
|
||||||
{ "--no-target-lib", 0, OptNoTargetLib },
|
{ "--no-target-lib", 0, OptNoTargetLib },
|
||||||
{ "--no-utf8", 0, OptNoUtf8 },
|
{ "--no-utf8", 0, OptNoUtf8 },
|
||||||
{ "--o65-model", 1, OptO65Model },
|
{ "--o65-model", 1, OptO65Model },
|
||||||
{ "--obj", 1, OptObj },
|
{ "--obj", 1, OptObj },
|
||||||
{ "--obj-path", 1, OptObjPath },
|
{ "--obj-path", 1, OptObjPath },
|
||||||
{ "--print-target-path", 0, OptPrintTargetPath},
|
{ "--print-target-path", 0, OptPrintTargetPath },
|
||||||
{ "--register-space", 1, OptRegisterSpace },
|
{ "--register-space", 1, OptRegisterSpace },
|
||||||
{ "--register-vars", 0, OptRegisterVars },
|
{ "--register-vars", 0, OptRegisterVars },
|
||||||
{ "--rodata-name", 1, OptRodataName },
|
{ "--rodata-name", 1, OptRodataName },
|
||||||
{ "--signed-chars", 0, OptSignedChars },
|
{ "--signed-chars", 0, OptSignedChars },
|
||||||
{ "--standard", 1, OptStandard },
|
{ "--standard", 1, OptStandard },
|
||||||
{ "--start-addr", 1, OptStartAddr },
|
{ "--start-addr", 1, OptStartAddr },
|
||||||
{ "--static-locals", 0, OptStaticLocals },
|
{ "--static-locals", 0, OptStaticLocals },
|
||||||
{ "--target", 1, OptTarget },
|
{ "--target", 1, OptTarget },
|
||||||
{ "--verbose", 0, OptVerbose },
|
{ "--verbose", 0, OptVerbose },
|
||||||
{ "--version", 0, OptVersion },
|
{ "--version", 0, OptVersion },
|
||||||
{ "--zeropage-label", 1, OptZeropageLabel },
|
{ "--zeropage-label", 1, OptZeropageLabel },
|
||||||
{ "--zeropage-name", 1, OptZeropageName },
|
{ "--zeropage-name", 1, OptZeropageName },
|
||||||
|
{ "--warnings-as-errors", 0, OptWarningsAsErrors },
|
||||||
};
|
};
|
||||||
|
|
||||||
char* CmdPath;
|
char* CmdPath;
|
||||||
|
|||||||
@@ -1291,7 +1291,7 @@ static void ParseConDes (void)
|
|||||||
AttrCheck (AttrFlags, atType, "TYPE");
|
AttrCheck (AttrFlags, atType, "TYPE");
|
||||||
|
|
||||||
/* Check if the condes has already attributes defined */
|
/* Check if the condes has already attributes defined */
|
||||||
if (ConDesHasSegName(Type) || ConDesHasLabel(Type)) {
|
if (ConDesHasSegName (Type) || ConDesHasLabel (Type)) {
|
||||||
PError (&CfgErrorPos,
|
PError (&CfgErrorPos,
|
||||||
"`CONDES' attributes for type %d are already defined",
|
"`CONDES' attributes for type %d are already defined",
|
||||||
Type);
|
Type);
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ static void OptCfgPath (const char* Opt attribute ((unused)), const char* Arg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void OptColor(const char* Opt, const char* Arg)
|
static void OptColor (const char* Opt, const char* Arg)
|
||||||
/* Handle the --color option */
|
/* Handle the --color option */
|
||||||
{
|
{
|
||||||
ColorMode Mode = CP_Parse (Arg);
|
ColorMode Mode = CP_Parse (Arg);
|
||||||
@@ -648,7 +648,7 @@ static void CmdlOptTarget (const char* Opt attribute ((unused)), const char* Arg
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void ParseCommandLine(void)
|
static void ParseCommandLine (void)
|
||||||
{
|
{
|
||||||
/* Program long options */
|
/* Program long options */
|
||||||
static const LongOpt OptTab[] = {
|
static const LongOpt OptTab[] = {
|
||||||
@@ -886,7 +886,7 @@ int main (int argc, char* argv [])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (WarningCount > 0 && WarningsAsErrors) {
|
if (WarningCount > 0 && WarningsAsErrors) {
|
||||||
Error("Warnings as errors");
|
Error ("Warnings as errors");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the output file */
|
/* Create the output file */
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ void CfgSpecialToken (const IdentTok* Table, unsigned Size, const char* Name)
|
|||||||
SB_Done (&Note);
|
SB_Done (&Note);
|
||||||
}
|
}
|
||||||
PError (&CfgErrorPos, "%s expected but got `%s'", Name,
|
PError (&CfgErrorPos, "%s expected but got `%s'", Name,
|
||||||
SB_GetConstBuf(&CfgSVal));
|
SB_GetConstBuf (&CfgSVal));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -642,11 +642,9 @@ void PrintDbgSegments (FILE* F)
|
|||||||
fprintf (F, ",oname=\"%s\",ooffs=%lu",
|
fprintf (F, ",oname=\"%s\",ooffs=%lu",
|
||||||
S->OutputName, S->OutputOffs);
|
S->OutputName, S->OutputOffs);
|
||||||
}
|
}
|
||||||
if (S->MemArea) {
|
if (S->MemArea && S->MemArea->BankExpr) {
|
||||||
if (S->MemArea->BankExpr) {
|
if (IsConstExpr (S->MemArea->BankExpr)) {
|
||||||
if (IsConstExpr (S->MemArea->BankExpr)) {
|
fprintf (F, ",bank=%lu", GetExprVal (S->MemArea->BankExpr));
|
||||||
fprintf (F, ",bank=%lu", GetExprVal(S->MemArea->BankExpr));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputc ('\n', F);
|
fputc ('\n', F);
|
||||||
|
|||||||
@@ -120,7 +120,9 @@ void XexSetRunAd (XexDesc* D, Import *RunAd)
|
|||||||
D->RunAd = RunAd;
|
D->RunAd = RunAd;
|
||||||
}
|
}
|
||||||
|
|
||||||
XexInitAd* XexSearchInitMem(XexDesc* D, MemoryArea *InitMem)
|
|
||||||
|
|
||||||
|
XexInitAd* XexSearchInitMem (XexDesc* D, MemoryArea *InitMem)
|
||||||
{
|
{
|
||||||
XexInitAd* I;
|
XexInitAd* I;
|
||||||
for (I=D->InitAds; I != 0; I=I->next)
|
for (I=D->InitAds; I != 0; I=I->next)
|
||||||
@@ -132,6 +134,7 @@ XexInitAd* XexSearchInitMem(XexDesc* D, MemoryArea *InitMem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int XexAddInitAd (XexDesc* D, MemoryArea *InitMem, Import *InitAd)
|
int XexAddInitAd (XexDesc* D, MemoryArea *InitMem, Import *InitAd)
|
||||||
/* Sets and INITAD for the given memory area */
|
/* Sets and INITAD for the given memory area */
|
||||||
{
|
{
|
||||||
@@ -149,6 +152,8 @@ int XexAddInitAd (XexDesc* D, MemoryArea *InitMem, Import *InitAd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned XexWriteExpr (ExprNode* E, int Signed, unsigned Size,
|
static unsigned XexWriteExpr (ExprNode* E, int Signed, unsigned Size,
|
||||||
unsigned long Offs attribute ((unused)),
|
unsigned long Offs attribute ((unused)),
|
||||||
void* Data)
|
void* Data)
|
||||||
|
|||||||
Reference in New Issue
Block a user