automake: migrated "--enable-dev-mode"

* Fix small compile warnings (which are now errors):
  - hdlcgen.c
  - hdlcstress.c (remove return value which isn't checked)
  - patlooptest.c

* Also added dev-mode to xpp with relevant compile fixes.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Oron Peled 2014-12-21 09:21:57 -05:00 committed by Tzafrir Cohen
parent bf9500ab32
commit d63812bd73
9 changed files with 37 additions and 14 deletions

View File

@ -5,7 +5,17 @@ LEGACY_MAKE = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir)
CFLAGS = -g -Wall $(DAHDI_INCLUDE)
CFLAGS = -g -Wall -O2 $(DAHDI_INCLUDE)
if DAHDI_DEVMODE
CFLAGS += \
-Werror \
-Wunused \
-Wundef \
$(DAHDI_DECLARATION_AFTER_STATEMENT) \
-Wmissing-format-attribute \
-Wformat-security \
#-Wformat=2
endif
SUBDIRS = xpp doc

View File

@ -14,8 +14,6 @@ ifeq ($(strip $(foreach var,clean,$(findstring $(var),$(MAKECMDGOALS)))),)
endif
endif
OPTFLAGS=-O2
CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
ifneq (,$(findstring ppc,$(UNAME_M)))
CFLAGS+=-fsigned-char
endif
@ -23,10 +21,6 @@ ifneq (,$(findstring x86_64,$(UNAME_M)))
CFLAGS+=-m64
endif
ifeq ($(DAHDI_DEVMODE),yes)
CFLAGS+=-Werror -Wunused -Wundef $(DAHDI_DECLARATION_AFTER_STATEMENT) -Wmissing-format-attribute -Wformat-security #-Wformat=2
endif
ROOT_PREFIX=
# extra cflags to build dependencies. Recursively expanded.

View File

@ -106,6 +106,7 @@ AC_ARG_ENABLE(dev-mode,
*) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode) ;;
esac])
AC_SUBST(DAHDI_DEVMODE)
AM_CONDITIONAL([DAHDI_DEVMODE], [test "$DAHDI_DEVMODE" = 'yes'])
AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then

View File

@ -40,7 +40,7 @@
#define RANDOM "/dev/urandom" /* Not genuinely random */
/* #define RANDOM "/dev/random" */ /* Quite genuinely random */
int myread(int fd, char *buf, int len)
int myread(int fd, unsigned char *buf, int len)
{
int sofar;
int res;

View File

@ -107,13 +107,12 @@ static struct fasthdlc_state fs;
void send_packet(unsigned char *buf, int len)
{
int res;
int x;
unsigned char outbuf[BLOCK_SIZE];
int pos=0;
unsigned int fcs = PPP_INITFCS;
if (hdlcmode)
res = write(fd, buf, len + 2);
write(fd, buf, len + 2);
else {
for (x=0;x<len;x++) {
if (fasthdlc_tx_load(&fs, buf[x]))

View File

@ -168,6 +168,7 @@ int main(int argc, char *argv[])
int opt;
int oldstyle_cmdline = 1;
unsigned int event_count = 0;
time_t start_time = 0;
/* Parse the command line arguments */
while((opt = getopt(argc, argv, "b:s:t:r:v?h")) != -1) {
@ -218,8 +219,6 @@ int main(int argc, char *argv[])
if (oldstyle_cmdline && argc > optind +1) {
timeout = strtoul(argv[optind+1], NULL, 10);
}
time_t start_time = 0;
fd = channel_open(device, &bs);
if (fd < 0)

View File

@ -3,10 +3,21 @@ all-local: $(perl_checks)
SUBDIRS =
# FIXME: try to improve code, so we can use $(PEDANTIC)
#PEDANTIC = -ansi -pedantic -std=c99
GLOBAL_CFLAGS = -I$(srcdir) -I$(srcdir)/xtalk $(PEDANTIC)
if DAHDI_DEVMODE
GLOBAL_CFLAGS += \
-Werror \
-Wunused \
-Wundef \
-Wmissing-format-attribute \
-Wformat-security \
-Wformat=2
endif
if PERL
SUBDIRS += perl_modules

View File

@ -84,7 +84,12 @@ int handle_hexline(struct astribank_device *astribank, struct hexline *hexline)
return 0;
}
void print_parse_errors(int level, const char *msg, ...)
#ifdef __GNUC__
static void print_parse_errors(int level, const char *msg, ...) __attribute__((format(printf,2,3)));
#endif
static void print_parse_errors(int level, const char *msg, ...)
{
va_list ap;

View File

@ -72,7 +72,11 @@ struct hexdata {
__BEGIN_DECLS
typedef void (*parse_hexfile_report_func_t)(int level, const char *msg, ...);
typedef void (*parse_hexfile_report_func_t)(int level, const char *msg, ...)
#ifdef __GNUC__
__attribute__((format(printf,2,3)));
#endif
;
parse_hexfile_report_func_t parse_hexfile_set_reporting(parse_hexfile_report_func_t rf);
void free_hexdata(struct hexdata *hexdata);