The public headers should be usable when includes as is. libasm.h wasn't because it was using gelf.h data structures without include gelf.h. Include it now in libasm.h.
Add a new testcase run-test-includes.sh to test all public headers can be included "standalone". https://sourceware.org/bugzilla/show_bug.cgi?id=26176 Signed-off-by: Mark Wielaard <m...@klomp.org> --- libasm/ChangeLog | 4 ++++ libasm/libasm.h | 1 + tests/ChangeLog | 6 ++++++ tests/Makefile.am | 5 +++-- tests/run-test-includes.sh | 26 ++++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100755 tests/run-test-includes.sh diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 2c092abe..8ed7fc20 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,7 @@ +2020-07-05 Mark Wielaard <m...@klomp.org> + + * libasm.h: Include gelf.h. + 2020-04-25 Mark Wielaard <m...@klomp.org> * asm_end.c (text_end): Call fflush instead of fclose. diff --git a/libasm/libasm.h b/libasm/libasm.h index a45c9fa3..b67b77dc 100644 --- a/libasm/libasm.h +++ b/libasm/libasm.h @@ -31,6 +31,7 @@ #include <stdbool.h> #include <stdint.h> +#include <gelf.h> typedef struct ebl Ebl; diff --git a/tests/ChangeLog b/tests/ChangeLog index b27037ee..620a1615 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2020-07-05 Mark Wielaard <m...@klomp.org> + + * run-test-includes.sh: New test. + * Makefile.am (TESTS): Add run-test-includes.sh. + (EXTRA_DIST): Likewise. + 2020-06-19 Mark Wielaard <m...@klomp.org> * Makefile.am (TESTS): Don't add run-debuginfod-find.sh when diff --git a/tests/Makefile.am b/tests/Makefile.am index 5ac805c5..d30b8218 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -184,7 +184,7 @@ TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \ run-elfclassify.sh run-elfclassify-self.sh \ run-disasm-riscv64.sh \ run-pt_gnu_prop-tests.sh \ - run-getphdrnum.sh + run-getphdrnum.sh run-test-includes.sh if !BIARCH export ELFUTILS_DISABLE_BIARCH = 1 @@ -505,7 +505,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ debuginfod-tars/pacman-sources/hello.c \ run-pt_gnu_prop-tests.sh \ testfile_pt_gnu_prop.bz2 testfile_pt_gnu_prop32.bz2 \ - run-getphdrnum.sh testfile-phdrs.elf.bz2 + run-getphdrnum.sh testfile-phdrs.elf.bz2 \ + run-test-includes.sh if USE_VALGRIND diff --git a/tests/run-test-includes.sh b/tests/run-test-includes.sh new file mode 100755 index 00000000..b0ccdd9b --- /dev/null +++ b/tests/run-test-includes.sh @@ -0,0 +1,26 @@ +# All public include headers should be usable "standalone". + +. $srcdir/test-subr.sh + +echo '#include "libelf.h"' \ + | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf -xc - +echo '#include "gelf.h"' \ + | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf -xc - + +echo '#include "dwarf.h"' \ + | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \ + -I ${abs_srcdir}/../libdw -xc - +echo '#include "libdw.h"' \ + | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \ + -I ${abs_srcdir}/../libdw -xc - + +echo '#include "libdwfl.h"' \ + | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \ + -I ${abs_srcdir}/../libdw -I ${abs_srcdir}/../libdwfl -xc - +echo '#include "libdwelf.h"' \ + | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \ + -I ${abs_srcdir}/../libdw -I ${abs_srcdir}/../libdwelf -xc - + +echo '#include "libasm.h"' \ + | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \ + -I ${abs_srcdir}/../libasm -xc - -- 2.18.4