diff --git a/demos/ARM7-LPC214x-G++/Makefile b/demos/ARM7-LPC214x-G++/Makefile index 3b0a8bee3..3bb33abfe 100644 --- a/demos/ARM7-LPC214x-G++/Makefile +++ b/demos/ARM7-LPC214x-G++/Makefile @@ -126,10 +126,10 @@ AOPT = TOPT = -mthumb -DTHUMB # Define C warning options here -CWARN = -Wall -Wstrict-prototypes +CWARN = -Wall -Wextra -Wstrict-prototypes # Define C++ warning options here -CPPWARN = -Wall +CPPWARN = -Wall -Wextra # # Compiler settings diff --git a/demos/ARM7-LPC214x-G++/main.cpp b/demos/ARM7-LPC214x-G++/main.cpp index b46ccd86e..f0268045d 100644 --- a/demos/ARM7-LPC214x-G++/main.cpp +++ b/demos/ARM7-LPC214x-G++/main.cpp @@ -137,6 +137,7 @@ public: */ static void TimerHandler(eventid_t id) { + (void)id; if (!(palReadPort(IOPORT1) & BOTH_BUTTONS)) { // Both buttons TesterThread tester; tester.Wait(); @@ -154,6 +155,9 @@ int main(int argc, char **argv) { static EvTimer evt; struct EventListener el0; + (void)argc; + (void)argv; + /* * Activates the serial driver 2 using the driver default configuration. */ diff --git a/demos/ARM7-LPC214x-GCC-minimal/Makefile b/demos/ARM7-LPC214x-GCC-minimal/Makefile index 5315948af..21e9a0eea 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/Makefile +++ b/demos/ARM7-LPC214x-GCC-minimal/Makefile @@ -123,10 +123,10 @@ AOPT = TOPT = -mthumb -DTHUMB # Define C warning options here -CWARN = -Wall -Wstrict-prototypes +CWARN = -Wall -Wextra -Wstrict-prototypes # Define C++ warning options here -CPPWARN = -Wall +CPPWARN = -Wall -Wextra # # Compiler settings diff --git a/demos/ARM7-LPC214x-GCC-minimal/main.c b/demos/ARM7-LPC214x-GCC-minimal/main.c index d303237c4..7ce5ffe95 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/main.c +++ b/demos/ARM7-LPC214x-GCC-minimal/main.c @@ -28,6 +28,7 @@ static WORKING_AREA(waThread1, 128); static msg_t Thread1(void *arg) { + (void)arg; while (TRUE) { palClearPort(IOPORT1, PAL_PORT_BIT(PA_LED2)); chThdSleepMilliseconds(200); @@ -47,6 +48,7 @@ static msg_t Thread1(void *arg) { static WORKING_AREA(waThread2, 128); static msg_t Thread2(void *arg) { + (void)arg; while (TRUE) { palClearPad(IOPORT1, PA_LEDUSB); chThdSleepMilliseconds(200); @@ -62,6 +64,9 @@ static msg_t Thread2(void *arg) { */ int main(int argc, char **argv) { + (void)argc; + (void)argv; + /* * Creates the blinker threads. */ diff --git a/demos/ARM7-LPC214x-GCC/Makefile b/demos/ARM7-LPC214x-GCC/Makefile index 54b1e0ffd..792ff4fbd 100644 --- a/demos/ARM7-LPC214x-GCC/Makefile +++ b/demos/ARM7-LPC214x-GCC/Makefile @@ -127,10 +127,10 @@ AOPT = TOPT = -mthumb -DTHUMB # Define C warning options here -CWARN = -Wall -Wstrict-prototypes +CWARN = -Wall -Wextra -Wstrict-prototypes # Define C++ warning options here -CPPWARN = -Wall +CPPWARN = -Wall -Wextra # # Compiler settings diff --git a/demos/ARM7-LPC214x-GCC/buzzer.c b/demos/ARM7-LPC214x-GCC/buzzer.c index 25be0e2d9..1d3350bb2 100644 --- a/demos/ARM7-LPC214x-GCC/buzzer.c +++ b/demos/ARM7-LPC214x-GCC/buzzer.c @@ -58,9 +58,8 @@ void InitBuzzer(void) { } static void stop(void *p) { - TC *tc = T1Base; - StopCounter(tc); + StopCounter((TC *)p); chEvtBroadcastI(&BuzzerSilentEventSource); } @@ -77,7 +76,7 @@ void PlaySound(int freq, systime_t duration) { tc->TC_MR0 = tc->TC_MR1 = (PCLK / (freq * 2)); StartCounter(tc); - chVTSetI(&bvt, duration, stop, NULL); + chVTSetI(&bvt, duration, stop, tc); chSysUnlock(); } diff --git a/demos/ARM7-LPC214x-GCC/main.c b/demos/ARM7-LPC214x-GCC/main.c index a8db1b667..93b6fd768 100644 --- a/demos/ARM7-LPC214x-GCC/main.c +++ b/demos/ARM7-LPC214x-GCC/main.c @@ -35,6 +35,7 @@ static WORKING_AREA(waThread1, 128); static msg_t Thread1(void *arg) { + (void)arg; while (TRUE) { palClearPort(IOPORT1, PAL_PORT_BIT(PA_LED2)); chThdSleepMilliseconds(200); @@ -54,6 +55,7 @@ static msg_t Thread1(void *arg) { static WORKING_AREA(waThread2, 128); static msg_t Thread2(void *arg) { + (void)arg; while (TRUE) { palClearPad(IOPORT1, PA_LEDUSB); chThdSleepMilliseconds(200); @@ -70,6 +72,7 @@ static WORKING_AREA(waTestThread, 128); */ static void TimerHandler(eventid_t id) { + (void)id; if (!(palReadPort(IOPORT1) & BOTH_BUTTONS)) { Thread *tp = chThdCreateStatic(waTestThread, sizeof(waTestThread), NORMALPRIO, TestThread, &SD1); @@ -94,6 +97,7 @@ static void InsertHandler(eventid_t id) { static uint8_t rwbuf[512]; MMCCSD data; + (void)id; PlaySoundWait(1000, MS2ST(100)); PlaySoundWait(2000, MS2ST(100)); if (mmcInit()) @@ -111,6 +115,7 @@ static void InsertHandler(eventid_t id) { */ static void RemoveHandler(eventid_t id) { + (void)id; PlaySoundWait(2000, MS2ST(100)); PlaySoundWait(1000, MS2ST(100)); } @@ -128,6 +133,9 @@ int main(int argc, char **argv) { static EvTimer evt; struct EventListener el0, el1, el2; + (void)argc; + (void)argv; + /* * Activates the serial driver 2 using the driver default configuration. */ diff --git a/demos/ARM7-LPC214x-GCC/mmcsd.c b/demos/ARM7-LPC214x-GCC/mmcsd.c index aba532544..731f594a2 100644 --- a/demos/ARM7-LPC214x-GCC/mmcsd.c +++ b/demos/ARM7-LPC214x-GCC/mmcsd.c @@ -42,6 +42,7 @@ void InitMMC(void) { void tmrfunc(void *par) { + (void)par; if (cnt) { if (!palReadPad(IOPORT2, PB_CP1)) { if (!--cnt) diff --git a/demos/ARMCM3-STM32F103-GCC/Makefile b/demos/ARMCM3-STM32F103-GCC/Makefile index ca12fd05d..4919e567e 100644 --- a/demos/ARMCM3-STM32F103-GCC/Makefile +++ b/demos/ARMCM3-STM32F103-GCC/Makefile @@ -139,10 +139,10 @@ AOPT = TOPT = -mthumb -DTHUMB # Define C warning options here -CWARN = -Wall -Wstrict-prototypes +CWARN = -Wall -Wextra -Wstrict-prototypes # Define C++ warning options here -CPPWARN = -Wall +CPPWARN = -Wall -Wextra # # Compiler settings diff --git a/demos/ARMCM3-STM32F103-GCC/main.c b/demos/ARMCM3-STM32F103-GCC/main.c index ca2fa842b..fcc496648 100644 --- a/demos/ARMCM3-STM32F103-GCC/main.c +++ b/demos/ARMCM3-STM32F103-GCC/main.c @@ -30,6 +30,7 @@ static WORKING_AREA(waThread1, 128); static msg_t Thread1(void *arg) { + (void)arg; while (TRUE) { palClearPad(IOPORT3, GPIOC_LED); chThdSleepMilliseconds(500); @@ -45,6 +46,9 @@ static msg_t Thread1(void *arg) { */ int main(int argc, char **argv) { + (void)argc; + (void)argv; + /* * Activates the serial driver 2 using the driver default configuration. */ diff --git a/demos/MSP430-MSP430x1611-GCC/Makefile b/demos/MSP430-MSP430x1611-GCC/Makefile index dc3747875..7a7a720a8 100644 --- a/demos/MSP430-MSP430x1611-GCC/Makefile +++ b/demos/MSP430-MSP430x1611-GCC/Makefile @@ -91,10 +91,10 @@ HEX = $(CP) -O ihex BIN = $(CP) -O binary # Define C warning options here -CWARN = -Wall -Wstrict-prototypes +CWARN = -Wall -Wextra -Wstrict-prototypes # Define C++ warning options here -CPPWARN = -Wall +CPPWARN = -Wall -Wextra # # Compiler settings diff --git a/demos/MSP430-MSP430x1611-GCC/main.c b/demos/MSP430-MSP430x1611-GCC/main.c index 02622e817..3e729296b 100644 --- a/demos/MSP430-MSP430x1611-GCC/main.c +++ b/demos/MSP430-MSP430x1611-GCC/main.c @@ -30,6 +30,7 @@ static WORKING_AREA(waThread1, 64); static msg_t Thread1(void *arg) { + (void)arg; while (TRUE) { palSetPad(IOPORT6, P6_O_LED); chThdSleepMilliseconds(500); @@ -44,6 +45,9 @@ static msg_t Thread1(void *arg) { */ int main(int argc, char **argv) { + (void)argc; + (void)argv; + /* * Hardware initialization, see board.c. */ diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index f700ce159..3552537ad 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -99,7 +99,7 @@ LIBS = $(DLIBS) $(ULIBS) LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) +CPFLAGS = $(OPT) -Wall -Wextra -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) # Generate dependency information CPFLAGS += -MD -MP -MF .dep/$(@F).d diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 95d8b9de8..8dcb3b9ad 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -89,8 +89,9 @@ void ChkIntSources(void) { */ __attribute__((used)) static void __dummy(Thread *otp, Thread *ntp) { + (void)otp; (void)ntp; asm volatile (".globl @port_switch@8 \n\t" \ - "@port_switch@8: \n\t" \ + "@port_switch@8: \n\t" \ "push %ebp \n\t" \ "push %esi \n\t" \ "push %edi \n\t" \ diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index bca8af11b..6a2b5367f 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -42,10 +42,11 @@ msg_t TestThread(void *p); * areas. The system is halted if something is wrong. */ static msg_t WatchdogThread(void *arg) { + + (void)arg; wdguard = 0xA51F2E3D; cdguard = 0xA51F2E3D; while (TRUE) { - if ((wdguard != 0xA51F2E3D) || (cdguard != 0xA51F2E3D)) { printf("Halted by watchdog"); @@ -64,6 +65,7 @@ static msg_t WatchdogThread(void *arg) { */ static msg_t ConsoleThread(void *arg) { + (void)arg; while (!chThdShouldTerminate()) { printf((char *)chMsgWait()); fflush(stdout); @@ -230,6 +232,7 @@ EventListener s1tel; static void COM1Handler(eventid_t id) { sdflags_t flags; + (void)id; if (s1 && chThdTerminated(s1)) { s1 = NULL; cprint("Init: disconnection on SD1\n"); @@ -256,6 +259,7 @@ EventListener s2tel; static void COM2Handler(eventid_t id) { sdflags_t flags; + (void)id; if (s2 && chThdTerminated(s2)) { s2 = NULL; cprint("Init: disconnection on SD2\n"); diff --git a/os/io/platforms/Win32/serial_lld.c b/os/io/platforms/Win32/serial_lld.c index 2539ebae9..ab8384254 100644 --- a/os/io/platforms/Win32/serial_lld.c +++ b/os/io/platforms/Win32/serial_lld.c @@ -241,6 +241,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { */ void sd_lld_stop(SerialDriver *sdp) { + (void)sdp; } bool_t sd_lld_interrupt_pending(void) { diff --git a/os/kernel/include/queues.h b/os/kernel/include/queues.h index 9082ea5f7..25ba82d65 100644 --- a/os/kernel/include/queues.h +++ b/os/kernel/include/queues.h @@ -27,6 +27,8 @@ #ifndef _QUEUES_H_ #define _QUEUES_H_ +#if CH_USE_QUEUES + /* * Module dependancies check. */ @@ -48,7 +50,6 @@ typedef void (*qnotify_t)(void); /** Returned by the queue functions if the queue is full. */ #define Q_FULL -4 -#if CH_USE_QUEUES /** * @brief Generic I/O queue structure. * @details This structure represents a generic Input or Output asymmetrical diff --git a/os/ports/GCC/ARMCM3/chcore.c b/os/ports/GCC/ARMCM3/chcore.c index fbf201a56..8f99d3dec 100644 --- a/os/ports/GCC/ARMCM3/chcore.c +++ b/os/ports/GCC/ARMCM3/chcore.c @@ -92,22 +92,22 @@ void SVCallVector(Thread *otp, Thread *ntp) { asm volatile ("mrs r3, BASEPRI \n\t" \ "mrs r12, PSP \n\t" \ "stmdb r12!, {r3-r6,r8-r11, lr} \n\t" \ - "str r12, [r0, #16] \n\t" \ - "ldr r12, [r1, #16] \n\t" \ + "str r12, [%0, #16] \n\t" \ + "ldr r12, [%1, #16] \n\t" \ "ldmia r12!, {r3-r6,r8-r11, lr} \n\t" \ "msr PSP, r12 \n\t" \ "msr BASEPRI, r3 \n\t" \ - "bx lr "); + "bx lr" : : "r" (otp), "r" (ntp)); #else asm volatile ("mrs r3, BASEPRI \n\t" \ "mrs r12, PSP \n\t" \ "stmdb r12!, {r3-r11, lr} \n\t" \ - "str r12, [r0, #16] \n\t" \ - "ldr r12, [r1, #16] \n\t" \ + "str r12, [%0, #16] \n\t" \ + "ldr r12, [%1, #16] \n\t" \ "ldmia r12!, {r3-r11, lr} \n\t" \ "msr PSP, r12 \n\t" \ "msr BASEPRI, r3 \n\t" \ - "bx lr "); + "bx lr" : : "r" (otp), "r" (ntp)); #endif } diff --git a/readme.txt b/readme.txt index c2314df04..e5dcb6944 100644 --- a/readme.txt +++ b/readme.txt @@ -20,6 +20,8 @@ - CHANGE: Because the changes in the allocators some configuration options changed, see the template chconf.h file. - CHANGE: renamed ./demos/ARM7-AT91SAM7X-WEB-GCC in ARM7-AT91SAM7X-UIP-GCC. +- FIX: Added the most restrictive GCC warning option to the makefiles (-Wextra) + and fixed some warnings in the code, mostly unused function parameters. *** 1.3.2 *** - FIX: Fixed GCC 4.4.x aliasing warnings (bug 2846336)(backported in stable diff --git a/test/coverage/Makefile b/test/coverage/Makefile index fb069123c..adefad74b 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -96,7 +96,7 @@ LIBS = $(DLIBS) $(ULIBS) LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch -lgcov $(LIBDIR) ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) +CPFLAGS = $(OPT) -Wall -Wextra -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) # Generate dependency information CPFLAGS += -MD -MP -MF .dep/$(@F).d diff --git a/test/coverage/chcore.c b/test/coverage/chcore.c index 9ec3dd9f5..6b934ad9a 100644 --- a/test/coverage/chcore.c +++ b/test/coverage/chcore.c @@ -84,8 +84,9 @@ void ChkIntSources(void) { */ __attribute__((used)) static void __dummy(Thread *otp, Thread *ntp) { + (void)otp; (void)ntp; asm volatile (".globl @port_switch@8 \n\t" \ - "@port_switch@8: \n\t" \ + "@port_switch@8: \n\t" \ "push %ebp \n\t" \ "push %esi \n\t" \ "push %edi \n\t" \ diff --git a/test/coverage/main.c b/test/coverage/main.c index 893747546..923fb12c2 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -30,6 +30,9 @@ int main(int argc, char *argv[]) { msg_t result; + (void)argc; + (void)argv; + chSysInit(); sdStart(&SD1, NULL); diff --git a/test/coverage/serial_lld.c b/test/coverage/serial_lld.c index 70c073648..e1f3897a1 100644 --- a/test/coverage/serial_lld.c +++ b/test/coverage/serial_lld.c @@ -92,6 +92,7 @@ void sd_lld_init(void) { */ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { + (void)sdp; if (config == NULL) config = &default_config; @@ -106,6 +107,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { */ void sd_lld_stop(SerialDriver *sdp) { + (void)sdp; } bool_t sd_lld_interrupt_pending(void) {