From b3c5127be244ef68f1f895155f3d8999f8800f83 Mon Sep 17 00:00:00 2001 From: Kier Davis Date: Sun, 21 Jan 2018 22:59:17 +0000 Subject: Allow compatibility with old pgmspace API to be disabled by the user When this compatibility mode is enabled, code that is entirely compliant with the new pgmspace API can still raise deprecation warnings when symbols present in both the old and new APIs (for example, PGM_P) are used. Clearly, these warnings are false positives. They can be avoided by disabling the compatibility mode. This functionality is achieved by prepending the flag that enables the compatibility mode to CPPFLAGS instead of appending it, thus allowing the user to override the default behaviour and disable the compatibility mode by putting the negation of the flag in the CPPFLAGS variable in their top-level Makefile. --- Arduino.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Arduino.mk') diff --git a/Arduino.mk b/Arduino.mk index 3473166..d245c36 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1032,11 +1032,17 @@ else endif # Using += instead of =, so that CPPFLAGS can be set per sketch level -CPPFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) $(ARDUINO_ARCH_FLAG) -D__PROG_TYPES_COMPAT__ \ +CPPFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) $(ARDUINO_ARCH_FLAG) \ -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \ $(SYS_INCLUDES) $(PLATFORM_INCLUDES) $(USER_INCLUDES) -Wall -ffunction-sections \ -fdata-sections +# PROG_TYPES_COMPAT is enabled by default for compatibility with the Arduino IDE. +# By placing it before the user-provided CPPFLAGS rather than after, we allow the +# the user to disable it if they like, by adding the negation of the flag +# (-U__PROG_TYPES_COMPAT__) to the user-provided CPPFLAGS. +CPPFLAGS := -D__PROG_TYPES_COMPAT__ $(CPPFLAGS) + ifdef DEBUG OPTIMIZATION_FLAGS= $(DEBUG_FLAGS) else -- cgit v1.2.3