Commit Graph

1377 Commits

Author SHA1 Message Date
Jakub Kądziołka df15c97b6e Handle zero-byte files gracefully 2019-07-03 16:38:35 +02:00
Jakub Kądziołka 0d97b58265 Avoid potentially implementation-defined behavior when using a pipe as input 2019-07-03 16:38:00 +02:00
Jakub Kądziołka 8d5a53f529 Handle non-seekable input correctly 2019-07-03 15:38:14 +02:00
Jakub Kądziołka 20f9492899 Allow using - to indicate input from stdin 2019-07-03 15:38:14 +02:00
dbrotz 975f85260d Use code points instead of bytes for STRSUB/STRLEN 2019-06-02 16:10:34 -07:00
dbrotz f29d768989 Set all of expr struct's fields in mergetwoexpressions() 2019-05-31 08:59:50 -07:00
Antonio Niño Díaz cc458a9693 Fix a few checkpatch issues 2019-05-31 12:34:14 +01:00
dbrotz b909a5063a Include symbol name in 'symbol too long' error message 2019-05-29 10:56:59 -07:00
dbrotz e12e7b2acc Don't assign PC to macro symbols
Macros have nothing to do with the current PC, so this doesn't make any sense.
The value isn't ever used either.
2019-05-09 15:01:06 -07:00
dbrotz 249acace08 Prevent non-reloc symbol from shadowing reloc symbol 2019-05-09 12:48:10 -07:00
dbrotz 021990b8e0 Properly check if a symbol's full name is too long 2019-05-05 20:21:55 -07:00
dbrotz 540564694c Add missing space to error message 2019-05-05 18:13:10 -07:00
dbrotz 8da4feb83c Use sym_FindSymbol() where possible 2019-05-05 18:10:05 -07:00
dbrotz 23f5e9dacc Use only one pass 2019-05-05 15:50:56 -07:00
Antonio Niño Díaz 6ff9435e0a Merge pull request #335 from dbrotz/fix-334
Dynamically allocate RPN expression buffer
2019-05-05 23:33:36 +01:00
dbrotz 40006c6152 Make yylex() return int 2019-05-02 19:53:45 -07:00
dbrotz b256e4c2e3 Dynamically allocate RPN expression buffer 2019-05-02 19:31:26 -07:00
Jakub Kądziołka 2f2f14bf80 Fix symbol length checking
When the while loop in `ParseSymbol` stops because of the symbol length,
`copied` will have the value of `MAXSYMLEN`, which is obviously not
greater than `MAXSYMLEN`. Changing the condition to `>=` fixes the
issue.

As a bonus, the correct union field will now be used. It shouldn't
matter, but it's technically UB to use a wrong one.
2019-03-02 19:11:53 +01:00
mid-kid d07ba6971b Update a symbol's filename and line when defined
Currently, all symbols are assigned a filename and line when they're
first encountered and added to the internal hash table. This is often
not expected and leads to erroneous error messages.
2019-01-12 12:57:58 +01:00
Antonio Niño Díaz 4b40d63dfd Merge pull request #311 from dbrotz/fix-222
Fix #222 and #255
2018-12-10 23:17:39 +00:00
Antonio Niño Díaz a99b7f6902 Merge pull request #314 from dbrotz/fix-314
Fix #314
2018-12-10 23:09:39 +00:00
Antonio Niño Díaz b3391f699f Merge pull request #310 from dbrotz/fix-302
Fix #302
2018-12-10 23:05:22 +00:00
dbrotz a05fd9b818 Print full file path in error messages 2018-12-06 22:59:24 -08:00
dbrotz 6c1ec59a5b Use separate function to append newlines 2018-12-05 01:32:06 -08:00
dbrotz a060f135b8 Only add newlines to file if necessary 2018-12-02 20:43:20 -08:00
dbrotz f5d3087e9b Check if integer constants only contain radix prefix 2018-12-02 16:16:41 -08:00
dbrotz 3806eb3139 Fix ambiguity in const parsing 2018-12-02 13:49:12 -08:00
dbrotz bad66e54fa Fix buffer overflow when file ends with \ 2018-12-01 07:21:25 -08:00
karas 5cb6c4af4b Fix typo in documentation
Signed-off-by: GwanYeong Kim <gy741.kim@gmail.com>
2018-08-30 18:53:44 +09:00
Antonio Niño Díaz 69f79f8598 Remove unused str2int()
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-08-18 00:19:48 +01:00
karas 573011a99e Remove dead code
Fixed: #301

Signed-off-by: GwanYeong Kim <gy741.kim@gmail.com>
2018-08-17 18:49:19 +09:00
Anthony J. Bentley 432a7574c9 Remove alphabetical list of keywords.
The original list only existed because the documentation was split
across multiple files. When all keywords are described in a single
document, Ctrl+F suffices to find them.
2018-07-28 02:05:52 -06:00
Anthony J. Bentley 4d2598e7bf Fix Bl -column widths: the arguments are strings as wide as the column. 2018-07-28 02:02:47 -06:00
Anthony J. Bentley 2e565bcb4e Escape some operators. 2018-07-28 01:55:38 -06:00
Anthony J. Bentley 62ecb6da0b Mark up #define with Fd. 2018-07-28 01:55:38 -06:00
Anthony J. Bentley 46fcebe2b5 Use .Fn for defining functions. 2018-07-28 01:55:35 -06:00
Anthony J. Bentley ab1901eeac Remove excess tabs in column lists. 2018-07-28 01:55:35 -06:00
Anthony J. Bentley 29d2fc6ebc Cleanup "Sections" section. 2018-07-28 01:55:28 -06:00
Anthony J. Bentley efe4599bd8 New sentence, new line. 2018-07-28 00:46:16 -06:00
Anthony J. Bentley 4fc1e41b16 @, &, $, {, and } don't need to be escaped. 2018-07-28 00:46:16 -06:00
Anthony J. Bentley e771d60ec0 Eliminate \[dq] escapes and superfluous double quotes.
" can be used directly except in macro lines. Also in some situations
wrapping with a Dq or Ql macro can be more appropriate.
2018-07-28 00:45:54 -06:00
yenatch e2de106d71 Use charmaps in const expressions. 2018-07-06 22:58:58 -04:00
yenatch e6e3cc474d Fix UTF-8 characters with an even number of bytes. 2018-06-30 19:41:46 -04:00
Antonio Niño Díaz f8b4cc52f6 rgbasm: Allow variations of 'ld [$FF00+c],a'
The following mnemonics are now valid:

    - ld
    - ldh
    - ldio

The following are valid as operands:

    - [$ff00+c]
    - [$ff00 + c]
    - [c]

This is done for consistency with 'ld [$FF00+n],a' and variations of it.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-05-20 21:04:47 +01:00
Antonio Niño Díaz d945c5811c rgbasm: Check the values of operands in bit shifts
The tests are not exhaustive, there are some conditions that aren't
checked. The tests are based in the C standard rules about undefined
behaviour.

This is a compatibility break but, hopefully, all projects are using
sane values. If not, there is no guarantee that the projects will build
in any platform where RGBDS can be compiled, so it would be better to
fix them.

Even though, technically, the left shift of a negative value is always
undefined, some projects rely on its current behaviour. This is the
reason why this doesn't cause a fatal error.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-28 01:59:37 +01:00
Antonio Niño Díaz e2b4554a5c Replace tabs by spaces in fprintf()
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-03 22:41:44 +01:00
Antonio Niño Díaz ef87dd5a6e rgbasm: Fix declaration of fatalerror()
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-03 22:41:37 +01:00
Antonio Niño Díaz 1b4187e51f Cleanup GCC compiler attributes
Added define 'unused_' for '__attribute__((unused))'. The oldest version
of GCC with online docs (GCC 2.95.3, released in March 16, 2001 [1])
already has support for this attribute, so it doesn't make sense to
check the version.

Renamed 'noreturn' to 'noreturn_' for consistency.

[1] https://gcc.gnu.org/onlinedocs/

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-03 19:52:50 +01:00
Antonio Niño Díaz 340362d984 Enable a few warning flags
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-02 22:53:48 +01:00
Antonio Niño Díaz 85ece88268 Add default clauses to switch statements
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2018-04-02 22:53:43 +01:00