Rangi
122d91509f
Clear some more TODO comments ( #1677 )
2025-05-02 21:06:34 -04:00
Rangi42
00d0ae840d
Avoid use of goto in nextLine
2025-02-27 14:28:17 -05:00
Rangi42
79401cce8b
Add braces inside #define macro bodies
2025-01-27 20:12:12 -05:00
Rangi42
cae31005f8
Always use braces with InsertBraces: true in .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
Rangi42
4e2464a69d
Replace some #define with constexpr
2025-01-04 03:53:59 -05:00
Sylvie
b877c81c32
Use C++-style casts ( #1576 )
2024-12-09 21:56:54 -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
26fcff831d
Run clang-format
2024-08-27 01:49:05 -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
ISSOtm
86140b5b2f
Correctly apply section fragment offsets to contained symbols
2024-08-18 19:44:04 +02:00
ISSOtm
47b2e0e912
Trap bad __at() values too
...
Those set the section type earlier than the linker script,
so a check needs to be performed there too
2024-08-18 19:44:04 +02:00
ISSOtm
00b0914436
Reserve space to avoid file sym array realloc
...
This line was missing; in its absence, as soon as the array reallocs,
all registered symbol pointers are invalidated, leading to a crash
(e.g. when generating a sym file).
Made the reallocation check into a hard error, too.
Since fileSymbols gets registered with each section, we would have to
change that, and then it cascades throughout all of RGBLINK.
This will be handled correctly in the Rust port.
2024-08-18 19:44:04 +02:00
Ruben Zwietering
60c03ec1e3
Clear the old line buffer when filling the next one in nextLine
2024-08-18 19:44:04 +02:00
Ruben Zwietering
379aa8c267
Use line.reserve in sdobj_ReadFile instead of constructor
...
Passing a count parameter to the vector constructor does not reserve
count elements but instead fills the vector with count elements.
This caused the endianness check to fail first because the first 256
characters were null bytes.
2024-08-18 19:44:04 +02:00
Sylvie
a234da42a6
Replace assert with assume for release build optimization ( #1390 )
2024-04-02 11:09:31 -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
Sylvie
a68bebf4a2
Use a Defer struct to close files and restore lexer state with RAII ( #1379 )
2024-03-27 10:42:53 -04:00
Sylvie
dd43723e20
Use methods for RPN Expression ( #1372 )
2024-03-22 04:41:04 -04:00
Sylvie
0af1e512c2
Use std::get_if instead of std::visit ( #1367 )
...
`std::visit` is (arguably) cleaner code, but older versions of gcc
and clang (not very old; the ones packaged with Ubuntu 22.04 LTS)
compile them as tables of function pointers, instead of efficient
jump tables.
2024-03-20 22:37:54 -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
1b97297d63
Fix a typo bug in sdas_obj.cpp
...
This was introduced in commit 447c561 , PR #1330
2024-03-08 18:30:30 -05:00
Rangi42
e5b7e65e91
Use std::nothrow from <new> with every new allocation
2024-03-07 09:56:15 -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
2e1b0b6421
Remove commented-out C-only macro features
2024-03-02 20:17:22 -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
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
96f354026a
Use automatic allocation for section data
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
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
48b2e94aa3
Use std::string for symbol/section/node names and assertion messages
2024-02-29 13:44:08 -05:00
Rangi42
52ac98c294
Use std::vector for section data
2024-02-29 13:44:08 -05:00
Rangi42
4cd88ade54
Use automatic allocation for object file symbols
2024-02-29 13:44:08 -05:00
Rangi42
dead69eb2c
Use std::vector for section symbols
2024-02-29 13:44:08 -05:00
Rangi42
f47ce337bf
Use std::vector for reading object file symbols
2024-02-29 13:44:08 -05:00
Rangi42
5075ac8887
Use std::vector for RPN expressions
2024-02-29 13:44:08 -05:00
Rangi42
d792ee4b61
Use std::vector for section patches
2024-02-29 13:44:08 -05:00