From f35cf2c799b79627e871ce67851e1695380bd8eb Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Mon, 27 Feb 2012 10:51:23 +0000 Subject: [PATCH] all: Added -Wall to the build And fixed the warnings that poped out Signed-off-by: Michel Pollet --- Makefile.common | 6 +++--- examples/board_hd77480/charlcd.c | 3 ++- examples/board_ledramp/ledramp.c | 5 +++-- examples/board_simduino/simduino.c | 15 ++++++++------- examples/board_timer_64led/timer_64led.c | 5 +++-- examples/parts/ac_input.c | 2 +- examples/parts/hd44780.c | 2 +- examples/parts/uart_udp.c | 3 ++- 8 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Makefile.common b/Makefile.common index 6e1c7c3..9f48342 100644 --- a/Makefile.common +++ b/Makefile.common @@ -33,9 +33,9 @@ ifeq ($(ARCH), i) CFLAGS += -mfpmath=sse -msse2 endif -CFLAGS += -g --std=gnu99 -CFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}} -LDFLAGS += -lelf +CFLAGS += -g --std=gnu99 -Wall +CFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}} +LDFLAGS += -lelf ifeq (${shell uname}, Darwin) AVR_ROOT := "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/" diff --git a/examples/board_hd77480/charlcd.c b/examples/board_hd77480/charlcd.c index 0c1f382..911294f 100644 --- a/examples/board_hd77480/charlcd.c +++ b/examples/board_hd77480/charlcd.c @@ -62,6 +62,7 @@ avr_run_thread( while (1) { avr_run(avr); } + return NULL; } void keyCB( @@ -105,7 +106,7 @@ void displayCB(void) /* function called whenever redisplay needed */ // gl timer. if the lcd is dirty, refresh display void timerCB(int i) { - static int oldstate = -1; + //static int oldstate = -1; // restart timer glutTimerFunc(1000/64, timerCB, 0); glutPostRedisplay(); diff --git a/examples/board_ledramp/ledramp.c b/examples/board_ledramp/ledramp.c index cab3c66..6db441e 100644 --- a/examples/board_ledramp/ledramp.c +++ b/examples/board_ledramp/ledramp.c @@ -90,7 +90,7 @@ void keyCB(unsigned char key, int x, int y) /* called on key press */ { if (key == 'q') exit(0); - static uint8_t buf[64]; + //static uint8_t buf[64]; switch (key) { case 'q': case 0x1f: // escape @@ -135,6 +135,7 @@ static void * avr_run_thread(void * oaram) button_press(&button, 1000000); } } + return NULL; } @@ -142,7 +143,7 @@ int main(int argc, char *argv[]) { elf_firmware_t f; const char * fname = "atmega48_ledramp.axf"; - char path[256]; + //char path[256]; // sprintf(path, "%s/%s", dirname(argv[0]), fname); // printf("Firmware pathname is %s\n", path); diff --git a/examples/board_simduino/simduino.c b/examples/board_simduino/simduino.c index 87d063d..d4061c1 100644 --- a/examples/board_simduino/simduino.c +++ b/examples/board_simduino/simduino.c @@ -73,8 +73,8 @@ void displayCB(void) /* function called whenever redisplay needed */ glMatrixMode(GL_MODELVIEW); // Select modelview matrix glLoadIdentity(); // Start with an identity matrix - float grid = pixsize; - float size = grid * 0.8; + //float grid = pixsize; + //float size = grid * 0.8; glBegin(GL_QUADS); glColor3f(1,0,0); @@ -100,7 +100,7 @@ void keyCB(unsigned char key, int x, int y) /* called on key press */ { if (key == 'q') exit(0); - static uint8_t buf[64]; + //static uint8_t buf[64]; switch (key) { case 'q': case 0x1f: // escape @@ -123,7 +123,7 @@ void keyCB(unsigned char key, int x, int y) /* called on key press */ // gl timer. if the pin have changed states, refresh display void timerCB(int i) { - static uint8_t oldstate = 0xff; + //static uint8_t oldstate = 0xff; // restart timer glutTimerFunc(1000/64, timerCB, 0); #if 0 @@ -136,7 +136,7 @@ void timerCB(int i) static void * avr_run_thread(void * oaram) { - int b_press = do_button_press; +// int b_press = do_button_press; while (1) { avr_run(avr); @@ -148,6 +148,7 @@ static void * avr_run_thread(void * oaram) } #endif } + return NULL; } @@ -192,8 +193,8 @@ void avr_special_deinit( avr_t* avr) int main(int argc, char *argv[]) { - elf_firmware_t f; - const char * pwd = dirname(argv[0]); + //elf_firmware_t f; + //const char * pwd = dirname(argv[0]); avr = avr_make_mcu_by_name("atmega328p"); if (!avr) { diff --git a/examples/board_timer_64led/timer_64led.c b/examples/board_timer_64led/timer_64led.c index b5f83c1..5b7c8f5 100644 --- a/examples/board_timer_64led/timer_64led.c +++ b/examples/board_timer_64led/timer_64led.c @@ -154,7 +154,7 @@ void keyCB(unsigned char key, int x, int y) /* called on key press */ { if (key == 'q') exit(0); - static uint8_t buf[64]; + //static uint8_t buf[64]; switch (key) { case 'q': case 0x1f: // escape @@ -203,6 +203,7 @@ static void * avr_run_thread(void * ignore) } } } + return NULL; } @@ -210,7 +211,7 @@ int main(int argc, char *argv[]) { elf_firmware_t f; const char * fname = "atmega168_timer_64led.axf"; - char path[256]; + //char path[256]; // sprintf(path, "%s/%s", dirname(argv[0]), fname); //printf("Firmware pathname is %s\n", path); diff --git a/examples/parts/ac_input.c b/examples/parts/ac_input.c index d6db0ad..1808710 100644 --- a/examples/parts/ac_input.c +++ b/examples/parts/ac_input.c @@ -43,5 +43,5 @@ void ac_input_init(avr_t *avr, ac_input_t *b) b->value = 0; avr_cycle_timer_register_usec(avr, 100000 / 50, switch_auto, b); printf("ac_input_init period %duS or %d cycles\n", - 100000 / 50, avr_usec_to_cycles(avr, 100000 / 50)); + 100000 / 50, (int)avr_usec_to_cycles(avr, 100000 / 50)); } diff --git a/examples/parts/hd44780.c b/examples/parts/hd44780.c index 1c97235..144cbfc 100644 --- a/examples/parts/hd44780.c +++ b/examples/parts/hd44780.c @@ -198,7 +198,7 @@ hd44780_process_write( if (comp) b->datapins = (b->datapins & 0xf0) | ((b->pinstate >> IRQ_HD44780_D4) & 0xf); else - b->datapins = (b->datapins & 0xf) | ((b->pinstate >> IRQ_HD44780_D4-4) & 0xf0); + b->datapins = (b->datapins & 0xf) | ((b->pinstate >> (IRQ_HD44780_D4-4)) & 0xf0); write = comp; b->flags ^= (1 << HD44780_FLAG_LOWNIBBLE); } else { // 8 bits diff --git a/examples/parts/uart_udp.c b/examples/parts/uart_udp.c index 78ee698..bba68dd 100644 --- a/examples/parts/uart_udp.c +++ b/examples/parts/uart_udp.c @@ -118,10 +118,11 @@ static void * uart_udp_thread(void * param) while (!uart_udp_fifo_isempty(&p->in) && dst < (buffer+sizeof(buffer))) *dst++ = uart_udp_fifo_read(&p->in); socklen_t len = dst - buffer; - size_t r = sendto(p->s, buffer, len, 0, (struct sockaddr*)&p->peer, sizeof(p->peer)); + /*size_t r = */sendto(p->s, buffer, len, 0, (struct sockaddr*)&p->peer, sizeof(p->peer)); // hdump("udp send", buffer, r); } } + return NULL; } static const char * irq_names[IRQ_UART_UDP_COUNT] = { -- 2.39.5