From 06c5c028046adc0a5501f6ac51953640e2015020 Mon Sep 17 00:00:00 2001
From: Nick Brassel <nick@tzarc.org>
Date: Wed, 5 Apr 2023 14:59:09 +1000
Subject: Disable specific warnings to mitigate compilation problems with
 `KEEP_INTERMEDIATES=yes`. (#20339)

---
 keyboards/hazel/bad_wings/keymaps/default/config.h | 5 ++---
 keyboards/mechlovin/mechlovin9/rev3/info.json      | 1 +
 keyboards/splitkb/kyria/info.json                  | 3 +++
 platforms/avr/_wait.h                              | 4 ++++
 platforms/chibios/drivers/audio_dac_additive.c     | 6 ++++++
 platforms/chibios/drivers/audio_dac_basic.c        | 6 ++++++
 tmk_core/protocol/usb_hid/override_wiring.c        | 6 +++---
 7 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/keyboards/hazel/bad_wings/keymaps/default/config.h b/keyboards/hazel/bad_wings/keymaps/default/config.h
index bd395ec9e5..2d9e21274f 100644
--- a/keyboards/hazel/bad_wings/keymaps/default/config.h
+++ b/keyboards/hazel/bad_wings/keymaps/default/config.h
@@ -5,12 +5,11 @@
 
 #define TAPPING_TERM 200
 #define PERMISSIVE_HOLD
-#define IGNORE_MOD_TAP_INTERRUPT
 #define TAPPING_FORCE_HOLD
 #define TAPPING_TERM_PER_KEY
 #define ONESHOT_TAP_TOGGLE 10
 #define ONESHOT_TIMEOUT 500
 #define DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD
 #define CIRQUE_PINNACLE_TAP_ENABLE
-#define CIRQUE_PINNACLE_POSITION_MODE  CIRQUE_PINNACLE_ABSOLUTE_MODE 
-#define CIRQUE_DEVICE_GESTURES_SCROLL_ENABLE 
\ No newline at end of file
+#define CIRQUE_PINNACLE_POSITION_MODE  CIRQUE_PINNACLE_ABSOLUTE_MODE
+#define CIRQUE_DEVICE_GESTURES_SCROLL_ENABLE
diff --git a/keyboards/mechlovin/mechlovin9/rev3/info.json b/keyboards/mechlovin/mechlovin9/rev3/info.json
index d5da28d3ed..f5efcc1f6a 100644
--- a/keyboards/mechlovin/mechlovin9/rev3/info.json
+++ b/keyboards/mechlovin/mechlovin9/rev3/info.json
@@ -16,6 +16,7 @@
         "rows": ["B12", "B13", "B14", "B15", "A1"],
         "cols": ["B11", "B10", "B2", "B1", "B0", "A6", "A5", "A4", "A3", "C13", "B7", "B6", "B5", "B4", "B3"]
     },
+    "diode_direction": "COL2ROW",
     "indicators": {
         "caps_lock": "B9"
     }
diff --git a/keyboards/splitkb/kyria/info.json b/keyboards/splitkb/kyria/info.json
index 7249007962..f70e8e3bb2 100644
--- a/keyboards/splitkb/kyria/info.json
+++ b/keyboards/splitkb/kyria/info.json
@@ -9,5 +9,8 @@
     "development_board": "elite_c",
     "split": {
         "enabled": true
+    },
+    "build": {
+        "lto": true
     }
 }
diff --git a/platforms/avr/_wait.h b/platforms/avr/_wait.h
index c1a598a428..39cbf618d2 100644
--- a/platforms/avr/_wait.h
+++ b/platforms/avr/_wait.h
@@ -15,7 +15,11 @@
  */
 #pragma once
 
+// Need to disable GCC's "maybe-uninitialized" warning for this file, as it causes issues when running `KEEP_INTERMEDIATES=yes`.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
 #include <util/delay.h>
+#pragma GCC diagnostic pop
 
 // http://ww1.microchip.com/downloads/en/devicedoc/atmel-0856-avr-instruction-set-manual.pdf
 // page 22: Table 4-2. Arithmetic and Logic Instructions
diff --git a/platforms/chibios/drivers/audio_dac_additive.c b/platforms/chibios/drivers/audio_dac_additive.c
index 68ce13788e..d29147ca3b 100644
--- a/platforms/chibios/drivers/audio_dac_additive.c
+++ b/platforms/chibios/drivers/audio_dac_additive.c
@@ -19,6 +19,10 @@
 #include <ch.h>
 #include <hal.h>
 
+// Need to disable GCC's "tautological-compare" warning for this file, as it causes issues when running `KEEP_INTERMEDIATES=yes`. Corresponding pop at the end of the file.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wtautological-compare"
+
 /*
   Audio Driver: DAC
 
@@ -335,3 +339,5 @@ void audio_driver_start(void) {
     active_tones_snapshot_length = 0;
     state                        = OUTPUT_SHOULD_START;
 }
+
+#pragma GCC diagnostic pop
diff --git a/platforms/chibios/drivers/audio_dac_basic.c b/platforms/chibios/drivers/audio_dac_basic.c
index 5f0cbf8f84..4ea23a2158 100644
--- a/platforms/chibios/drivers/audio_dac_basic.c
+++ b/platforms/chibios/drivers/audio_dac_basic.c
@@ -19,6 +19,10 @@
 #include "ch.h"
 #include "hal.h"
 
+// Need to disable GCC's "tautological-compare" warning for this file, as it causes issues when running `KEEP_INTERMEDIATES=yes`. Corresponding pop at the end of the file.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wtautological-compare"
+
 /*
   Audio Driver: DAC
 
@@ -247,3 +251,5 @@ void audio_driver_start(void) {
     }
     gptStartContinuous(&AUDIO_STATE_TIMER, 2U);
 }
+
+#pragma GCC diagnostic pop
diff --git a/tmk_core/protocol/usb_hid/override_wiring.c b/tmk_core/protocol/usb_hid/override_wiring.c
index adc6645f8e..40bb574d7d 100644
--- a/tmk_core/protocol/usb_hid/override_wiring.c
+++ b/tmk_core/protocol/usb_hid/override_wiring.c
@@ -2,7 +2,7 @@
  * To keep Timer0 for common/timer.c override arduino/wiring.c.
  */
 #define __DELAY_BACKWARD_COMPATIBLE__
-#include <util/delay.h>
+#include "wait.h"
 #include "platforms/timer.h"
 
 
@@ -16,11 +16,11 @@ unsigned long micros(void)
 }
 void delay(unsigned long ms)
 {
-    _delay_ms(ms);
+    wait_ms(ms);
 }
 void delayMicroseconds(unsigned int us)
 {
-    _delay_us(us);
+    wait_us(us);
 }
 void init(void)
 {
-- 
cgit v1.2.3