Commit Graph

174 Commits

Author SHA1 Message Date
Rangi
f065243cd2 Enable RGBGFX's CLI "at-files" for all programs (#1848) 2025-10-22 17:05:59 -04:00
Rangi
23b9039716 Give clearer names to template parameters 2025-10-08 14:55:43 -04:00
Rangi
0c9920d4a6 Use C++ iterator for fragment/union "pieces" of RGBLINK sections 2025-10-05 15:07:25 -04:00
Rangi42
1fc9ba86c4 Some RGBLINK refactoring
- Consistently refer to `Section` fragments/unions as "pieces" (renaming `.nextu`)
- Remove `Symbol`'s `.label()` accessors (use `std::get<Label>`)
- Move some `Label`-related logic into `Symbol` methods
2025-09-05 16:34:51 -04:00
Rangi
534a4efee4 Add 0/1/2 warning levels to rgblink -Wtruncation (#1816) 2025-09-01 15:35:53 -04:00
Rangi
3d155d5695 Some refactoring and cleanup (#1806)
* Use clang-tidy `misc-include-cleaner` for IWYU `#include` cleanup

* Use `std::optional<size_t>` instead of `ssize_t`

* Rename some functions in linkdefs.hpp

* Fix header order
2025-08-20 16:09:04 -04:00
Rangi
b7e0783ae7 Implement ? suffix to "quiet" a context and exclude it from backtraces (#1800) 2025-08-18 21:34:58 -04:00
Rangi42
ea1358bbe6 Predef std::pair to two-element std::tuple 2025-08-13 20:48:54 -04:00
Rangi
50d0b101c3 Format linker script error backtraces the same way as others (#1792) 2025-08-12 16:58:17 -04:00
Rangi
5f8b7474b4 Add -B/--backtrace option to RGBASM and RGBLINK (#1787) 2025-08-11 14:30:14 -04:00
Rangi
752b273aec Extend RGBASM and RGBLINK verbosity flags to have multiple levels like RGBGFX (#1772) 2025-08-02 17:10:10 -04:00
Rangi42
308d488833 Use UpperMap for rgblink -S scramble spec matching
This also makes invalid RGBLINK CLI options into fatal errors
like the other programs
2025-07-29 03:41:31 -04:00
Rangi42
16e16cdf51 Split up the linkerscript lexer and layout actions 2025-07-27 13:38:20 -04:00
Rangi42
a353637a90 Split RGBLINK linkerscript parser functions into their own file 2025-07-27 11:31:25 -04:00
Rangi42
d652212857 Group extern RGBLINK variables in an Options struct, like RGBGFX 2025-07-21 18:12:40 -04:00
Rangi42
0cd60ea1e6 Use a patch_AddAssertion function instead of extern assertions 2025-07-21 17:49:41 -04:00
Rangi42
a0e23ee911 Remove unnecessary extern from nbSectionsToAssign 2025-07-21 17:27:43 -04:00
Rangi
5eb093f13e Implement warning diagnostic flags for RGBLINK (#1754) 2025-07-17 12:54:29 -04:00
Rangi42
8bebab1db0 Abbreviate RGBLINK errput that includes a src+lineNo 2025-07-15 18:37:28 -04:00
Rangi42
d32b1912ed Use verbosePrint in rgbasm as well as rgblink 2025-07-12 01:38:19 -04:00
Rangi
5e43ece578 Remove errx and errors.hpp (#1737) 2025-07-09 11:04:23 -04:00
Rangi
fda54fd0c3 Replace Either with std::variant (#1731) 2025-07-08 13:59:03 -04:00
Rangi
35962dedc4 Refactor warnings and errors (#1728)
* Remove `err` and `warn`, keep `errx` and `warnx`, using them in RGBGFX too

* Separate RGBGFX and RGBLINK warnings/errors from main options

* Separate `report` function into `error` and `fatal` messages

* Implicit newlines for most RGBASM errors
2025-07-08 12:58:23 -04:00
Rangi
b35e9d86fb Remove redundant @-style doc comment tags (#1641) 2025-01-29 19:56:28 -05:00
Rangi42
79401cce8b Add braces inside #define macro bodies 2025-01-27 20:12:12 -05:00
Rangi42
25c9f8f383 Add more rules to .clang-format 2025-01-27 20:12:12 -05:00
Rangi42
b8b60207f5 Use // line comments not /* block comments 2025-01-27 20:12:12 -05:00
Sylvie
1dcc000572 Report locations for RGBLINK errors with conflicting objects (#1494)
This requires updating the object file format to record the
fstack context for sections themselves, not just for patches.
2024-09-10 19:23:48 +02:00
Sylvie
323028d9f2 RGBLINK lists local symbols when encountering an unknown symbol reference (#1496) 2024-09-06 21:31:13 -04:00
Rangi42
b77ba1d87d Forward declare struct Section to avoid a nested header include 2024-08-26 22:58:38 -04:00
Sylvie
57c3d74b9e Use a custom generic tagged union Either instead of std::variant for efficiency (#1476)
* Implement custom generic tagged union `Either`

This should be more efficient than `std::variant`, while still
keeping runtime safety as it `assert`s when `get`ting values.

* Use `Either` for RPN expressions

* Use `Either` for file stack node data

* Use `Either` for `File` buffer

* Use `Either` for `STRFMT` args

* Use `Either` for RGBLINK symbol values

* Support an equivalent of `std::monostate` for `Either`

* Use `Either` for lexer tokens

* Use `Either` for symbol values

* Use `Either` for lexer mmap/buffer state
2024-08-20 21:19:11 +02:00
Sylvie
fc8707886c Output exported numeric constants to sym file (#1439) 2024-08-06 10:58:35 -04:00
Sylvie
6a65cbc9ed Some refactoring and reformatting (#1431) 2024-07-26 11:51:27 -04:00
Sylvie
352551d4f8 Allow padding to coexist with overlay file (#1395) 2024-05-17 11:14:44 +02:00
Rangi42
b8387427a6 Use consistent RGBDS_<PROG>_<NAME>_HPP header guard convention 2024-04-14 21:50:05 -04:00
ISSOtm
e5078aba3b Clean up #includes
Remove unused headers, and avoid relying on transitive inclusions

`include-what-you-use` has been very useful for this!
2024-03-28 01:25:38 +01:00
ISSOtm
cae7b5dcf6 Use standard attribute syntax instead of IBM __attribute__
Move format attrs to proper standard location

For some reason, GCC 13 is more lax than earlier versions...
2024-03-27 20:01:12 -04:00
Rangi42
506911d7d0 Refactor to avoid redundant obj_CheckAssertions function 2024-03-27 16:19:01 -04:00
Rangi42
846a9411b9 Refactor FileStackNode::dump to not need a helper function 2024-03-10 14:14:34 -04:00
Sylvie
17444e825a Reduce the header declarations (#1342)
- Since we have style rules to include foo.hpp at the top of its
  corresponding foo.cpp, this takes any headers included by foo.hpp
  as being also guaranteed for foo.cpp.

- Use C-style <foo.h> instead of <cfoo>, since the latter only
  guarantees putting symbols in the `std` namespace, which we are
  not using for C functions (e.g. `printf` not `std::printf`).

- Remove now-unused `__PRETTY_FUNCTION__` reporting
2024-03-09 14:55:39 -05:00
Sylvie
4a7d333891 Use std::unique_ptr for rgblink sections (#1337) 2024-03-09 11:12:01 -05:00
Sylvie
53537cf9af Remove now-unnecessary enum keyword (#1338)
C++ does not need it
2024-03-08 19:40:41 -05:00
Rangi42
bd88787cb3 Use FileStackNode constructor to avoid std::monostate possibility 2024-03-05 14:22:29 -05:00
Sylvie
e74073e480 Run clang-format on everything (#1332) 2024-03-04 14:22:49 -05:00
Rangi42
f2c875e71e Avoid using std::get except in holds_alternative-asserting accessors 2024-03-03 23:33:23 -05:00
Sylvie
447c561aaa Use std::variant for symbol values (#1330) 2024-03-03 21:16:36 -05:00
Rangi42
930a5c3e44 Replace RGBLINK non-null pointers with references 2024-03-03 00:57:03 -05:00
Rangi42
52f8ecc347 We do not call malloc/free any more 2024-03-02 08:16:44 -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