From a48742fe1a615175d025e26eaeeb20f78135ca74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Thu, 4 Jan 2018 18:35:04 +0100 Subject: [PATCH] Low: qblist.h: fix incompatibility with C++ & check it regularly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Primary trigger was the fact that "./check abi" (via build-aux/generate-docs) choked on that because abi-dumper, likely since 0.99.16 (fead8fa) can/will use g++ to list symbols in header files, which apparently applies C++ perspective there, which likely was unprecedented even though libqb no doubt targets such compatiblity. To avoid its breakage within the public headers' scope in the future, arrange for checking it regularly alongside the "auto_check_header" tests (cf. make -C tests check-headers). Signed-off-by: Jan Pokorný --- include/qb/qblist.h | 16 ++++++++-------- tests/Makefile.am | 8 +++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/qb/qblist.h b/include/qb/qblist.h index f8ab0d2df..e3ae3f180 100644 --- a/include/qb/qblist.h +++ b/include/qb/qblist.h @@ -109,16 +109,16 @@ static inline void qb_list_del(struct qb_list_head *_remove) /** * Replace old entry by new one - * @param old: the element to be replaced - * @param new: the new element to insert + * @param old_one: the element to be replaced + * @param new_one: the new element to insert */ -static inline void qb_list_replace(struct qb_list_head *old, - struct qb_list_head *new) +static inline void qb_list_replace(struct qb_list_head *old_one, + struct qb_list_head *new_one) { - new->next = old->next; - new->next->prev = new; - new->prev = old->prev; - new->prev->next = new; + new_one->next = old_one->next; + new_one->next->prev = new_one; + new_one->prev = old_one->prev; + new_one->prev->next = new_one; } /** diff --git a/tests/Makefile.am b/tests/Makefile.am index 71066f581..def4b41d0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -78,7 +78,13 @@ check: check-headers # rely on implicit automake rule to include right (local) includes .PHONY: check-headers -check-headers: $(auto_c_files:.c=.o) +check-headers: $(auto_c_files:.c=.o) $(auto_c_files:.c=.opp) + +# this is to attest basic sanity for using libqb from C++ code when possible +%.opp: %.c + @which $(CXX) >/dev/null || { echo '$<: cannot test C++ compat'; exit 0; } + $(AM_V_GEN)$(CXX) $(AM_CPPFLAGS) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< +CLEANFILES += ${auto_c_files:.c=.opp} distclean-compile: rm -rf auto_*.c