From e1d6500930c7ca0842ac5b2f02bbcdf5030c8cfd Mon Sep 17 00:00:00 2001
From: Martino Facchin <m.facchin@arduino.cc>
Date: Mon, 15 May 2023 18:26:25 +0200
Subject: [PATCH] Add functions stub for compatibility with very minimal libc

In case the user needs to call the functions from Print/String, these placeholders
should be implemented (with C++ scope)
---
 api/Print.cpp  | 5 +++++
 api/String.cpp | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/api/Print.cpp b/api/Print.cpp
index 8c3e1930..8abe0d2b 100644
--- a/api/Print.cpp
+++ b/api/Print.cpp
@@ -26,6 +26,11 @@
 using namespace arduino;
 
 // Public Methods //////////////////////////////////////////////////////////////
+#ifdef __VERY_MINIMAL_LIBC__
+// These functions should be implemented in the user code (C++)
+bool isnan(float x);
+bool isinf(float x);
+#endif
 
 /* default implementation: may be overridden */
 size_t Print::write(const uint8_t *buffer, size_t size)
diff --git a/api/String.cpp b/api/String.cpp
index 0a5c11fe..a0347bc0 100644
--- a/api/String.cpp
+++ b/api/String.cpp
@@ -26,6 +26,12 @@
 
 #include <float.h>
 
+#ifdef __VERY_MINIMAL_LIBC__
+// These functions should be implemented in the user code (C++)
+long atol(char* c);
+float atof(char* c);
+#endif
+
 namespace arduino {
 
 /*********************************************/