Consistently enable -Wall and -Werror. Have WERROR set by default
This commit is contained in:
parent
3d0a5afb92
commit
75c17e15ca
@ -4,6 +4,10 @@ ifndef CONTIKI
|
||||
${error CONTIKI not defined! You must specify where Contiki resides}
|
||||
endif
|
||||
|
||||
# Enable Werror by default. To disable from command line, use make WERROR=0.
|
||||
# Setting this option is also important for tests on Cooja motes to check for warnings.
|
||||
WERROR ?= 1
|
||||
|
||||
ifeq ($(TARGET),)
|
||||
-include Makefile.target
|
||||
ifeq ($(TARGET),)
|
||||
|
@ -22,7 +22,7 @@ LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch
|
||||
OBJCOPY_FLAGS += -O binary --gap-fill 0xff
|
||||
OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb
|
||||
|
||||
ifdef WERROR
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGS += -Werror
|
||||
endif
|
||||
|
||||
|
@ -41,7 +41,7 @@ LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch
|
||||
OBJCOPY_FLAGS += -O binary --gap-fill 0xff
|
||||
OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb
|
||||
|
||||
ifdef WERROR
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGS += -Werror
|
||||
endif
|
||||
|
||||
|
@ -53,8 +53,8 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||
|
||||
### Compiler definitions
|
||||
|
||||
ifdef WERROR
|
||||
CFLAGSWERROR=-Werror
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGSWERROR= -Wall -Werror
|
||||
endif
|
||||
|
||||
ifdef IAR
|
||||
|
@ -13,7 +13,7 @@ AS ?= as
|
||||
NM ?= nm
|
||||
OBJCOPY ?= objcopy
|
||||
STRIP ?= strip
|
||||
ifdef WERROR
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGSWERROR=-Werror
|
||||
endif
|
||||
CFLAGSNO = -Wall -g -I/usr/local/include $(CFLAGSWERROR)
|
||||
|
@ -160,7 +160,10 @@ CFLAGS += -DCONFIG_GPIO_AS_PINRESET
|
||||
CFLAGS += -DBLE_STACK_SUPPORT_REQD
|
||||
CFLAGS += -mcpu=cortex-m4
|
||||
CFLAGS += -mthumb -mabi=aapcs --std=gnu99
|
||||
CFLAGS += -Wall -Werror
|
||||
CFLAGS += -Wall
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGS += -Werror
|
||||
endif
|
||||
CFLAGS += -ggdb
|
||||
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
# keep every function in separate section. This will allow linker to dump unused functions
|
||||
|
@ -27,6 +27,10 @@ STRIP = strip
|
||||
CFLAGS += -Wall -fno-asynchronous-unwind-tables -fno-unwind-tables
|
||||
LDFLAGS += -Wl,-Map=contiki-$(TARGET).map,--build-id=none
|
||||
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGS += -Werror
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_RELEASE),1)
|
||||
CFLAGS += -Os -fno-strict-aliasing -ffunction-sections -fdata-sections
|
||||
# XXX: --gc-sections can be very tricky sometimes. If somehow the release
|
||||
|
@ -72,6 +72,9 @@ CONTIKI_CPU=$(CONTIKI)/drivers/cpu/x86
|
||||
### Compiler arguments
|
||||
#CC = gcc
|
||||
CFLAGSNO = $(EXTRA_CC_ARGS) -Wall -g -I/usr/local/include -DCLASSNAME=$(CLASSNAME)
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGSNO += -Werror
|
||||
endif
|
||||
CFLAGS += $(CFLAGSNO)
|
||||
|
||||
MODULES += core/net core/net/mac core/net/mac/framer core/net/ip64-addr \
|
||||
|
@ -60,7 +60,7 @@ CFLAGS += -Wno-strict-aliasing
|
||||
CFLAGS += -Wno-cast-align
|
||||
|
||||
# Warings as error
|
||||
ifdef WERROR
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGS += -Werror
|
||||
endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user