diff --git a/Arduino.mk b/Arduino.mk index 50d60ee..77313c2 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1045,7 +1045,7 @@ endif ifndef CFLAGS_STD ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) - CFLAGS_STD = -std=gnu11 -flto -fno-fat-lto-objects -fdiagnostics-color + CFLAGS_STD = -std=gnu11 else CFLAGS_STD = endif @@ -1056,7 +1056,7 @@ endif ifndef CXXFLAGS_STD ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) - CXXFLAGS_STD = -std=gnu++11 -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color + CXXFLAGS_STD = -std=gnu++11 else CXXFLAGS_STD = endif @@ -1069,7 +1069,9 @@ CFLAGS += $(CFLAGS_STD) CXXFLAGS += -fpermissive -fno-exceptions $(CXXFLAGS_STD) ASFLAGS += -x assembler-with-cpp ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) - ASFLAGS += -flto + ASFLAGS += -flto + CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color + CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color endif LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEVEL) ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) diff --git a/HISTORY.md b/HISTORY.md index dd59802..973edc1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -8,6 +8,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Add -fno-devirtualize flag to workaround g++ segfault bug (issue #486). (https://github.com/sej7278) - Fix: Quote the prefix tag in the space_pad_to function - Tweak: Set ARDMK_VERSION to 1.6 (https://github.com/sej7278) +- Tweak: Move non-standard-related items from CxxFLAGS_STD to CxxFLAGS (issue #523) (https://github.com/sej7278) - New: Added -fdiagnostics-color to *STD flags (https://github.com/sej7278) ### 1.6.0 (2017-07-11) diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md index 0df7a11..0f93c89 100644 --- a/arduino-mk-vars.md +++ b/arduino-mk-vars.md @@ -912,7 +912,7 @@ OTHER_LIBS = -lsomeplatformlib Controls, *exclusively*, which C standard is to be used for compilation. -Defaults to `undefined` on 1.0.x or `-std=gnu11 -flto -fno-fat-lto-objects` on 1.5+ or if you install AVR toolchain > 4.9.0 +Defaults to `undefined` on 1.0.x or `-std=gnu11` on 1.5+ or if you install AVR toolchain > 4.9.0 Possible values: @@ -927,14 +927,14 @@ Possible values: * `-std=c11` * `-std=gnu89` * `-std=gnu99` - * `-std=gnu11 -flto -fno-fat-lto-objects` - This is the default for C code + * `-std=gnu11` - This is the default for C code For more information, please refer to the [Options Controlling C Dialect](https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html) **Example:** ```Makefile -CFLAGS_STD = = -std=gnu89 +CFLAGS_STD = -std=gnu89 ``` **Requirement:** *Optional* @@ -947,7 +947,7 @@ CFLAGS_STD = = -std=gnu89 Controls, *exclusively*, which C++ standard is to be used for compilation. -Defaults to `undefined` on 1.0 or `-std=gnu++11 -fno-threadsafe-statics -flto` on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+) +Defaults to `undefined` on 1.0 or `-std=gnu++11` on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+) Possible values: @@ -964,7 +964,7 @@ Possible values: * `-std=c++1y` * `-std=c++14` * `-std=gnu++98` - * `-std=gnu++11 -fno-threadsafe-statics -flto` - This is the default for C++ code + * `-std=gnu++11` - This is the default for C++ code * `-std=gnu++1y` * `-std=gnu++14` @@ -973,7 +973,7 @@ For more information, please refer to the [Options Controlling C Dialect](https: **Example:** ```Makefile -CXXFLAGS_STD = = -std=gnu++98 +CXXFLAGS_STD = -std=gnu++98 ``` **Requirement:** *Optional* @@ -987,7 +987,7 @@ CXXFLAGS_STD = = -std=gnu++98 Flags passed to compiler for files compiled as C. Add more flags to this variable using `+=`. -Defaults to all flags required for a typical build. +Defaults to `undefined` on 1.0 or `-flto -fno-fat-lto-objects -fdiagnostics-color` on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+) **Example:** @@ -1006,7 +1006,9 @@ CFLAGS += -my-c-only-flag Flags passed to the compiler for files compiled as C++. Add more flags to this variable using `+=`. -Defaults to `-fpermissive -fno-exceptions` +Defaults to `-fpermissive -fno-exceptions` on 1.0 +or `-fpermissive -fno-exceptions -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color` +on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+) **Example:**