From: Mark Wielaard Date: Sat, 4 Jul 2020 22:13:35 +0000 (+0200) Subject: libasm: Make libasm.h include work without relying on any other include. X-Git-Tag: elfutils-0.181~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9915d3f1947e6bcf9102329500626bd8e74bdd3;p=thirdparty%2Felfutils.git libasm: Make libasm.h include work without relying on any other include. 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 --- diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 2c092abe1..8ed7fc201 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,7 @@ +2020-07-05 Mark Wielaard + + * libasm.h: Include gelf.h. + 2020-04-25 Mark Wielaard * asm_end.c (text_end): Call fflush instead of fclose. diff --git a/libasm/libasm.h b/libasm/libasm.h index a45c9fa35..b67b77dc9 100644 --- a/libasm/libasm.h +++ b/libasm/libasm.h @@ -31,6 +31,7 @@ #include #include +#include typedef struct ebl Ebl; diff --git a/tests/ChangeLog b/tests/ChangeLog index 7cb4123ae..b5d332a0b 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2020-07-05 Mark Wielaard + + * run-test-includes.sh: New test. + * Makefile.am (TESTS): Add run-test-includes.sh. + (EXTRA_DIST): Likewise. + 2020-07-03 Alice Zhang * run-debuginfod-find.sh: Add scheme free url testcase. diff --git a/tests/Makefile.am b/tests/Makefile.am index 5ac805c52..d30b8218e 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 000000000..b0ccdd9b7 --- /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 -