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 <mark@klomp.org>
This commit is contained in:
Mark Wielaard
2020-07-05 00:13:35 +02:00
parent 8de6f9af46
commit f9915d3f19
5 changed files with 40 additions and 2 deletions
+4
View File
@@ -1,3 +1,7 @@
2020-07-05 Mark Wielaard <mark@klomp.org>
* libasm.h: Include gelf.h.
2020-04-25 Mark Wielaard <mark@klomp.org>
* asm_end.c (text_end): Call fflush instead of fclose.
+1
View File
@@ -31,6 +31,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <gelf.h>
typedef struct ebl Ebl;
+6
View File
@@ -1,3 +1,9 @@
2020-07-05 Mark Wielaard <mark@klomp.org>
* run-test-includes.sh: New test.
* Makefile.am (TESTS): Add run-test-includes.sh.
(EXTRA_DIST): Likewise.
2020-07-03 Alice Zhang <alizhang@redhat.com>
* run-debuginfod-find.sh: Add scheme free url testcase.
+3 -2
View File
@@ -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
+26
View File
@@ -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 -