Modify function parameter parser such that symbols are
put into token-table temporarily. Benefits are:
- detects redefinitions, as with
int foo(int a, int a);
- detects reserved symbols, as with
int foo(int if);
- can parse expressions like
int main(int argc, char *argv[argc + 1]);
- doesn't fix this one
int main(int argc, char *argv[++argc]);
Also: fix unexpected "function might return no value"
with statement expression
int f() { ({ return 0; }); }
By replacing the `-f 2` field selection with `-f 2-`, we select fields
2 and beyond, so that arguments containing the '=' character are not
truncated.
This option qualifier list format is POSIX standard and tested
to work with the `cut` program from:
* GNU coreutils
* macOS (FreeBSD)
* NetBSD
* toybox
* busybox
* uutils-coreutils
In my case, this is useful because I'm trying to use an installation
prefix which contains an equals sign.
Currently used only with 'tcc_compile_sem' to protect
tcc_compile(), but can be used with other semaphores
Also fix deadlock when tcc_enter_state() is called
recursively for the same state, for example with
tcc_warning() from #pragma comment(option,"...")
Also:
- libtcc.c: error1(): use cstr_[v]printf()
- tcc.h: set TCC_USING_DOUBLE_FOR_LDOUBLE for macho-arm64
(rather than for macho-X86_64)
- tcc.h: define TCC_TARGET_MACHO on __APPLE__ by default
- tcc.h: cleanup TCCState, move DEFASM token stuff to tcctok.h
- tccgen.c: more static
- Makefile/tcc.c: review githash
- tccpe/tcctools: use read() instead of fgets() in pe_load_def()
(all files opened by tcc for reading are now read via 'int fd')
- configure/win32: don't preset CONFIG_TCCDIR (to allow to override it)
- tcc.c -bench: do not include output/run-time
136 insertions(+), 226 deletions(-), less 90 lines (except tests)
only one set_flag() function required
* can now turn off specific errors: -Werror -Wno-error=option
* new interface: tcc_warning_c(warn_option)("format", args...);
* new warning: -Wdiscarded-qualifiers (on by default)
* new variable 'warn_all' for conditional warnings with -Wall
see also the tests
configure:
- re-enable apple M1-arm64
- however, with --cpu=x86_64, set -arch in CFLAGS/LDFLAGS too
(assume rosetta)
Makefile:
- re-enable osx cross-test (Please do not disable tests)
tcc.h
- set TCC_IS_NATIVE for TCC_TARGET_MACHO on __APPLE__
- apply TCC_USING_DOUBLE_FOR_LDOUBLE for x86_64-osx
libtcc.c:
- cleanup tcc_add_file_internal()
- new function char *tcc_load_text(int fd); and use it for tbd files