all: Enable extra conversion warnings where applicable.
Add -Wdouble-promotion and -Wfloat-conversion for most ports to ban out implicit floating point conversions, and add extra Travis builds using MICROPY_FLOAT_IMPL_FLOAT to uncover warnings which weren't found previously. For the unix port -Wsign-comparison is added as well but only there since only clang supports this but gcc doesn't.
This commit is contained in:
parent
f31f9a8b70
commit
30840ebc99
16
.travis.yml
16
.travis.yml
|
@ -176,9 +176,9 @@ jobs:
|
|||
after_failure:
|
||||
- tests/run-tests --print-failures
|
||||
|
||||
# unix nanbox (and using Python 2 to check it can run the build scripts)
|
||||
# unix nanbox/float (and using Python 2 to check it can run the build scripts)
|
||||
- stage: test
|
||||
env: NAME="unix nanbox port build and tests"
|
||||
env: NAME="unix nanbox/float port build and tests"
|
||||
install:
|
||||
- sudo apt-get install gcc-multilib libffi-dev:i386
|
||||
script:
|
||||
|
@ -186,19 +186,25 @@ jobs:
|
|||
- make ${MAKEOPTS} -C ports/unix submodules
|
||||
- make ${MAKEOPTS} -C ports/unix PYTHON=python2 deplibs
|
||||
- make ${MAKEOPTS} -C ports/unix PYTHON=python2 VARIANT=nanbox
|
||||
- make ${MAKEOPTS} -C ports/unix PYTHON=python2 VARIANT=nanbox test_full
|
||||
- make ${MAKEOPTS} -C ports/unix PYTHON=python2 VARIANT=nanbox test_full || travis_terminate 1
|
||||
- make ${MAKEOPTS} -C ports/unix clean
|
||||
- make ${MAKEOPTS} -C ports/unix CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT"
|
||||
- make ${MAKEOPTS} -C ports/unix test
|
||||
after_failure:
|
||||
- tests/run-tests --print-failures
|
||||
|
||||
# unix stackless
|
||||
# unix stackless/float with clang
|
||||
- stage: test
|
||||
env: NAME="unix stackless port build and tests with clang"
|
||||
env: NAME="unix stackless/float port build and tests with clang"
|
||||
install:
|
||||
- sudo apt-get install clang
|
||||
script:
|
||||
- make ${MAKEOPTS} -C mpy-cross CC=clang
|
||||
- make ${MAKEOPTS} -C ports/unix submodules
|
||||
- make ${MAKEOPTS} -C ports/unix CC=clang CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1"
|
||||
- make ${MAKEOPTS} -C ports/unix CC=clang test || travis_terminate 1
|
||||
- make ${MAKEOPTS} -C ports/unix clean
|
||||
- make ${MAKEOPTS} -C ports/unix CC=clang CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT"
|
||||
- make ${MAKEOPTS} -C ports/unix CC=clang test
|
||||
after_failure:
|
||||
- tests/run-tests --print-failures
|
||||
|
|
|
@ -382,6 +382,9 @@ OBJ_MP += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
|
|||
OBJ_MP += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
||||
OBJ_MP += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
|
||||
|
||||
# Only enable this for the MicroPython source: ignore warnings from esp-idf.
|
||||
$(OBJ_MP): CFLAGS += -Wdouble-promotion -Wfloat-conversion
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(EXTMOD_SRC_C) $(LIB_SRC_C) $(DRIVERS_SRC_C)
|
||||
# Append any auto-generated sources that are needed by sources listed in SRC_QSTR
|
||||
|
|
|
@ -19,7 +19,7 @@ ifdef EMSCRIPTEN
|
|||
CPP += -isystem $(EMSCRIPTEN)/system/include/libc -cxx-isystem $(EMSCRIPTEN)/system/include/libcxx
|
||||
endif
|
||||
|
||||
CFLAGS = -m32 -Wall -Werror $(INC) -std=c99 $(COPT)
|
||||
CFLAGS = -m32 -Wall -Werror -Wdouble-promotion -Wfloat-conversion $(INC) -std=c99 $(COPT)
|
||||
LDFLAGS = -m32 -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
||||
|
||||
CFLAGS += -O0 -DNDEBUG
|
||||
|
|
|
@ -40,7 +40,7 @@ INC += -I$(TOP)/lib/tinyusb/hw
|
|||
INC += -I$(TOP)/lib/tinyusb/hw/bsp/teensy_40
|
||||
|
||||
CFLAGS_MCU = -mtune=cortex-m7 -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16
|
||||
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib -mthumb $(CFLAGS_MCU)
|
||||
CFLAGS = $(INC) -Wall -Werror -Wdouble-promotion -Wfloat-conversion -std=c99 -nostdlib -mthumb $(CFLAGS_MCU)
|
||||
CFLAGS += -DCPU_$(MCU_SERIES) -DCPU_$(MCU_VARIANT)
|
||||
CFLAGS += -DXIP_EXTERNAL_FLASH=1 \
|
||||
-DXIP_BOOT_HEADER_ENABLE=1 \
|
||||
|
|
|
@ -22,12 +22,12 @@ INC += -I$(BUILD)
|
|||
ifeq ($(CROSS), 1)
|
||||
DFU = $(TOP)/tools/dfu.py
|
||||
PYDFU = $(TOP)/tools/pydfu.py
|
||||
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -msoft-float -fsingle-precision-constant -Wdouble-promotion
|
||||
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -msoft-float -fsingle-precision-constant -Wdouble-promotion -Wfloat-conversion
|
||||
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
|
||||
LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
|
||||
else
|
||||
LD = gcc
|
||||
CFLAGS = -m32 $(INC) -Wall -Werror -std=c99 $(COPT)
|
||||
CFLAGS = -m32 $(INC) -Wall -Werror -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
|
||||
LDFLAGS = -m32 -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
||||
endif
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ INC += -I.
|
|||
INC += -I$(TOP)
|
||||
INC += -I$(BUILD)
|
||||
|
||||
CFLAGS = $(INC) -g -Wall -std=c99 $(COPT)
|
||||
CFLAGS = $(INC) -g -Wall -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
|
||||
CFLAGS += -mno-string -mno-multiple -mno-vsx -mno-altivec -nostdlib
|
||||
CFLAGS += -mlittle-endian -mstrict-align -msoft-float
|
||||
CFLAGS += -Os
|
||||
|
|
|
@ -40,7 +40,7 @@ INC += -I.
|
|||
INC += -I$(TOP)
|
||||
INC += -I$(BUILD)
|
||||
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 $(COPT) \
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Werror -std=gnu99 $(COPT) \
|
||||
-ffunction-sections -fdata-sections
|
||||
|
||||
#Debugging/Optimization
|
||||
|
|
|
@ -93,7 +93,7 @@ CFLAGS_MCU_l4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
|
|||
CFLAGS_MCU_h7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7
|
||||
CFLAGS_MCU_wb = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
|
||||
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += -D$(CMSIS_MCU)
|
||||
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
|
||||
CFLAGS += $(COPT)
|
||||
|
@ -117,7 +117,7 @@ ifeq ($(MICROPY_FLOAT_IMPL),none)
|
|||
CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_NONE
|
||||
else
|
||||
CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT
|
||||
CFLAGS += -fsingle-precision-constant -Wdouble-promotion
|
||||
CFLAGS += -fsingle-precision-constant
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -238,6 +238,13 @@ SRC_LIBM += lib/libm/ef_sqrt.c
|
|||
endif
|
||||
endif
|
||||
|
||||
LIBM_O = $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
|
||||
|
||||
# Too many warnings in libm_dbl, disable for now.
|
||||
ifeq ($(MICROPY_FLOAT_IMPL),double)
|
||||
$(LIBM_O): CFLAGS := $(filter-out -Wdouble-promotion -Wfloat-conversion, $(CFLAGS))
|
||||
endif
|
||||
|
||||
EXTMOD_SRC_C = $(addprefix extmod/,\
|
||||
modonewire.c \
|
||||
)
|
||||
|
@ -494,7 +501,7 @@ endif
|
|||
OBJ =
|
||||
OBJ += $(PY_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
|
||||
OBJ += $(LIBM_O)
|
||||
OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
|
|
|
@ -54,7 +54,7 @@ CFLAGS_MCU_f7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7
|
|||
CFLAGS_MCU_h7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7
|
||||
CFLAGS_MCU_l4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
|
||||
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Werror -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += -D$(CMSIS_MCU)
|
||||
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
|
||||
CFLAGS += $(COPT)
|
||||
|
|
|
@ -39,7 +39,7 @@ INC += -I$(BUILD)
|
|||
|
||||
# compiler settings
|
||||
CWARN = -Wall -Werror
|
||||
CWARN += -Wpointer-arith -Wuninitialized
|
||||
CWARN += -Wpointer-arith -Wuninitialized -Wdouble-promotion -Wsign-compare -Wfloat-conversion
|
||||
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)
|
||||
|
||||
# Debugging/Optimization
|
||||
|
|
|
@ -70,7 +70,9 @@
|
|||
#define MICROPY_REPL_AUTO_INDENT (1)
|
||||
#define MICROPY_HELPER_LEXER_UNIX (1)
|
||||
#define MICROPY_ENABLE_SOURCE_LINE (1)
|
||||
#ifndef MICROPY_FLOAT_IMPL
|
||||
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
|
||||
#endif
|
||||
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
||||
#ifndef MICROPY_STREAMS_NON_BLOCK
|
||||
#define MICROPY_STREAMS_NON_BLOCK (1)
|
||||
|
|
|
@ -5,7 +5,7 @@ DEBUG ?= 1
|
|||
|
||||
CFLAGS += \
|
||||
-fprofile-arcs -ftest-coverage \
|
||||
-Wdouble-promotion -Wformat -Wmissing-declarations -Wmissing-prototypes -Wsign-compare \
|
||||
-Wformat -Wmissing-declarations -Wmissing-prototypes \
|
||||
-Wold-style-definition -Wpointer-arith -Wshadow -Wuninitialized -Wunused-parameter \
|
||||
-DMICROPY_UNIX_COVERAGE
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ INC += -I$(TOP)
|
|||
INC += -I$(BUILD)
|
||||
|
||||
# compiler settings
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
LDFLAGS = $(LDFLAGS_MOD) -lm $(LDFLAGS_EXTRA)
|
||||
|
||||
# Debugging/Optimization
|
||||
|
|
Loading…
Reference in New Issue