Hi Mark, On Wed, Apr 2, 2025 at 8:50 AM Mark Wielaard <m...@klomp.org> wrote: > > DW_LANG_Nim and DW_LNAME_Nim were added to the DWARF languages. > > While adding them, and the default lower bounds, I noticed DW_LANG_V > and DW_LANG_Algol68 where missing in srclang_to_language an internal > helper function. > > Testing through the public api is not that easy since you need a > Dwarf_Die with the right attributes. So this patch adds a way to > compile an individual source file with an optional main function that > can directly access the internal/static functions. > > Note that it is almost generic. But even though using .SECONDEXPANSION > I couldn't figure out how to create the equivalent of a rule starting > with %_check$(EXEEXT) target. So for now the rule has to repeated for > every new _check TEST. And there needs to be a line to tell make dist > to not expect the fake source: nodist_src_check_SOURCES = src_check.c > > The new test pointed out that there were a few more bugs with > DW_LANG_Dylan and DW_LNAME_Mojo. Also fix those. > > * libdw/dwarf.h: Add DW_LANG_Nim and DW_LNAME_Nim. > * libdw/Makefile.am: Add check_PROGRAMS and TESTS for > dwarf_srclang_check. > * libdw/dwarf_default_lower_bound.c > (dwarf_default_lower_bound): Add DW_LANG_Nim. > (dwarf_language_lower_bound): Add DW_LNAME_Nim. > * libdw/dwarf_srclang.c (srclang_to_language): Handle > DW_LANG_Dylan, DW_LANG_V, DW_LANG_Algol68 and DW_LANG_Nim. > (language_to_srclang): Fix DW_LNAME_Mojo. Add DW_LNAME_Nim. > (test_lang): New function guarded by MAIN_CHECK. > (main): Likewise. > > Signed-off-by: Mark Wielaard <m...@klomp.org>
LGTM. The optional main function approach opens up a lot of possibilities for testing static functions throughout all elfutils libraries. Aaron