Improve handling of platform-specific build options (#2162)

* Opt into POSIX functions with `_POSIX_C_SOURCE` before any system
  headers are `#include`d
* Allow user to override `make develop`'s `WARNFLAGS` and `CXXFLAGS`
* Use `make develop` on 32-bit Cygwin with sanitizers disabled
* Do not unnecessarily redefine `fseek` and `ftell`
* Disable a false-positive `-Wno-null-dereference` on 32-bit Cygwin

Co-authored-by: ISSOtm <[email protected]>
This commit is contained in:
RangiandISSOtm authored and GitHub committed 2026-09-26 16:31:25 -04:00
1 parent 43bdeb873e
commit b732f59472
23 files changed
+60 -40

No files matched your search

+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp" // strncasecmp
#include "asm/fstack.hpp"
#include <sys/stat.h>
@@ -22,7 +24,6 @@
#include "helpers.hpp"
#include "itertools.hpp" // reversed
#include "linkdefs.hpp"
#include "platform.hpp" // strncasecmp
#include "verbosity.hpp"
#include "asm/intern.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "asm/lexer.hpp"
#include <sys/stat.h>
@@ -27,7 +29,6 @@
#include <vector>
#include "helpers.hpp"
#include "platform.hpp"
#include "style.hpp"
#include "util.hpp"
#include "verbosity.hpp"
+3 -2
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "asm/main.hpp"
#include <algorithm>
@@ -23,8 +25,7 @@
#include "diagnostics.hpp"
#include "helpers.hpp"
#include "parser.hpp" // Generated from parser.y
#include "platform.hpp"
#include "style.hpp" // style_Parse
#include "style.hpp" // style_Parse
#include "usage.hpp"
#include "util.hpp" // UpperMap
#include "verbosity.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "asm/output.hpp"
#include <algorithm>
@@ -16,7 +18,6 @@
#include "helpers.hpp" // assume, Defer
#include "linkdefs.hpp"
#include "platform.hpp"
#include "util.hpp" // xfclose
#include "asm/charmap.hpp"
+3 -2
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp" // fseek
#include "asm/section.hpp"
#include <algorithm>
@@ -21,8 +23,7 @@
#include "helpers.hpp"
#include "itertools.hpp" // InsertionOrderedMap
#include "linkdefs.hpp"
#include "platform.hpp" // fseek
#include "util.hpp" // xfclose, seekSize
#include "util.hpp" // xfclose, seekSize
#include "asm/fstack.hpp"
#include "asm/lexer.hpp"
+3 -2
View File
@@ -1,12 +1,13 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp" // strcasecmp
#include "backtrace.hpp"
#include <optional>
#include <stdint.h>
#include "platform.hpp" // strcasecmp
#include "util.hpp" // parseWholeNumber
#include "util.hpp" // parseWholeNumber
Tracing tracing;
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "fix/fix.hpp"
#include <sys/stat.h>
@@ -14,7 +16,6 @@
#include "diagnostics.hpp"
#include "helpers.hpp"
#include "platform.hpp"
#include "util.hpp" // xclose, xfclose
#include "fix/main.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "fix/main.hpp"
#include <errno.h>
@@ -15,7 +17,6 @@
#include "cli.hpp"
#include "diagnostics.hpp"
#include "helpers.hpp"
#include "platform.hpp"
#include "style.hpp"
#include "usage.hpp"
#include "util.hpp"
+3 -2
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp" // strcasecmp
#include "fix/mbc.hpp"
#include <optional>
@@ -10,8 +12,7 @@
#include <unordered_map>
#include <utility>
#include "helpers.hpp" // unreachable_
#include "platform.hpp" // strcasecmp
#include "helpers.hpp" // unreachable_
#include "util.hpp"
#include "fix/warning.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "gfx/main.hpp"
#include <inttypes.h>
@@ -19,7 +21,6 @@
#include "diagnostics.hpp"
#include "file.hpp"
#include "helpers.hpp"
#include "platform.hpp"
#include "style.hpp" // style_Parse
#include "usage.hpp"
#include "util.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "gfx/pal_spec.hpp"
#include <algorithm>
@@ -22,7 +24,6 @@
#include "diagnostics.hpp"
#include "file.hpp"
#include "helpers.hpp"
#include "platform.hpp"
#include "util.hpp" // UpperMap, parseDigit
#include "gfx/main.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "link/assign.hpp"
#include <algorithm>
@@ -16,7 +18,6 @@
#include "helpers.hpp"
#include "itertools.hpp"
#include "linkdefs.hpp"
#include "platform.hpp"
#include "verbosity.hpp"
#include "link/main.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "link/object.hpp"
#include <deque>
@@ -18,7 +20,6 @@
#include "helpers.hpp"
#include "linkdefs.hpp"
#include "platform.hpp"
#include "util.hpp" // xfclose
#include "verbosity.hpp"
#include "version.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "link/output.hpp"
#include <algorithm>
@@ -19,7 +21,6 @@
#include "extern/utf8decoder.hpp"
#include "helpers.hpp"
#include "linkdefs.hpp"
#include "platform.hpp"
#include "util.hpp"
#include "link/main.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "link/sdas_obj.hpp"
#include <inttypes.h>
@@ -14,7 +16,6 @@
#include "helpers.hpp" // assume, literal_strlen
#include "linkdefs.hpp"
#include "platform.hpp"
#include "util.hpp" // parseWholeNumber
#include "link/fstack.hpp"
+2 -2
View File
@@ -3,14 +3,14 @@
// This implementation was based on https://github.com/agauniyal/rang/
// and adapted for RGBDS.
#include "platform.hpp" // isatty, strcasecmp
#include "style.hpp"
#include <stdio.h>
#include <stdlib.h> // getenv
#include <string.h>
#include "platform.hpp" // isatty, strcasecmp
#if !STYLE_ANSI
// clang-format off: maintain `include` order
#define WIN32_LEAN_AND_MEAN // Include less from `windows.h`
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "usage.hpp"
#include <stdarg.h>
@@ -8,7 +10,6 @@
#include "diagnostics.hpp" // vfatalx
#include "helpers.hpp"
#include "platform.hpp"
#include "style.hpp"
#include "util.hpp" // parseWholeNumber
#include "version.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
#include "platform.hpp"
#include "util.hpp"
#include <errno.h>
@@ -9,7 +11,6 @@
#include <string.h> // strspn
#include "helpers.hpp" // assume
#include "platform.hpp"
int xfclose(FILE *file) {
if (file == stdin || file == stdout || file == stderr) {