Commit Graph

2472 Commits

Author SHA1 Message Date
Rangi42 ba183e900b Update contributors 2024-03-03 21:17:52 -05:00
Sylvie 447c561aaa Use std::variant for symbol values (#1330) 2024-03-03 21:16:36 -05:00
Sylvie f8dab23e8f Use uncommented sizes for pointer-to-array arguments (#1329)
This is syntactically valid despite not being enforced, and
is a feature we already use elsewhere.
2024-03-03 19:43:08 -05:00
Eldred Habert 0da216897a Improve tests a little (#1324)
* Avoid redirecting error messages in RGBLINK tests

We check that RGBLINK prints nothing to stdout, so all that
would be captured on stdout is a putative failure message.

* Require each RGBLINK test to check error output

Otherwise, you can have a test that just... checks nothing!

* Document how to add tests

Fixes #1300's last remaining item.
Also add `checkdiff` rules to remind us to update that doc if
any of the test driver scripts are updated.
2024-03-03 19:12:29 -05:00
Sylvie 8cf446b14c Use std::variant for lexer mmap/buffer state (#1328) 2024-03-03 18:45:50 -05:00
Evie 6b67c82b94 Implement -c #none (#1301)
Also adds a test case for round-tripping `-r` with `-c #none`.
2024-03-03 18:45:33 -05:00
Rangi42 930a5c3e44 Replace RGBLINK non-null pointers with references 2024-03-03 00:57:03 -05:00
Rangi42 538b253dfb Replace RGBFIX non-null pointers with references 2024-03-03 00:57:03 -05:00
Rangi42 277ea9be28 Replace RGBASM non-null pointers with references 2024-03-03 00:57:03 -05:00
Rangi42 d812acff24 Check RGBGFX warning/error format strings with format_ macro 2024-03-02 23:17:54 -05:00
Rangi42 2e1b0b6421 Remove commented-out C-only macro features 2024-03-02 20:17:22 -05:00
Rangi42 52f8ecc347 We do not call malloc/free any more 2024-03-02 08:16:44 -05:00
Rangi42 19bb12754b Use new allocation for expanding \# 2024-03-02 08:04:59 -05:00
Rangi42 dbcb82799e Use std::vector for capture buffer 2024-03-02 06:46:11 -05:00
Sylvie a71e4086a2 Use std::string_view for macro bodies (#1326)
This removes the last use of `strdup`

This required making a lot of related pointers be `const`.
That in turn conflicted with the need to `munmap()` a pointer
eventually, which was similar to the need to eventually `free()`
an `Expansion`'s contents, so I used the same solution of a
`union`. That lets us normally use the `const` pointer for
`const` correctness, and the non-`const` one for the not-really-
mutating destruction cases.
2024-03-02 13:21:28 -05:00
Rangi42 2069a95e0f Use std::string for macro args 2024-03-02 05:23:15 -05:00
Rangi42 b130c2e27c Use std::string for STRFMT spec and args 2024-03-02 05:09:43 -05:00
Rangi42 ba00cf5684 Use std::string for section names 2024-03-02 04:47:02 -05:00
Rangi42 b488d3a90f Use std::optional<std::string> for lexer expansion names 2024-03-02 04:34:42 -05:00
Sylvie 701b926288 Use RAII std::string and std::vector in randtilegen (#1325) 2024-03-02 11:02:26 -05:00
Sylvie 446fb07fd5 Use std::deque<std::vector> for free space (#1323) 2024-03-01 16:21:29 -05:00
Sylvie 1ac3c0262f Refactor structs to use methods instead of functions (#1322) 2024-03-01 13:11:45 -05:00
Rangi42 e14ba664ea Remove redundant (void) parameter declarations 2024-03-01 10:41:47 -05:00
Rangi42 91d22f180e Reorganize the asm parser to be more like the linker script parser
Split the declarations into those required for the `%union` and
those only required for the `code`.
Only declare functions on top; define them at the bottom.
2024-02-29 16:23:53 -05:00
Sylvie 043db49676 Replace NULL with nullptr (#1321) 2024-02-29 15:06:33 -05:00
Sylvie eff8c324c8 Remove now-unnecessary struct keyword (#1320)
C++ acts like structs are `typedef`ed by default

We do have to keep `struct stat`, since there's ambiguity
with the function also called `stat`.
2024-02-29 14:41:58 -05:00
Rangi42 1210a7441f Use std::visit with Visitor helper instead of std::holds_alternatve 2024-02-29 13:44:08 -05:00
Rangi42 cf08fed067 Use std::vector for SDCC object section data 2024-02-29 13:44:08 -05:00
Rangi42 c44b336e1b Use std::vector for SDCC object line buffer 2024-02-29 13:44:08 -05:00
Rangi42 e90084ad06 Rename isWRA0Mode to isWRAM0Mode 2024-02-29 13:44:08 -05:00
Rangi42 cdb9315366 Use std::vector for rgbfix ROMX data
Statically links libstdc++ for 32-bit MinGW
2024-02-29 13:44:08 -05:00
Rangi42 2ff723f943 Use vec.data() instead of &vec[0]
In general `vec.data()` is always safe, whereas `&vec[0]`
may fail when `vec` is empty.
2024-02-29 13:44:08 -05:00
Rangi42 d1fa5ccd4d Rename lexer_DeleteState to lexer_CleanupState 2024-02-29 13:44:08 -05:00
Rangi42 17df94c75b Remove now-unnecessary cleanup functions 2024-02-29 13:44:08 -05:00
Rangi42 96f354026a Use automatic allocation for section data 2024-02-29 13:44:08 -05:00
Rangi42 8fe6be19f1 Use automatic allocation for tryReadstring 2024-02-29 13:44:08 -05:00
Rangi42 002eed405b Use automatic allocation for assertion error messages 2024-02-29 13:44:08 -05:00
Rangi42 ef1c1440a0 Use automatic allocation for symbol names 2024-02-29 13:44:08 -05:00
Rangi42 826512730c Use automatic allocation for section symbols 2024-02-29 13:44:08 -05:00
Rangi42 5a26a48d11 Use automatic allocation for section names 2024-02-29 13:44:08 -05:00
Rangi42 3c0af94c5c Use automatic allocation for patches 2024-02-29 13:44:08 -05:00
Rangi42 fc5ab8a14c Clarify comment explaining how referenced works 2024-02-29 13:44:08 -05:00
Rangi42 ace45bfd90 Refactor to avoid repeating rpn_isKnown(expr) 2024-02-29 13:44:08 -05:00
Rangi42 d6681d3580 struct Section's src can be const 2024-02-29 13:44:08 -05:00
Rangi42 0cc49782ab Use std::variant and automatic allocation for file stack node data 2024-02-29 13:44:08 -05:00
Rangi42 e1ac51d7da Use std::vector's .size() for SDCC sections and symbols 2024-02-29 13:44:08 -05:00
Rangi42 c3eb532439 Use copy constructor for file stack node 2024-02-29 13:44:08 -05:00
Rangi42 18d4a81954 Use move semantics for the union stacks 2024-02-29 13:44:08 -05:00
Rangi42 7daa8759c9 Use std::variant for STRFMT arguments 2024-02-29 13:44:08 -05:00
Rangi42 beb1997378 Use std::unordered_map for the keyword dict 2024-02-29 13:44:08 -05:00