From cc04b75a1b4e20e57b6dbad60a758d61074bb887 Mon Sep 17 00:00:00 2001
From: Matt Borland <matt@mattborland.com>
Date: Wed, 22 Jan 2025 11:41:14 -0500
Subject: [PATCH] Add additional paths to guarantee BOOST_TEST_PRIxPTR is
 defined

---
 include/boost/test/impl/execution_monitor.ipp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/boost/test/impl/execution_monitor.ipp b/include/boost/test/impl/execution_monitor.ipp
index 848670b80c..7753ed7854 100644
--- boost/test/impl/execution_monitor.ipp
+++ boost/test/impl/execution_monitor.ipp
@@ -207,7 +207,18 @@ namespace { void _set_se_translator( void* ) {} }
 #  ifdef BOOST_TEST_DEFINED_STDC_FORMAT_MACROS
 #    undef __STDC_FORMAT_MACROS
 #  endif
-#else
+#endif
+// If any modern toolchain did not pick up a definition from above it will here
+#ifndef BOOST_TEST_PRIxPTR
+#  ifdef __has_include
+#    if __has_include(<cinttypes>)
+#      include <cinttypes>
+#      define BOOST_TEST_PRIxPTR PRIxPTR
+#    endif
+#  endif
+#endif
+// Last resort
+#ifndef BOOST_TEST_PRIxPTR
 #  define BOOST_TEST_PRIxPTR "08lx"
 #endif
 

From d19ff0b661e94f9f518e30b6303f5596199ef26d Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <barracuda@macos-powerpc.org>
Date: Mon, 27 Jan 2025 04:22:28 +0800
Subject: [PATCH] execution_monitor.ipp: follow-up fix for macOS

This fixes https://github.com/boostorg/test/issues/436
---
 include/boost/test/impl/execution_monitor.ipp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git include/boost/test/impl/execution_monitor.ipp include/boost/test/impl/execution_monitor.ipp
index 7753ed78..8d7500af 100644
--- boost/test/impl/execution_monitor.ipp
+++ boost/test/impl/execution_monitor.ipp
@@ -195,8 +195,8 @@ namespace { void _set_se_translator( void* ) {} }
 #endif
 
 #if (!defined(BOOST_MSSTL_VERSION) || (BOOST_MSSTL_VERSION >= 120)) && (!defined(__GLIBC__) || ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2))))
-// glibc 2.2 - 2.17 required __STDC_FORMAT_MACROS to be defined for use of PRIxPTR
-#  if defined(__GLIBC__) && !((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 18)))
+// glibc 2.2 - 2.17 required __STDC_FORMAT_MACROS to be defined for use of PRIxPTR, as well as some versions of macOS.
+#  if (defined(__GLIBC__) && !((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 18)))) || defined(__APPLE__)
 #    ifndef __STDC_FORMAT_MACROS
 #      define __STDC_FORMAT_MACROS 1
 #      define BOOST_TEST_DEFINED_STDC_FORMAT_MACROS
