Commit Graph

  • 55fbecee49 Add info about string expansions in error reports This is especially useful when an EQUS expands to another one, to help track them. This is done separately from the file stack as the EQUS stack is separate (which is itself because EQUS are managed *way* differently). ISSOtm 2019-09-12 09:57:01 +02:00
  • f36a3d5b2a Fix macro and rept buffer overflows Macro and rept buffers were not always being terminated with newlines and/or were vulnerable to the final newline being escaped, allowing buffer overflows to occur. Now, they are terminated with newlines using the same mechanism as the file buffer. dbrotz 2019-09-10 03:03:04 -07:00
  • c5e8e4ff83 Reject input that contains null characters Null characters in the middle of strings interact badly with the RGBDS codebase, which assumes null-terminated strings. There is no reason to support null characters in input source code, so the simplest way to deal with null characters is to reject them early. dbrotz 2019-09-09 17:27:56 -07:00
  • ccc666c1e4 Merge pull request #417 from ISSOtm/zero_sections Eldred Habert 2019-09-09 23:32:30 +02:00
  • 89eda89838 Handle tabs after backslash at end of file Commit 6fbb25c added support for tabs between a \ and the newline it escapes, but yy_create_buffer() was not updated to handle tabs. dbrotz 2019-09-09 12:25:26 -07:00
  • 17b9838c8f Merge pull request #418 from dbrotz/fix-symbol-macro-arg-0 Eldred Habert 2019-09-09 19:37:44 +02:00
  • 889dd83798 Print useful error message when '\0' is used in a symbol name AppendMacroArg() was passing 0 to sym_FindMacroArg(), which caused an assertion failure. Now, AppendMacroArg() prints an error message instead. dbrotz 2019-09-09 09:46:18 -07:00
  • 38a372f25f Allow 0-byte SECTIONs to be fixed anywhere They do not take any room, so they can only be used to define symbols at a given location. I ran into trouble with such a SECTION failing to be placed where specified, which doesn't make sense. This way, it also makes sense to have such a SECTION in the middle of another one, but that should be fine, since there's no actual overlap. ISSOtm 2019-09-08 23:59:15 +02:00
  • 1288737c0d Clean up suffix rules Generate .c files from .l files instead of directly a .o Improve yacc and lex header generation dependency ISSOtm 2019-09-07 12:19:04 +00:00
  • 5902306271 Have make clean delete all generated .o files Especially important if the file structure changes, to avoid leaving stale object files in non-fresh repos. ISSOtm 2019-09-07 12:14:56 +00:00
  • 2fe4521a96 Remove locallex.o reference The file was deleted in 8e88659, finish eliminating it ISSOtm 2019-09-07 12:09:08 +00:00
  • 74673436a1 Separate LDFLAGS from CFLAGS ISSOtm 2019-09-07 12:06:46 +00:00
  • 481748c279 Make CI output Makefile commands This is good for debugging Makefiles on systems I don't have (eg. macOS) End users will not be affected by this, and CI provides a persistent log so clobbering isn't much of an issue. ISSOtm 2019-09-07 11:56:52 +00:00
  • 2e6f5ac679 Fix unary NOT being broken nVal wasn't being set, this made the operator a no-op on constant expressions ISSOtm 2019-09-08 21:42:17 +02:00
  • 7a45fc68d9 Fix incorrect evaluation of && and || f29d768 forgot to switch these two expr->nVal to src1->nVal This won't break anything, since this wasn't published yet. I checked, and didn't see any other missed changes. ISSOtm 2019-09-08 21:12:31 +02:00
  • 9faa5c7a9e Update docs on char escapes in macro args Fixes #415 ISSOtm 2019-09-05 15:40:54 +02:00
  • 6fbb25c0da Clean up lexer.c Remove some hardcoded character values Allow tabs to be used for line continuations ISSOtm 2019-09-05 15:22:24 +02:00
  • 65fc42cce5 Remove -Wchkp from develop target This option has been removed in GCC 9, and according to GCC 8.2's man page, only has an implementation on Intel MRX anyways. ISSOtm 2019-09-05 05:56:11 +02:00
  • 736b7727b6 Merge pull request #400 from NieDzejkob/out.pipe-substitute Eldred Habert 2019-09-04 18:43:00 +02:00
  • fa920f8449 Remove the no-longer-needed .out.pipe files Jakub Kądziołka 2019-08-29 20:24:07 +02:00
  • 01aa56606f test/asm: special-case include-recursion Jakub Kądziołka 2019-09-03 22:54:22 +02:00
  • bddd5bc678 test/asm: Generate .out.pipe files on the fly Jakub Kądziołka 2019-08-29 20:23:50 +02:00
  • f6b7e39ce7 Merge pull request #405 from ISSOtm/output_errors Eldred Habert 2019-09-03 10:05:19 +02:00
  • 1363dd8f34 Add url link to releases page to readme (#413) clach04 2019-09-02 16:51:38 -07:00
  • 8214f0c09d Merge pull request #412 from clach04/patch-1 Eldred Habert 2019-09-03 00:50:43 +02:00
  • ff7c46f5a6 Readme windows install instructions, alternative install location clach04 2019-09-02 10:19:22 -07:00
  • b44f5825a5 Make RGBDS behave identically whether writing a .o Some errors are only tripped in out_WriteObject, which was basically a stub when -o wasn't specified. Now, instead, errors are checked in a separate function before out_WriteFile ISSOtm 2019-08-30 22:06:41 +02:00
  • 631910bd67 Merge pull request #395 from ISSOtm/better_error_stack Eldred Habert 2019-09-02 14:33:06 +02:00
  • 37089ef940 Improve error stack The old error stack was fairly obtuse and hard to use for debugging. This improves it notably by ensuring all line numbers are relative to the file, and not, say, the macro definition. This is a breaking change if you were parsing the old stack, but the change should be painless, and the new stack only brings more info. The syntax is unchanged for files, macros see their name prefixed with the file they're defined in and a pair of colors, REPT blocks simply append a '::REPT~n' to the context they're in, where 'n' is the number of iterations the REPT has done. This is especially helpful in macro-heavy code such as rgbds-structs. ISSOtm 2019-08-29 17:03:50 +02:00
  • 4ef27a0d23 Merge pull request #411 from ISSOtm/recursion_limit Eldred Habert 2019-09-02 02:21:16 +02:00
  • 476ccc9f6b Fix undefined behavior in yyunputstr Refer to comment at lexer.c:100 for more info ISSOtm 2019-09-02 02:09:59 +02:00
  • 89dc14fcaf Merge pull request #408 from ISSOtm/plumbing Eldred Habert 2019-09-01 22:16:27 +02:00
  • 1ca2f12d24 Update README.rst clach04 2019-09-01 09:51:47 -07:00
  • 20b2f5ee2f Fix incorrect line numbers with some IF blocks If a line ended with a string's closing quote, or a newline escape, then skipping over that line via IF/ELIF/ELSE would fail to count that line, offsetting the rest of the file. I have no idea why but for some reason 9829be1 changed *specifically* if_skip_to_else to have incorrect behavior on string endings. The incorrect behavior on newline escapes seems to have been here since the beginning. Also added a test to check for both of those behaviors in both functions. ISSOtm 2019-09-01 03:42:50 +02:00
  • 3cc67c48cf Add recursion limit info to man and help ISSOtm 2019-08-31 17:34:54 +02:00
  • f9a04696f2 Add recursion overflow tests ISSOtm 2019-08-31 17:22:43 +02:00
  • e0e8170fe6 Add recursion limit for string expansions Unlike macros, REPTs and INCLUDEs, this recursion depth is independent. This is intentional, because string expansions work very differently. ISSOtm 2019-08-31 15:36:58 +02:00
  • 9b40663d54 Merge pull request #409 from rednex/dd-head Eldred Habert 2019-08-31 12:59:18 +02:00
  • a517f900e4 Use POSIX-compatible dd(1) instead of head -c. Anthony J. Bentley 2019-08-30 23:11:28 -06:00
  • 350f40300c Merge pull request #403 from dbrotz/multiple-charmaps Eldred Habert 2019-08-31 04:44:58 +02:00
  • d3db5f0d76 Add pushc and popc directives dbrotz 2019-08-30 19:36:23 -07:00
  • 7e3af4b3cd Make testing external projects use local RGBDS Currently, the installed version is used instead, which isn't consistent with the tests, which use the local version. ISSOtm 2019-08-31 04:17:08 +02:00
  • dfb3072381 Fix memory leaks with macro args REPT blocks nested in macros (and possibly other cases) leaked memory on every call. Unlike most other memory leaks, which would be freed at the end of program execution if they were done properly, those piled up the more compilation went on. I believe memory usage could have started being fairly high on large projects following the "one master file INCLUDEs all the rest" so this may have actually been worth it. ISSOtm 2019-08-31 03:52:42 +02:00
  • 02191135a0 Fix possible unterminated string sym_SetMacroArgID used a sprintf that could write no \0. In practice this was benign because %u cannot print 256 chars, but better future-proof this. ISSOtm 2019-08-31 03:00:26 +02:00
  • dc2c97fe0c Comment and improve ParseSymbol and AppendMacroArg ISSOtm 2019-08-30 20:47:04 +02:00
  • 6068b565f5 Add recursion limit for INCLUDE and macros (And REPT.) Not exactly a *recursion* limit, more like a *stack depth* limit, but calling it "recursion" conveys its purpose better. The default of 64 is super overkill: even in a a project with what I believe to be above-average levels of nesting, the level only peaked at 6. Keeping in mind the purpose of this is to catch infinite recursion, which is still caught quickly (in usual cases, anyways), this default seems sensible. And it passes tests. What more do you need? ISSOtm 2019-08-30 04:42:56 +02:00
  • a21cef7190 Say which macro argument caused an error when one does ISSOtm 2019-08-30 20:57:11 +02:00
  • 461ef6cea5 Don't complain about initializing statics This error is specific to the way the Linux kernel handles statics. It does not apply to userspace programs. dbrotz 2019-08-29 22:48:16 -07:00
  • e05199ca1e Add support for multiple charmaps This adds two new directives: newcharmap and setcharmap. newcharmap creates a new charmap and switches to it. setcharmap switches to an existing charmap. dbrotz 2019-08-29 21:54:06 -07:00
  • 12d82eb768 Remove extra entry in error stack on macro not defined (#394) Eldred Habert 2019-08-30 02:14:21 +02:00
  • 05becf3f4b Merge pull request #381 from NieDzejkob/rgbgfx-curve Eldred Habert 2019-08-29 22:19:36 +02:00
  • 3cc7981c82 Merge pull request #402 from dbrotz/fix-386 Eldred Habert 2019-08-29 22:06:10 +02:00
  • 8f287eeef9 Fix nested if statements that don't have following whitespace When trying to skip over nested if statements, if there was no whitespace after an "if", then that "if" would not be recognized. That's a problem since "if(" and "if{" are also valid ways to start an if statement. This change will make it so that they are recognized correctly. dbrotz 2019-08-29 12:37:59 -07:00
  • ce05cb5683 Merge pull request #401 from dbrotz/line-cont-test Eldred Habert 2019-08-29 21:23:00 +02:00
  • 17945a7377 Get rid of error in line continuation test The purpose of the test is to ensure that rgbasm doesn't segfault in this case. The "Macro '@' not defined" error is unnecessary. dbrotz 2019-08-29 11:49:17 -07:00
  • 3a1b47129e Merge pull request #397 from NieDzejkob/test-local-without-parent Eldred Habert 2019-08-29 20:24:36 +02:00
  • 6ffa751090 Merge pull request #390 from ISSOtm/print_types Eldred Habert 2019-08-29 20:12:32 +02:00
  • c3641321d7 Merge pull request #399 from ISSOtm/allow_dots Eldred Habert 2019-08-29 20:09:32 +02:00
  • 446173f0cb Merge pull request #387 from ISSOtm/set_doesnt_override_equ Eldred Habert 2019-08-29 20:08:08 +02:00
  • e27f381842 Merge pull request #361 from ISSOtm/better_section_overflow Eldred Habert 2019-08-29 20:04:48 +02:00
  • a3ee76dddd Allow periods to continue macro args c75a953 broke my (previously-working) project that defined, via macros, 'sizeof_.player'. A test was added to confirm that those are indeed accepted outside of macros. ISSOtm 2019-08-29 19:27:03 +02:00
  • 995265c549 Improve testing bracketed symbols Also test EQU and _RS constants, as well as that EQUS errors out, and that labels don't work. ISSOtm 2019-08-29 19:16:28 +02:00
  • 03629b74d9 Add a test for a defining local label without a parent Jakub Kądziołka 2019-08-29 19:14:02 +02:00
  • b069278e98 Merge pull request #384 from dbrotz/fix-local-label-segfault Eldred Habert 2019-08-29 19:05:27 +02:00
  • 9738c88f95 Merge pull request #383 from dbrotz/fix-380 Eldred Habert 2019-08-29 17:14:05 +02:00
  • a21ea30be0 Add tests for bracketed symbols ISSOtm 2019-08-29 17:08:54 +02:00
  • 64752da42d Add "print types" to bracketed symbols Should partially cover #178 and close #270. This allows printing numbers in different bases and without the dollar prefix This is especially useful in macros because the dollar isnt a valid character for symbol names, requiring heavy STRSUB usage. ISSOtm 2019-08-28 03:04:19 +02:00
  • e3e18063c6 Prevent SET from overriding constant symbols Fixes #341 ISSOtm 2019-08-27 21:07:42 +02:00
  • e400eac42b Improve section overflow error message When trying to fix a section becoming too large, the size it reached is necessary to know whether to optimize away a few bytes or split it entirely. This error is also commonly encountered when INCBINing too large a slice of a file, in which case the amount of bytes by which the section is too large is again an useful information ISSOtm 2019-06-26 00:44:26 +02:00
  • a6bf77718c Check if parent exists for local label reference If an attempt is made to reference a local label before any non-local label is defined, raise an error instead of segfaulting. dbrotz 2019-08-20 09:57:53 -07:00
  • c2787a9ea9 Change the precedence of == to match the documentation The documentation states that == has the same precedence as the other comparison operators. dbrotz 2019-08-20 08:50:18 -07:00
  • e33e6e2413 Merge pull request #382 from NieDzejkob/checkpatch-bool-member Antonio Niño Díaz 2019-08-20 14:17:15 +01:00
  • 3cb56c5a2e checkpatch.conf: Don't complain when bools are used in struct Jakub Kądziołka 2019-08-20 14:43:31 +02:00
  • 91984cb7e7 rgbgfx: Add an option to take the CGB's color profile into account Jakub Kądziołka 2019-08-20 14:15:07 +02:00
  • b8d5dd1824 Merge pull request #366 from dbrotz/fix-313 Antonio Niño Díaz 2019-08-17 16:09:09 +01:00
  • 88b66f2941 Merge pull request #364 from dbrotz/fix-362 Antonio Niño Díaz 2019-08-17 16:08:27 +01:00
  • 3c7e59b9e1 Merge pull request #374 from Ben10do/pushs-outside-of-section Antonio Niño Díaz 2019-08-17 16:07:28 +01:00
  • c4471e3300 Update CONTRIBUTORS.rst Ben Hetherington 2019-08-16 12:05:12 +01:00
  • 16111f46ef Allow PUSHS to be used before a section Ben Hetherington 2019-08-16 13:20:15 +01:00
  • b019b03946 Merge pull request #358 from dbrotz/fix-357 Antonio Niño Díaz 2019-07-12 00:49:08 +01:00
  • 605acd24ba Merge pull request #372 from jidoc01/master Antonio Niño Díaz 2019-07-12 00:48:25 +01:00
  • c8630eee95 Document the feature of input from stdin jidoc01 2019-07-08 23:28:46 +09:00
  • 4040555532 Merge pull request #365 from dbrotz/terminate-bracketed-symbol Antonio Niño Díaz 2019-07-07 11:46:43 +01:00
  • defb221c98 Merge pull request #360 from jidoc01/master Antonio Niño Díaz 2019-07-07 11:46:08 +01:00
  • e7dc094e56 Improve charmap structure with trie jidoc01 2019-06-25 00:58:47 +09:00
  • dfdb107105 Merge pull request #370 from jidoc01/fix_bug Antonio Niño Díaz 2019-07-06 11:10:17 +01:00
  • 9f598dfdb7 Merge pull request #359 from dbrotz/fix-lexer-out-of-bounds Antonio Niño Díaz 2019-07-06 11:09:43 +01:00
  • 38110a833d Fix comment bug jidoc01 2019-07-04 11:59:13 +09:00
  • 484d15dbb2 Handle unprintable characters more gracefully * Skip UTF-8 byte order mark at beginning of file * Error on other unexpected unprintable characters dbrotz 2019-06-29 12:50:41 -07:00
  • 1decf5d0d4 Fix out of bounds array access in lexer If the type char is signed, then in the function yylex_GetFloatMaskAndFloatLen(), *s can have a negative value and be converted to a negative int32_t which is then used as an array index. It should be converted to uint8_t instead to ensure that the value is in the bounds of the tFloatingFirstChar, tFloatingSecondChar, and tFloatingChars arrays. dbrotz 2019-06-16 15:50:56 -07:00
  • 74e9de1b71 Check for RPN stack overflow in linker dbrotz 2019-06-11 10:45:51 -07:00
  • 015d2b0830 Fix buffer overflow when creating patches with long RPN expressions dbrotz 2019-06-11 09:35:57 -07:00
  • c75a9539ba Don't append invalid characters to symbol name When a macro arg appears in a symbol name, the contents are appended. However, the contents of the macro arg were not being validated. Any character, regardless of whether it was allowed in a symbol name, would be appended. With this change, the contents of the macro arg are now validated character by character. The symbol name is considered to end at the last valid character. The remainder of the macro arg is treated as though it followed the symbol name in the asm source code. dbrotz 2019-06-26 17:36:12 -07:00
  • ca6149abcf Fix signed integer overflow issues dbrotz 2019-06-28 16:36:23 -07:00
  • b3120aea25 Terminate standalone bracketed symbol strings dbrotz 2019-06-26 17:45:49 -07:00
  • 54e5bf0f0c Merge pull request #343 from phs/phs/docker Antonio Niño Díaz 2019-07-04 23:07:16 +01:00
  • 847cae5b95 Merge pull request #329 from NieDzejkob/allow-stdin-input Antonio Niño Díaz 2019-07-04 23:02:42 +01:00
  • df15c97b6e Handle zero-byte files gracefully Jakub Kądziołka 2019-07-03 16:28:51 +02:00
  • 0d97b58265 Avoid potentially implementation-defined behavior when using a pipe as input Jakub Kądziołka 2019-07-03 15:37:17 +02:00
  • f7bc61e874 Automatic tests for input from stdin Jakub Kądziołka 2019-06-05 20:48:27 +02:00