On 06/02/2016 11:06 PM, David Malcolm wrote:
gcc/ChangeLog: * Makefile.in (OBJS): Add function-tests.o, hash-map-tests.o, hash-set-tests.o, rtl-tests.o, selftest-run-tests.o. (OBJS-libcommon): Add selftest.o. (OBJS-libcommon-target): Add selftest.o. (all.internal): Add "selftests". (all.cross): Likewise. (selftests): New phony target. (s-selftests): New target. (selftests-gdb): New phony target. (COLLECT2_OBJS): Add selftest.o. * common.opt (fself-test): New. * selftest-run-tests.c: New file. * selftest.c: New file. * selftest.h: New file. * toplev.c: Include selftest.h. (toplev::run_self_tests): New. (toplev::main): Handle -fself-test. * toplev.h (toplev::run_self_tests): New.
This one looks good to me. I kind of liked the auto-registration, but I guess manually calling functions is preferrable to including C files and similar in effort required. So it's probably better this way.
+ fprintf (stderr, + "%s:%i: FAIL: %s\n", + file, line, msg); + /* TODO: add calling function name as well? */ + abort (); +}
That'll fit on one line. Otherwise OK. Likewise for anything Jeff has already approved in a different form - but please make another pass and add brief function comments for new functions, and please ensure every step you commit actually compiles (this patch alone won't). Let me know which patches still need approval after that.
Bernd