Skip to content

Commit

Permalink
Merge pull request #201 from jnpkrn/splint-better-support
Browse files Browse the repository at this point in the history
build: better support for splint checker
  • Loading branch information
chrissie-c committed Mar 17, 2016
2 parents 3d5dda3 + c12f729 commit b2d159f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
7 changes: 4 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,10 @@ if test x"$memory_barrier_needed" != xno; then
[need atomic memory barrier])
fi

LINT_FLAGS="-syntax -weak -unrecog +posixlib +ignoresigns -fcnuse \
-badflag -D__gnuc_va_list=va_list -D__attribute\(x\)= \
-warnposix +matchanyintegral -sysunrecog"
LINT_FLAGS="-weak -D__gnuc_va_list=va_list -D__attribute\(x\)= \
-badflag -fcnuse -syntax -unrecog -sysunrecog -warnposix \
+ignoresigns +matchanyintegral +posixlib \
+showscan +showsummary"

# local options
AC_ARG_ENABLE([ansi],
Expand Down
5 changes: 5 additions & 0 deletions include/qb/qblog.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,13 @@ typedef union {
int32_t qb_log_ctl2(int32_t target, enum qb_log_conf conf_type,
qb_log_ctl2_arg_t arg);

# ifndef S_SPLINT_S
#define QB_LOG_CTL2_I32(a) ((qb_log_ctl2_arg_t) { .i32 = (a) })
#define QB_LOG_CTL2_S(a) ((qb_log_ctl2_arg_t) { .s = (a) })
#else
#define QB_LOG_CTL2_I32(a) ((qb_log_ctl2_arg_t)(a))
#define QB_LOG_CTL2_S(a) ((qb_log_ctl2_arg_t)(a))
#endif

/**
* This allows you modify the 'tags' and 'targets' callsite fields at runtime.
Expand Down
17 changes: 15 additions & 2 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,23 @@ DEB_INCLUDES = -I/usr/include/x86_64-linux-gnu -I/usr/include/i386-linux-gnu
ALL_LINT_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DEB_INCLUDES) \
$(libqb_la_CPPFLAGS) $(CPPFLAGS) $(AM_CPPFLAGS) \
$(LINT_FLAGS)
# expected for the time being (but SHOULD be fixed eventually):
# ipc_setup.c: (in function qb_ipcc_us_setup_connect)
# ipc_setup.c:479:2: Return value (type int32_t) ignored: qb_ipc_us_ready(...
# ipc_setup.c:494:2: Return value (type int32_t) ignored: qb_ipc_auth_cred...
SPLINT_SUMMARY_EXP = " 2 code warnings"

run_splint.sh: $(top_srcdir)/configure.ac
@echo "$(SPLINT) $(ALL_LINT_FLAGS) $(addprefix $(top_srcdir)/lib/, $(source_to_lint))" > $@
$(AM_V_GEN)chmod +x $@
@echo '$(SPLINT) $(ALL_LINT_FLAGS) \' > $@-t
@echo ' $(addprefix $(top_srcdir)/lib/, $(source_to_lint)) \' >> $@-t
@echo ' 2>&1 | tee $@-o' >> $@-t
@echo 'tail -n1 $@-o | grep -qF $(SPLINT_SUMMARY_EXP)' >> $@-t
@echo 'ret=$$?' >> $@-t
@echo 'rm -f $@-o' >> $@-t
@echo 'test $$ret = 0 || echo "EXPECTED:$(SPLINT_SUMMARY_EXP)"' >> $@-t
@echo 'exit $$ret' >> $@-t
@chmod +x $@-t
$(AM_V_GEN)mv $@-t $@

dist-clean-local:
rm -f run_splint.sh
Expand Down
3 changes: 2 additions & 1 deletion lib/loop_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
*/
#include "os_base.h"

#ifdef HAVE_SYS_RESOURCE_H
/* due to MinGW/splint emitting "< Location unknown >: Previous use of" */
#if defined(HAVE_SYS_RESOURCE_H) && !defined(S_SPLINT_S)
#include <sys/resource.h>
#endif

Expand Down

0 comments on commit b2d159f

Please sign in to comment.