* Remove DUK_USE_DPRINT_COLORS and the whole colored log feature.
* Add DUK_USE_DEBUG_WRITE() duk_config.h macro to actually write log
entries. Postpone formatting of the message there (except for the
body of the message) so that it can implement coloring etc as needed.
* Also move debug formatting buffer into a stack local rather than a
global to avoid thread issues.
Also remove mostly unused old debug code.
Debug code doesn't have access to 'heap' so it cannot decode pointers.
Cause an #error for now if both debug prints and pointer compression
are enabled at the same time.
Remove duk_debug_hobject.c from make and dist. It was out of date and
not used in practice anymore.
- Avoid warning for unreferenced variables
- Fix incorrect (non-existent) macro name (DUK_NEVER_HERE)
- Fix built-in missing prototype
- Fix C++ static variable issue
- Avoid pc2line lookup when not enabled
- Change combine_src.py order to match C++ static var requirements
- Use volatile in cause segfault to avoid clang warning
These were revealed after fixing DUK_SINGLE_FILE, gcc will complain about
these internal functions being declared, defined, but not used. There were
also a few declared functions that did not exist. Compiled binary size was
reduced by a few kilobytes!
Unused functions must be commented out carefully: some functions might be
used with certain feature options but not by the defaults. These removals
were verified with grep.
There are no call sites for DUK_DEBUG_DUMP_HEAP() so all the functions
in duk_debug_heap.c are unused, even with a debug build.
Out of the checked allocation macros, only DUK_REALLOC_INDIRECT_CHECKED() is
actually in use at the moment. This commit just comments the unused stuff
out, but it might be better to just remove the unused stuff entirely.
Lots of minor string format cleanups (casts mainly).
Add a special check to detect NULL pointers with %s/%p formats in debug
logging to avoid calling the platform sprintf() with a NULL value. This
is especially important for %s + NULL, which is not portable and may crash
on some platforms. Debug logging will now format these specially as "NULL"
and avoid calling the platform for formatting, so debug log call sites don't
need to be careful with NULL pointers any more.