Add a --warnings-as-errors option to cc65 for compatibility reasons.

This commit is contained in:
Kugel Fuhr
2025-07-14 11:35:53 +02:00
parent 2e4c18770b
commit 170ddc6e33
4 changed files with 33 additions and 1 deletions

View File

@@ -742,6 +742,8 @@ static void OptVersion (const char* Opt attribute ((unused)),
exit (EXIT_SUCCESS);
}
static void OptSeglist (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Enable segment listing */
@@ -749,6 +751,8 @@ static void OptSeglist (const char* Opt attribute ((unused)),
SegList = 1;
}
static void OptWarningsAsErrors (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Generate an error if any warnings occur */
@@ -756,6 +760,8 @@ static void OptWarningsAsErrors (const char* Opt attribute ((unused)),
WarningsAsErrors = 1;
}
static void OptExpandMacros (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Expand macros in listing
@@ -767,6 +773,8 @@ static void OptExpandMacros (const char* Opt attribute ((unused)),
ExpandMacros++;
}
static void DoPCAssign (void)
/* Start absolute code */
{

View File

@@ -140,6 +140,7 @@ static void Usage (void)
" --target sys\t\t\tSet the target system\n"
" --verbose\t\t\tIncrease verbosity\n"
" --version\t\t\tPrint the compiler version number\n"
" --warnings-as-errors\t\tTreat warnings as errors\n"
" --writable-strings\t\tMake string literals writable\n",
ProgName);
}
@@ -968,6 +969,15 @@ static void OptWarning (const char* Opt attribute ((unused)), const char* Arg)
static void OptWarningsAsErrors (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Generate an error if any warnings occur */
{
IS_Set (&WarningsAreErrors, 1);
}
static void OptWritableStrings (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Make string literals writable */
@@ -1016,6 +1026,7 @@ int main (int argc, char* argv[])
{ "--target", 1, OptTarget },
{ "--verbose", 0, OptVerbose },
{ "--version", 0, OptVersion },
{ "--warnings-as-errors", 0, OptWarningsAsErrors },
{ "--writable-strings", 0, OptWritableStrings },
};

View File

@@ -1441,6 +1441,7 @@ static void OptWarningsAsErrors (const char* Opt attribute ((unused)),
/* Handle the --warnings-as-errors option */
{
CmdAddArg (&CA65, "--warnings-as-errors");
CmdAddArg (&CC65, "--warnings-as-errors");
CmdAddArg (&LD65, "--warnings-as-errors");
}