Skip to content

Commit 983db51

Browse files
authored
Merge pull request #524 from sej7278/master
Moved the LTO etc. flags from CXXFLAGS_STD to CXXFLAGS
2 parents 5fcd04c + fa82c3a commit 983db51

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

Arduino.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ endif
10451045

10461046
ifndef CFLAGS_STD
10471047
ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
1048-
CFLAGS_STD = -std=gnu11 -flto -fno-fat-lto-objects -fdiagnostics-color
1048+
CFLAGS_STD = -std=gnu11
10491049
else
10501050
CFLAGS_STD =
10511051
endif
@@ -1056,7 +1056,7 @@ endif
10561056

10571057
ifndef CXXFLAGS_STD
10581058
ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
1059-
CXXFLAGS_STD = -std=gnu++11 -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color
1059+
CXXFLAGS_STD = -std=gnu++11
10601060
else
10611061
CXXFLAGS_STD =
10621062
endif
@@ -1069,7 +1069,9 @@ CFLAGS += $(CFLAGS_STD)
10691069
CXXFLAGS += -fpermissive -fno-exceptions $(CXXFLAGS_STD)
10701070
ASFLAGS += -x assembler-with-cpp
10711071
ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
1072-
ASFLAGS += -flto
1072+
ASFLAGS += -flto
1073+
CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color
1074+
CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color
10731075
endif
10741076
LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEVEL)
10751077
ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
88
- Fix: Add -fno-devirtualize flag to workaround g++ segfault bug (issue #486). (https://github.com/sej7278)
99
- Fix: Quote the prefix tag in the space_pad_to function
1010
- Tweak: Set ARDMK_VERSION to 1.6 (https://github.com/sej7278)
11+
- Tweak: Move non-standard-related items from CxxFLAGS_STD to CxxFLAGS (issue #523) (https://github.com/sej7278)
1112
- New: Added -fdiagnostics-color to *STD flags (https://github.com/sej7278)
1213

1314
### 1.6.0 (2017-07-11)

arduino-mk-vars.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ OTHER_LIBS = -lsomeplatformlib
912912

913913
Controls, *exclusively*, which C standard is to be used for compilation.
914914

915-
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
915+
Defaults to `undefined` on 1.0.x or `-std=gnu11` on 1.5+ or if you install AVR toolchain > 4.9.0
916916

917917
Possible values:
918918

@@ -927,14 +927,14 @@ Possible values:
927927
* `-std=c11`
928928
* `-std=gnu89`
929929
* `-std=gnu99`
930-
* `-std=gnu11 -flto -fno-fat-lto-objects` - This is the default for C code
930+
* `-std=gnu11` - This is the default for C code
931931

932932
For more information, please refer to the [Options Controlling C Dialect](https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html)
933933

934934
**Example:**
935935

936936
```Makefile
937-
CFLAGS_STD = = -std=gnu89
937+
CFLAGS_STD = -std=gnu89
938938
```
939939

940940
**Requirement:** *Optional*
@@ -947,7 +947,7 @@ CFLAGS_STD = = -std=gnu89
947947

948948
Controls, *exclusively*, which C++ standard is to be used for compilation.
949949

950-
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+)
950+
Defaults to `undefined` on 1.0 or `-std=gnu++11` on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+)
951951

952952
Possible values:
953953

@@ -964,7 +964,7 @@ Possible values:
964964
* `-std=c++1y`
965965
* `-std=c++14`
966966
* `-std=gnu++98`
967-
* `-std=gnu++11 -fno-threadsafe-statics -flto` - This is the default for C++ code
967+
* `-std=gnu++11` - This is the default for C++ code
968968
* `-std=gnu++1y`
969969
* `-std=gnu++14`
970970

@@ -973,7 +973,7 @@ For more information, please refer to the [Options Controlling C Dialect](https:
973973
**Example:**
974974

975975
```Makefile
976-
CXXFLAGS_STD = = -std=gnu++98
976+
CXXFLAGS_STD = -std=gnu++98
977977
```
978978

979979
**Requirement:** *Optional*
@@ -987,7 +987,7 @@ CXXFLAGS_STD = = -std=gnu++98
987987
Flags passed to compiler for files compiled as C. Add more flags to this
988988
variable using `+=`.
989989

990-
Defaults to all flags required for a typical build.
990+
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+)
991991

992992
**Example:**
993993

@@ -1006,7 +1006,9 @@ CFLAGS += -my-c-only-flag
10061006
Flags passed to the compiler for files compiled as C++. Add more flags to this
10071007
variable using `+=`.
10081008

1009-
Defaults to `-fpermissive -fno-exceptions`
1009+
Defaults to `-fpermissive -fno-exceptions` on 1.0
1010+
or `-fpermissive -fno-exceptions -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color`
1011+
on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+)
10101012

10111013
**Example:**
10121014

0 commit comments

Comments
 (0)