On Thu, 2016-12-01 at 14:29 +0100, Bernd Schmidt wrote: > On 11/11/2016 10:15 PM, David Malcolm wrote: > > + /* Makefile.in has -fself-test=$(srcdir)/testsuite/selftests, so > > that > > + flag_self_test contains the path to the selftest subdirectory > > of the > > + source tree (without a trailing slash). Copy it up to > > + path_to_selftest_files, to avoid selftest.c depending on > > + option-handling. */ > > + path_to_selftest_files = flag_self_test; > > + > > What kind of dependency are you avoiding? If it's just one include > I'd > prefer to get rid of the extraneous variable.
I was thinking more about keeping selftest.h/c modularized; I didn't want them knowing anything about gcc option-handling, in case we want to move the core of the selftests into some other support directory (libiberty or similar). Perhaps a better approach is to add the path as a param to locate_file, to use it from callers. That would support multiple subprojects using selftest::locate_file (avoiding a global variable), at the slight cost of requiring the use of flag_self_test (actually a macro) everywhere in gcc that we use locate_file. Should I update the patches to reflect that? > Otherwise ok. > > > Bernd >