]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libasm: Make libasm.h include work without relying on any other include.
authorMark Wielaard <mark@klomp.org>
Sat, 4 Jul 2020 22:13:35 +0000 (00:13 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 17 Jul 2020 23:50:01 +0000 (01:50 +0200)
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>
libasm/ChangeLog
libasm/libasm.h
tests/ChangeLog
tests/Makefile.am
tests/run-test-includes.sh [new file with mode: 0755]

index 2c092abe11ac26b909f353cbc22a77679ea2eafa..8ed7fc201aa429f37ea24760d3b3ce55569f6074 100644 (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.
index a45c9fa35ee450a15df2b86d0c834f92f261a36d..b67b77dc947b6b6b62c2da94eb44281e1d054e02 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <gelf.h>
 
 typedef struct ebl Ebl;
 
index 7cb4123ae3dd977e4d76640cda5ba0e077f4fd48..b5d332a0b57b340b88e99ae193553d5ee0e63703 100644 (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.
index 5ac805c524035fa687c199e3a9d12be51475a1e1..d30b8218ebc2f73ec6a407c701fcdbae8f95ac07 100644 (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
diff --git a/tests/run-test-includes.sh b/tests/run-test-includes.sh
new file mode 100755 (executable)
index 0000000..b0ccdd9
--- /dev/null
@@ -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 -