From e7f5ab3f55402cedb17c136020588f67a9216e54 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sat, 20 Sep 2025 20:21:37 -0400 Subject: [PATCH] Warn about `rgbgfx -O` without `-o` or any of `-A -T -P -Q` --- src/gfx/main.cpp | 12 ++++++++++++ test/gfx/warn_group_output.err | 2 ++ test/gfx/warn_group_output.flags | 1 + 3 files changed, 15 insertions(+) create mode 100644 test/gfx/warn_group_output.err create mode 100644 test/gfx/warn_group_output.flags diff --git a/src/gfx/main.cpp b/src/gfx/main.cpp index 7aa54356..201e4c47 100644 --- a/src/gfx/main.cpp +++ b/src/gfx/main.cpp @@ -44,6 +44,8 @@ static struct LocalOptions { bool autoPalmap; bool groupOutputs; bool reverse; + + bool autoAny() const { return autoAttrmap || autoTilemap || autoPalettes || autoPalmap; } } localOptions; // Short options @@ -846,6 +848,16 @@ int main(int argc, char *argv[]) { ); } + if (localOptions.groupOutputs) { + if (!localOptions.autoAny()) { + warnx("Grouping outputs ('-O') is enabled, but without any automatic output paths " + "('-A', '-P', '-Q', or '-T')"); + } + if (options.output.empty()) { + warnx("Grouping outputs ('-O') is enabled, but without an output tile data file ('-o')" + ); + } + } auto autoOutPath = [](bool autoOptEnabled, std::string &path, char const *extension) { if (!autoOptEnabled) { return; diff --git a/test/gfx/warn_group_output.err b/test/gfx/warn_group_output.err new file mode 100644 index 00000000..c54b03b8 --- /dev/null +++ b/test/gfx/warn_group_output.err @@ -0,0 +1,2 @@ +warning: Grouping outputs ('-O') is enabled, but without any automatic output paths ('-A', '-P', '-Q', or '-T') +warning: Grouping outputs ('-O') is enabled, but without an output tile data file ('-o') diff --git a/test/gfx/warn_group_output.flags b/test/gfx/warn_group_output.flags new file mode 100644 index 00000000..ebc68ab8 --- /dev/null +++ b/test/gfx/warn_group_output.flags @@ -0,0 +1 @@ +-O