From 0ba1d8d8bdfd33edbf0d544d95625c024ffffd73 Mon Sep 17 00:00:00 2001
From: Gergely Kis <gergely.kis@migeran.com>
Date: Mon, 22 Nov 2021 18:05:24 +0100
Subject: [PATCH] Fix debug build for iphone

printf() does not have a version that accepts std::string
as format string parameter.

(cherry picked from commit a1a3e79ea51622e00cbe8c4f7a94f1f2a44e4953)
---
 thirdparty/embree/common/sys/platform.h                | 2 +-
 thirdparty/embree/kernels/common/rtcore.h              | 2 +-
 thirdparty/embree/patches/godot-changes-noexcept.patch | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/thirdparty/embree/common/sys/platform.h b/thirdparty/embree/common/sys/platform.h
index 697e07bb86b..3e386c4944e 100644
--- a/thirdparty/embree/common/sys/platform.h
+++ b/thirdparty/embree/common/sys/platform.h
@@ -183,7 +183,7 @@
   // #define THROW_RUNTIME_ERROR(str)
   //   throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
   #define THROW_RUNTIME_ERROR(str) \
-    printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort();
+    printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
   // -- GODOT end --
 #else
   // -- GODOT start --
diff --git a/thirdparty/embree/kernels/common/rtcore.h b/thirdparty/embree/kernels/common/rtcore.h
index 373e49a6896..f8aad7c7cb8 100644
--- a/thirdparty/embree/kernels/common/rtcore.h
+++ b/thirdparty/embree/kernels/common/rtcore.h
@@ -126,7 +126,7 @@ namespace embree
   // #define throw_RTCError(error,str) \
   //   throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
   #define throw_RTCError(error,str) \
-    printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort();
+    printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
   // -- GODOT end --
 #else
   // -- GODOT begin --
diff --git a/thirdparty/embree/patches/godot-changes-noexcept.patch b/thirdparty/embree/patches/godot-changes-noexcept.patch
index c587a0e2be9..598a7f2ddc0 100644
--- a/thirdparty/embree/patches/godot-changes-noexcept.patch
+++ b/thirdparty/embree/patches/godot-changes-noexcept.patch
@@ -259,7 +259,7 @@ index 8a6d9fa0a9..697e07bb86 100644
 +  //   throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
    #define THROW_RUNTIME_ERROR(str) \
 -    throw std::runtime_error(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
-+    printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort();
++    printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
 +  // -- GODOT end --
  #else
 +  // -- GODOT start --
@@ -583,7 +583,7 @@ index 4e4b24e9c2..373e49a689 100644
 +  //   throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
    #define throw_RTCError(error,str) \
 -    throw rtcore_error(error,std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str));
-+    printf(std::string(__FILE__) + " (" + toString(__LINE__) + "): " + std::string(str)), abort();
++    printf("%s (%d): %s", __FILE__, __LINE__, std::string(str).c_str()), abort();
 +  // -- GODOT end --
  #else
 +  // -- GODOT begin --