asm6f
asm6f copied to clipboard
INCBIN/BIN bugfix, code cleanup
Just wanted to note this here: you may find some, most, or even all of my commits here useful: https://github.com/koitsu/asm6f/commits/master
An executive summary would be the following:
- Bugfix:
INCBIN/BINfix for unquoted filenames using size/offset args - Other: Document that
INCBIN/BINandINCLUDE/INCSRCsupport quoted filenames - Other: Document how to build asm6f and its pre-requisites (ex. GNU make)
- Other: Revamped Makefile for proper dependencies, effectively add clang support, hopefully better Windows support (untested), enforcing more extreme warnings when build=debug (justifies most of the cleanup commits), and treating warnings as errors
- Code safety: use
snprintf()instead ofsprintf() - Code safety: cease use of
vfprintf()and friends (valgrind et al does not like it) - Cleanup: removing trailing tabs/spaces, as well as blank lines with such
- Cleanup: add many missing function prototypes
- Cleanup: use
var->membernot(*var).member, constify things, makemy_malloc()comply with real-worldmalloc() - Cleanup: don't cast findlabel()'s return value to ptrdiff_t
- Enhancement: make
INCBIN/BINshow an error if the calculatedfread()size doesn't match what was read off disk (this usually means disk I/O error when reading). This needs further testing, but pretty sure I tested it well...
At bare minimum, the INCBIN/BIN fix from 40706e3 should be brought in. I would strongly suggest parts of the Makefile as well, particularly proper use of make variables for dependencies.
The warning-related stuff took me several hours to actually clean up/work out. When I started, I actually had to use -ferror-limit=0 due to the code having almost 200 warnings once more extreme warning flags were added.
Anyway, I'd love for these to be brought in, simply because we have enough forks already... :-)
All of this needs very thorough testing, i.e. on a big/hefty project. There are some things I changed (example) that make me a little bit wary.