From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 7ACA4386F816 for ; Sat, 4 Jul 2020 22:17:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7ACA4386F816 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id C1ABA30002CA; Sun, 5 Jul 2020 00:17:53 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 6D7424000C6A; Sun, 5 Jul 2020 00:17:53 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH] libasm: Make libasm.h include work without relying on any other include. Date: Sun, 5 Jul 2020 00:17:42 +0200 Message-Id: <20200704221742.18953-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2020 22:17:58 -0000 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 --- 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 + + * 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 a45c9fa3..b67b77dc 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 b27037ee..620a1615 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-06-19 Mark Wielaard * 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