Skip to content

Commit

Permalink
Low: qblist.h: fix incompatibility with C++ & check it regularly
Browse files Browse the repository at this point in the history
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ý <[email protected]>
  • Loading branch information
jnpkrn committed Jan 4, 2018
1 parent 644bb93 commit a48742f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 8 additions & 8 deletions include/qb/qblist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
8 changes: 7 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a48742f

Please sign in to comment.