From 45e73b72a5a3223e5120ea2c58b98a62d2466813 Mon Sep 17 00:00:00 2001
From: Thomas Moore <tcm0116@gmail.com>
Date: Thu, 21 Dec 2017 22:44:56 -0600
Subject: [PATCH] Stop compiling after first five errors

---
 platformio.ini | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/platformio.ini b/platformio.ini
index ccc2d17e94..01f3bdb11d 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -10,6 +10,11 @@
 # Automatic targets - enable auto-uploading
 # targets = upload
 
+#
+# By default platformio build will abort after 5 errors.
+# Remove '-fmax-errors=5' from build_flags below to see all.
+#
+
 [platformio]
 src_dir = Marlin
 envs_dir = .pioenvs
@@ -30,6 +35,8 @@ lib_deps =
 
 default_src_filter = +<src/*> -<src/config>
 
+build_flags = -fmax-errors=5
+
 #################################
 #                               #
 #   Unique Core Architectures   #
@@ -47,7 +54,7 @@ default_src_filter = +<src/*> -<src/config>
 platform    = atmelavr
 framework   = arduino
 board       = megaatmega2560
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
 board_f_cpu = 16000000L
 lib_deps    = ${common.lib_deps}
 src_filter  = ${common.default_src_filter}
@@ -59,7 +66,7 @@ src_filter  = ${common.default_src_filter}
 platform    = atmelavr
 framework   = arduino
 board       = megaatmega1280
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
 board_f_cpu = 16000000L
 lib_deps    = ${common.lib_deps}
 src_filter  = ${common.default_src_filter}
@@ -71,6 +78,7 @@ src_filter  = ${common.default_src_filter}
 platform     = atmelavr
 framework    = arduino
 board        = sanguino_atmega1284p
+build_flags  = ${common.build_flags}
 upload_speed = 57600
 lib_deps     = ${common.lib_deps}
 src_filter   = ${common.default_src_filter}
@@ -85,7 +93,7 @@ src_filter   = ${common.default_src_filter}
 platform    = atmelsam
 framework   = arduino
 board       = due
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
 lib_deps    = ${common.lib_deps}
 src_filter  = ${common.default_src_filter}
 
@@ -96,6 +104,7 @@ src_filter  = ${common.default_src_filter}
 platform        = nxplpc
 board_f_cpu     = 100000000L
 build_flags     = !python Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py
+  ${common.build_flags}
   -DU8G_HAL_LINKS
 src_build_flags = -Wall
 build_unflags   = -Wall
@@ -116,6 +125,7 @@ platform       = nxplpc
 board          = lpc1768
 board_f_cpu    = 100000000L
 build_flags    = !python Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py
+  ${common.build_flags}
   -DU8G_HAL_LINKS
 lib_ldf_mode   = off
 lib_extra_dirs = frameworks
@@ -145,7 +155,7 @@ debug_server   =
 platform    = atmelavr
 framework   = arduino
 board       = reprap_rambo
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
 board_f_cpu = 16000000L
 lib_deps    = ${common.lib_deps}
 src_filter  = ${common.default_src_filter}
@@ -154,17 +164,19 @@ src_filter  = ${common.default_src_filter}
 # Sanguinololu (ATmega644p)
 #
 [env:sanguino_atmega644p]
-platform   = atmelavr
-framework  = arduino
-board      = sanguino_atmega644p
-lib_deps   = ${common.lib_deps}
-src_filter = ${common.default_src_filter}
+platform    = atmelavr
+framework   = arduino
+board       = sanguino_atmega644p
+build_flags = ${common.build_flags}
+lib_deps    = ${common.lib_deps}
+src_filter  = ${common.default_src_filter}
 
 [env:STM32F1]
 platform    = ststm32
 framework   = arduino
 board       = genericSTM32F103RE
 build_flags = !python Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py
+  ${common.build_flags}
 lib_deps    = ${common.lib_deps}
 src_filter  = ${common.default_src_filter}
 
@@ -179,7 +191,7 @@ src_filter  = ${common.default_src_filter}
 platform      = teensy
 framework     = arduino
 board         = teensy20pp
-build_flags   = -I $BUILDSRC_DIR
+build_flags   = ${common.build_flags} -I $BUILDSRC_DIR
 #board_f_cpu  = 20000000L     ; Bug in Arduino framework disallows boards running at 20Mhz
 lib_deps      = ${common.lib_deps}
 src_filter    = ${common.default_src_filter}
@@ -191,7 +203,7 @@ src_filter    = ${common.default_src_filter}
 platform    = teensy
 framework   = arduino
 board       = teensy35
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
 lib_deps    = ${common.lib_deps}
 lib_ignore  = Adafruit NeoPixel
 src_filter  = ${common.default_src_filter}
-- 
GitLab