From c9e1c1343a7b25510462afea36c83260ee6a6da9 Mon Sep 17 00:00:00 2001
From: Markus Scherer <markus.icu@gmail.com>
Date: Mon, 7 Nov 2022 10:34:44 -0800
Subject: [PATCH] ICU-22191 writesrc.cpp: enable PRI formatting constants on
 all compilers

(note from minrk: includes changes from upstream PR #2239 and PR #2250)
---
 icu4c/source/tools/toolutil/writesrc.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/icu4c/source/tools/toolutil/writesrc.cpp b/icu4c/source/tools/toolutil/writesrc.cpp
index 4675a653b32..20ad74aa8b2 100644
--- a/icu4c/source/tools/toolutil/writesrc.cpp
+++ b/icu4c/source/tools/toolutil/writesrc.cpp
@@ -20,7 +20,16 @@

 #include <stdio.h>
-#include <inttypes.h>
 #include <time.h>
+
+// The C99 standard suggested that C++ implementations not define PRId64 etc. constants
+// unless this macro is defined.
+// See the Notes at https://en.cppreference.com/w/cpp/types/integer .
+// Similar to defining __STDC_LIMIT_MACROS in unicode/ptypes.h .
+#ifndef __STDC_FORMAT_MACROS
+#   define __STDC_FORMAT_MACROS
+#endif
+ #include <cinttypes>
+
 #include "unicode/utypes.h"
 #include "unicode/putil.h"
 #include "unicode/ucptrie.h"
