Commit Graph

2360 Commits

Author SHA1 Message Date
ISSOtm 81edc27b6e Fix two warnings on MinGW 2026-04-16 00:57:33 +02:00
ISSOtm 6b994b1737 Fix some warnings raised by MSVC 2026-04-16 00:57:33 +02:00
Rangi df0b557638 Don't allow invalid interpolations to occur (#1925)
Fixes #1921
2026-04-11 18:16:07 +02:00
Eldred Habert 422e8eec20 Generate Bison output in CMake build tree (#1929)
Again, moving away from in-tree builds
2026-04-10 18:46:57 -04:00
Rangi 49a4da2235 Revert "Generate Bison output in CMake build tree"
This reverts commit 4577ff16bc.
2026-04-10 17:18:40 -04:00
ISSOtm 4577ff16bc Generate Bison output in CMake build tree
Again, moving away from in-tree builds
2026-04-10 22:56:59 +02:00
ISSOtm b430d5a8b8 Note why we are not using a CMake list to pass Bison flags 2026-04-10 22:33:54 +02:00
ISSOtm a5be1d886e Copy DLLs to appropriate dir for install-less Windows testing
Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
2026-04-10 18:01:16 +02:00
vulcandth c3b47abcc8 Use CPack for Windows packaging 2026-04-10 18:01:16 +02:00
Rangi 6e13779b8b Use C++-sryle static_cast, not C-style explicit cast
`uint32_t(param)` is actually functional notation of explicit casting,
not a direct constructor call. `uint32_t{param}` would be uniform
initialization syntax for a constructor call, but would not allow
narrowing from `uint64_t`. See issue #1904 for discussion.
2026-04-08 20:05:36 -04:00
Rangi 9b4b4a581b Check for overflow in fixed-point precision suffix (#1918)
Fixes #1917
2026-04-07 17:06:54 -04:00
Rangi 11f6278d95 Refactor lexing of fixed-point numbers (#1915)
This incidentally fixes a bug with too-long fixed-point literals
that have precision suffixes.
2026-04-06 21:45:34 -04:00
Rangi ede9405daf Fix some fixed-point literal lexing issues (#1914)
- No fractional digits are necessary after the decimal point,
  e.g. `42.` is valid instead of `42.0`
- Error messages refer to "fixed-point" not "integer" constants
- Test more carefully for lexing unrelated to underscores
2026-04-04 13:41:45 -04:00
Rangi 25bf0e9e2c SOURCE_DATE_EPOCH must be in base 10 2026-03-30 21:31:37 -04:00
Rangi 18b074711e Fix rgbasm -s not overriding a previous -s 2026-03-30 20:18:19 -04:00
Rangi efd4373a56 Check for a SDAS "Def" or "Ref" line before reading a subsequent integer
Without checking `token[0]` through `token[2], `readInt` starting at
`&token[3]` could go out of bounds on a badly-formed SDAS .rel object file
2026-03-30 19:45:44 -04:00
Rangi 66e521e9e5 Factor out common error-handling functions for lexing numbers of different bases (#1888) 2026-03-19 15:32:25 -04:00
ISSOtm d6d1844d60 Seek lib deps via CMake FetchContent
`FetchContent` respects existing installs, and downloads and compiles the libs
if they aren't found.
This is admittedly a little finicky, since this ignores the usual `Find*`
modules provided by CMake, requiring a bit of glue on our side.

But, one upside is that this moves that logic from our CI into the build system,
which can thus benefit other downstream users.
This also opens the door to some improvements in upcoming commits.

Doing this with Bison turned out to be much more painful, however, due to
`FindBISON` providing the specific `bison_target` command; thus, it remains
installed externally, so that it can be picked up by `FindBISON`.

This also bumps our CMake version requirement slightly, though it's
possible that older versions keep working, or could be supported with small patches;
however, our CI doesn't provide anything below 3.31, so we can't check.
2026-03-19 20:30:12 +01:00
ISSOtm 091452d591 Remove call to configuring version file
Missed in 5c4ca36c5a
2026-03-17 05:28:23 +01:00
ISSOtm df1d909853 Improve documentation of CMake bin output dir 2026-03-17 05:27:39 +01:00
ISSOtm 5c4ca36c5a Harmonise passing build version
Avoid running some configure step, instead pass it as a define like the Makefile
2026-03-16 20:23:47 -04:00
ISSOtm d8722b6705 Use imported targets for linking to libpng
This massively simplifies the process lol
2026-03-16 20:23:47 -04:00
ISSOtm 63c7835e71 Stop overriding the binaries' install dir
This is equivalent to the default, except the default accepts being overridden
2026-03-16 20:23:47 -04:00
ISSOtm bc37b0ece6 Skip trying to link to libm explicitly
This doesn't seem to be necessary: it is automatically linked to,
at least on my machine. \*shrugs\*
2026-03-16 20:23:47 -04:00
ISSOtm a139cbc744 Refactor the source file listing
Make the common files into an object library, which lets them
be compiled only once (saving 41 build steps)
This also lends itself well to removing the per-program loop,
which simplifies the code somewhat.
2026-03-16 20:23:47 -04:00
ISSOtm d054f07703 Fix some truncation warnings
Amusingly, reported by MSVC only
2026-03-10 01:31:23 -04:00
Rangi 48d58ba095 Pass -Wdangling-alias to Bison 3.5 or newer
`bison -Wall` enables all diagnostics except `-Wcounterexamples`
(added in 3.7; we already pass it), `-Wyacc` (which we do not need),
and `-Wdangling-alias` (added in 3.5).
2026-03-06 22:28:09 -05:00
Eldred Habert 7c1e1fe515 Reference the file that actually provides the linker script lexer 2026-01-27 12:54:06 +01:00
Rangi d053025070 Avoid writing "XXX" since it's a conventional "TODO/FIXME" comment 2026-01-22 13:01:10 -05:00
Rangi e738b90c69 Refactor to combine similar functions into one 2026-01-07 16:36:04 -05:00
Rangi a91d26192d Fix SECTION UNION alignment depending on piece order 2026-01-07 16:36:04 -05:00
Rangi 41fe1d8f25 Correct error message for unconstrained sections with overlay (#1879) 2025-12-28 19:21:53 -05:00
Rangi a9ab248fed Improve some RGBGFX error messages (#1876)
* Improve some RGBGFX error messages

* Fix assertion failure on ambiguous transparent/opaque pixels
2025-12-19 13:00:05 -05:00
Rangi 2666dcbc26 Remove exclamation marks and periods from error messages (#1874) 2025-12-10 11:50:33 -05:00
Rangi b0e0dfc56e Handle a missing -P/--preinclude file the same as an INCLUDE (#1873) 2025-12-08 14:39:34 -05:00
Rangi 33475e2c36 Factor out version-printing to usage.cpp (#1870) 2025-12-05 23:04:49 -05:00
Rangi c8161be23a Add missing SPDX-License-Identifier: MIT comments 2025-12-05 22:41:12 -05:00
Rangi 2c5c453ab8 Refactor FileStackNode::printBacktrace from recursive to iterative
This avoids a potential stack overflow for very long backtraces,
or for corrupt object files with cyclic backtraces
2025-12-05 22:41:12 -05:00
Rangi 3631fab63c Fix bug where an object's invalid ROMX bank of 0 could break rgblink (#1868) 2025-12-05 11:21:00 -05:00
Rangi 1c00123b33 Add missing return 0; to rgblink main() 2025-12-04 21:06:46 -05:00
Rangi 131bb97ebc Fix some rgblink object file input bugs found via fuzzing with AFL++ (#1867)
- ID numbers (for fstack nodes, sections, symbols, patches, etc)
  might be too large for their associated collection
- Enum values might be invalid
- Bank values might be out of range for their section types
2025-12-04 20:49:16 -05:00
Rangi42 752e2b3620 Symbol names with more than two '.'s could be defined as constants
Dot-only names could also trip an assertion in `make develop`
when used as labels
2025-12-04 15:15:41 -05:00
Rangi42 ad3188f038 Fix garbage characters at EOF causing an infinite loop 2025-12-04 15:15:41 -05:00
Rangi 1eb4eb3339 Reuse the usage.name for printing version info 2025-11-18 22:32:45 -05:00
Rangi a3d3e1525a Fix RGBLINK object type detection 2025-11-18 22:01:43 -05:00
Rangi 3553c9c4da Fix RGBLINK evaluation of undefined RPN symbols
This was the only RPN case to not assign a deliberate value
in all possible branches.

Fixes #1858
2025-11-18 16:40:24 -05:00
Rangi 5c2c893ced Refactor getSectionDescription in src/link/assign.cpp 2025-11-16 17:37:01 -05:00
Rangi 0f266d1c66 Specify more ASan options (#1860) 2025-11-16 17:11:09 -05:00
Rangi 04e3a904c2 Avoid calling style_Set/Reset before strerror(errno),
since they may call `isatty` which can change `errno`

Fixes #1857
2025-11-08 12:06:16 -05:00
Rangi 395b03e88e Disallow SECTION UNION for ROM sections
Fixes #1855
2025-11-07 11:38:06 -05:00