From d853a70556f89c76dbf02b3723d71d9b56c2c4cf Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Tue, 12 May 2020 01:45:28 -0500
Subject: [PATCH] Remove strcpy compile warning

---
 Marlin/src/gcode/queue.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp
index 4d7d107ebd..4b974113fb 100644
--- a/Marlin/src/gcode/queue.cpp
+++ b/Marlin/src/gcode/queue.cpp
@@ -216,13 +216,12 @@ bool GCodeQueue::process_injected_command() {
     gcode.process_parsed_command();
   }
 
-  #pragma GCC diagnostic push
-  #pragma GCC diagnostic ignored "-Wrestrict"
-
   // Copy the next command into place
-  strcpy(injected_commands, &injected_commands[i + (c != '\0')]);
-
-  #pragma GCC diagnostic pop
+  for (
+    uint8_t d = 0, s = i + !!c;                     // dst, src
+    (injected_commands[d] = injected_commands[s]);  // copy, exit if 0
+    d++, s++                                        // next dst, src
+  );
 
   return true;
 }