Browse Source

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>
master
Oron Peled 7 years ago
committed by Tzafrir Cohen
parent
commit
d63812bd73
  1. 12
      Makefile.am
  2. 6
      Makefile.legacy
  3. 1
      configure.ac
  4. 2
      hdlcgen.c
  5. 3
      hdlcstress.c
  6. 3
      patlooptest.c
  7. 11
      xpp/Makefile.am
  8. 7
      xpp/astribank_hexload.c
  9. 6
      xpp/hexfile.h

12
Makefile.am

@ -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

6
Makefile.legacy

@ -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.

1
configure.ac

@ -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

2
hdlcgen.c

@ -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;

3
hdlcstress.c

@ -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]))

3
patlooptest.c

@ -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)

11
xpp/Makefile.am

@ -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

7
xpp/astribank_hexload.c

@ -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;

6
xpp/hexfile.h

@ -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);

Loading…
Cancel
Save