Building kwboot on macOS warns:

  warning: unused function '_is_within_tolerance' [-Wunused-function]

The only caller checks the baudrate that BOTHER sets, and macOS has no
BOTHER. Define the function under the same #ifdef.

Signed-off-by: Josef Schlehofer <[email protected]>
---
 tools/kwboot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 6bef4610ff8..c03f0d6d63e 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -727,12 +727,14 @@ kwboot_tty_baudrate_to_speed(int baudrate)
        }
 }
 
+#ifdef BOTHER
 static int
 _is_within_tolerance(int value, int reference, int tolerance)
 {
        return 100 * value >= reference * (100 - tolerance) &&
               100 * value <= reference * (100 + tolerance);
 }
+#endif
 
 static int
 kwboot_tty_change_baudrate(int fd, int baudrate)
-- 
2.54.0 (Apple Git-157)

Reply via email to