Introduce more static checking via cppcheck.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
@ifGNUmake@ CHECK=sparse
@ifGNUmake@ CHECK_OPTS=-Wsparse-all -Wno-transparent-union -Wno-return-void -Wno-undef -Wno-non-pointer-null
+@ifGNUmake@ CPPCHECK=cppcheck
+@ifGNUmake@ CPPCHECK_OPTS=--force --enable=all
@ifGNUmake@ ifeq ("$(C)", "2")
@ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS) -Wbitwise -D__CHECK_ENDIAN__
+@ifGNUmake@ CPPCHECK_CMD=$(CPPCHECK) $(CPPCHECK_OPTS)
@ifGNUmake@ else
@ifGNUmake@ ifeq ("$(C)", "1")
@ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS)
+@ifGNUmake@ CPPCHECK_CMD=$(CPPCHECK) $(CPPCHECK_OPTS)
@ifGNUmake@ else
@ifGNUmake@ CHECK_CMD=@true
+@ifGNUmake@ CPPCHECK_CMD=@true
@ifGNUmake@ endif
@ifGNUmake@ endif
@ifNotGNUmake@ CHECK_CMD=@true
+@ifNotGNUmake@ CPPHECK_CMD=@true
CC = @CC@
BUILD_CC = @BUILD_CC@
$(E) " CC $<"
$(Q) $(CC) -c $(ALL_CFLAGS) $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
all:: $(PROGS) $(MANPAGES)
$(E) " CC $<"
$(Q) $(CC) -c $(ALL_CFLAGS) $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
#
.c.o:
$(CC) -c $(ALL_CFLAGS) $< -o $@
$(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(CPPCHECK_CMD) $<
.SUFFIXES: .sgml .ps .pdf .html
@ifGNUmake@ CHECK=sparse
@ifGNUmake@ CHECK_OPTS=-Wsparse-all -Wno-transparent-union -Wno-return-void -Wno-undef -Wno-non-pointer-null
+@ifGNUmake@ CPPCHECK=cppcheck
+@ifGNUmake@ CPPCHECK_OPTS=--force --enable=all
@ifGNUmake@ ifeq ("$(C)", "2")
@ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS) -Wbitwise -D__CHECK_ENDIAN__
+@ifGNUmake@ CPPCHECK_CMD=$(CPPCHECK) $(CPPCHECK_OPTS)
@ifGNUmake@ else
@ifGNUmake@ ifeq ("$(C)", "1")
@ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS)
+@ifGNUmake@ CPPCHECK_CMD=$(CPPCHECK) $(CPPCHECK_OPTS)
@ifGNUmake@ else
@ifGNUmake@ CHECK_CMD=@true
+@ifGNUmake@ CPPCHECK_CMD=@true
@ifGNUmake@ endif
@ifGNUmake@ endif
@ifNotGNUmake@ CHECK_CMD=@true
+@ifNotGNUmake@ CPPCHECK_CMD=@true
l = @INTL_LIBTOOL_SUFFIX_PREFIX@
$(E) " CC $<"
$(Q) $(COMPILE) $<
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
.y.c:
$(YACC) $(YFLAGS) --output $@ $<
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
@CHECKER_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
@CHECKER_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
@CHECKER_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
@CHECKER_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
@CHECKER_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
#ELF_CMT# $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $<
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
@CHECKER_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -DSHARED_ELF_LIB -fPIC -o elfshared/$*.o -c $<
$(E) " CC $<"
$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
@CHECKER_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
$(E) " CC $<"
$(Q) $(CC) -c $(ALL_CFLAGS) $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
all:: profiled $(SPROGS) $(UPROGS) $(USPROGS) $(SMANPAGES) $(UMANPAGES) \
$(E) " CC $<"
$(Q) $(CC) -c $(ALL_CFLAGS) $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
all:: $(PROGS) $(TEST_PROGS) $(MANPAGES)
$(E) " CC $<"
$(Q) $(CC) -c $(ALL_CFLAGS) $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
all:: $(PROGS)
$(E) " CC $<"
$(Q) $(BUILD_CC) -c $(BUILD_CFLAGS) $< -o $@
$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
+ $(Q) $(CPPCHECK_CMD) $<
PROGS= subst symlinks