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
Rangi42
b8e267e387
Use std::vector for SDAS file sections
2024-02-29 13:44:08 -05:00
Sylvie
c0d534f5ad
No more flexible array members (not standard C++) ( #1307 )
...
* Replace FAMs with `std::vector`s (or one `std::string`) in four `struct`s
* Anonymous types declared in an anonymous union are also non-standard
Only Clang complains about this (-Wnested-anon-types)
2024-02-22 16:22:37 -05:00
Sylvie
d71a161bc9
Phrase error messages as "Failed to", not "Could not" or "Couldn't" ( #1298 )
2024-02-18 14:52:31 +01:00
Sylvie
66fd5a7062
Fix some usually disabled compiler warnings ( #1286 )
...
* Fixes from temporarily re-enabling more compiler warnings
* More edits suggested by cppcheck
* Fix hanging on append_yylval_string
* Fix FOR loop increment
2024-01-18 20:47:20 +01:00
Rangi
1e70e703a7
Build everything as C++ ( #1176 )
2023-11-07 21:45:56 +01:00