Add -Wobsolete to RGBFIX and RGBGFX, and deprecate rgbfix -O

This commit is contained in:
Rangi42
2025-08-05 17:12:29 -04:00
parent 3a0a4b7f90
commit bf66e346f0
12 changed files with 16 additions and 6 deletions

View File

@@ -145,6 +145,7 @@ _rgbfix_completions() {
warning) warning)
mapfile -t COMPREPLY < <(compgen -W " mapfile -t COMPREPLY < <(compgen -W "
mbc mbc
obsolete
overwrite overwrite
sgb sgb
truncation truncation

View File

@@ -157,6 +157,7 @@ _rgbgfx_completions() {
warning) warning)
mapfile -t COMPREPLY < <(compgen -W " mapfile -t COMPREPLY < <(compgen -W "
embedded embedded
obsolete
trim-nonempty trim-nonempty
all all
everything everything

View File

@@ -42,6 +42,7 @@ _rgbfix_warnings() {
'everything:Enable literally everything' 'everything:Enable literally everything'
'mbc:Warn about issues with MBC specs' 'mbc:Warn about issues with MBC specs'
'obsolete:Warn when using deprecated features'
'overwrite:Warn when overwriting non-zero bytes' 'overwrite:Warn when overwriting non-zero bytes'
'sgb:Warn when SGB flag conflicts with old licensee code' 'sgb:Warn when SGB flag conflicts with old licensee code'
'truncation:Warn when values are truncated to fit' 'truncation:Warn when values are truncated to fit'

View File

@@ -17,6 +17,7 @@ _rgbgfx_warnings() {
'everything:Enable literally everything' 'everything:Enable literally everything'
'embedded:Warn when using embedded PLTE without "-c embedded"' 'embedded:Warn when using embedded PLTE without "-c embedded"'
'obsolete:Warn when using deprecated features'
'trim-nonempty:Warn when "-x" trims nonempty tiles' 'trim-nonempty:Warn when "-x" trims nonempty tiles'
) )
_describe warning warnings _describe warning warnings

View File

@@ -13,6 +13,7 @@ enum WarningLevel {
enum WarningID { enum WarningID {
WARNING_MBC, // Issues with MBC specs WARNING_MBC, // Issues with MBC specs
WARNING_OBSOLETE, // Obsolete/deprecated things
WARNING_OVERWRITE, // Overwriting non-zero bytes WARNING_OVERWRITE, // Overwriting non-zero bytes
WARNING_SGB, // SGB flag conflicts with old licensee code WARNING_SGB, // SGB flag conflicts with old licensee code
WARNING_TRUNCATION, // Truncating values to fit WARNING_TRUNCATION, // Truncating values to fit

View File

@@ -13,6 +13,7 @@ enum WarningLevel {
enum WarningID { enum WarningID {
WARNING_EMBEDDED, // Using an embedded PNG palette without '-c embedded' WARNING_EMBEDDED, // Using an embedded PNG palette without '-c embedded'
WARNING_OBSOLETE, // Obsolete/deprecated things
WARNING_TRIM_NONEMPTY, // '-x' trims nonempty tiles WARNING_TRIM_NONEMPTY, // '-x' trims nonempty tiles
NB_PLAIN_WARNINGS, NB_PLAIN_WARNINGS,

View File

@@ -8,7 +8,7 @@
.Nd Game Boy header utility and checksum fixer .Nd Game Boy header utility and checksum fixer
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl hjOsVvw .Op Fl hjsVvw
.Op Fl C | c .Op Fl C | c
.Op Fl \-color Ar when .Op Fl \-color Ar when
.Op Fl f Ar fix_spec .Op Fl f Ar fix_spec
@@ -149,9 +149,6 @@ section below.
Set the ROM version Set the ROM version
.Pq Ad 0x14C .Pq Ad 0x14C
to a given value from 0 to 0xFF. to a given value from 0 to 0xFF.
.It Fl O , Fl \-overwrite
Alias for
.Fl Wno-overwrite .
.It Fl o Ar out_file , Fl \-output Ar out_file .It Fl o Ar out_file , Fl \-output Ar out_file
Write the modified ROM image to the given file, or '-' to write to standard output. Write the modified ROM image to the given file, or '-' to write to standard output.
If not specified, the input files are modified in-place, or written to standard output if read from standard input. If not specified, the input files are modified in-place, or written to standard output if read from standard input.
@@ -253,6 +250,8 @@ prefix, entries are listed alphabetically.
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl Wno-mbc .It Fl Wno-mbc
Warn when there are inconsistencies with or caveats about the specified MBC type. Warn when there are inconsistencies with or caveats about the specified MBC type.
.It Fl Wno-obsolete
Warn when obsolete features are encountered, which have been deprecated and may later be removed.
.It Fl Wno-overwrite .It Fl Wno-overwrite
Warn when overwriting different non-zero bytes in the header. Warn when overwriting different non-zero bytes in the header.
.It Fl Wno-sgb .It Fl Wno-sgb

View File

@@ -810,6 +810,8 @@ Warn when a generated palette is sorted according to the input PNG's embedded pa
was not provided. was not provided.
This warning is enabled by This warning is enabled by
.Fl Weverything . .Fl Weverything .
.It Fl Wno-obsolete
Warn when obsolete features are encountered, which have been deprecated and may later be removed.
.It Fl Wtrim-nonempty .It Fl Wtrim-nonempty
Warn when Warn when
.Fl x .Fl x

View File

@@ -778,6 +778,7 @@ int main(int argc, char *argv[]) {
break; break;
case 'O': case 'O':
warning(WARNING_OBSOLETE, "'-O' is deprecated; use '-Wno-overwrite' instead");
warnings.processWarningFlag("no-overwrite"); warnings.processWarningFlag("no-overwrite");
break; break;

View File

@@ -12,6 +12,7 @@ Diagnostics<WarningLevel, WarningID> warnings = {
}, },
.warningFlags = { .warningFlags = {
{"mbc", LEVEL_DEFAULT }, {"mbc", LEVEL_DEFAULT },
{"obsolete", LEVEL_DEFAULT },
{"overwrite", LEVEL_DEFAULT }, {"overwrite", LEVEL_DEFAULT },
{"sgb", LEVEL_DEFAULT }, {"sgb", LEVEL_DEFAULT },
{"truncation", LEVEL_DEFAULT }, {"truncation", LEVEL_DEFAULT },

View File

@@ -17,6 +17,7 @@ Diagnostics<WarningLevel, WarningID> warnings = {
}, },
.warningFlags = { .warningFlags = {
{"embedded", LEVEL_EVERYTHING}, {"embedded", LEVEL_EVERYTHING},
{"obsolete", LEVEL_DEFAULT },
{"trim-nonempty", LEVEL_ALL }, {"trim-nonempty", LEVEL_ALL },
}, },
.paramWarnings = {}, .paramWarnings = {},

View File

@@ -1,2 +1,2 @@
-O -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0 -Wno-overwrite -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
Checks that the -O flag suppresses "Overwrote a non-zero byte" warnings from the rest Checks that the -Wno-overwrite flag suppresses "Overwrote a non-zero byte" warnings from the rest