From 39dd16e8727f84f30b435a46d8b28ebadda500e6 Mon Sep 17 00:00:00 2001
From: barracuda156 <vital.had@gmail.com>
Date: Fri, 3 Nov 2023 18:27:54 +0800
Subject: [PATCH 10/12] Add some missing headers and use cinttypes consistently

---
 src/base/logging.h                       | 1 +
 src/codegen/arm64/constants-arm64.h      | 2 +-
 src/codegen/mips/constants-mips.h        | 2 +-
 src/codegen/mips64/constants-mips64.h    | 2 +-
 src/inspector/v8-runtime-agent-impl.cc   | 2 +-
 src/inspector/v8-string-conversions.h    | 1 +
 src/wasm/module-instantiate.cc           | 2 ++
 third_party/wasm-api/example/callback.c  | 2 +-
 third_party/wasm-api/example/finalize.c  | 2 +-
 third_party/wasm-api/example/global.c    | 2 +-
 third_party/wasm-api/example/hello.c     | 2 +-
 third_party/wasm-api/example/hostref.c   | 2 +-
 third_party/wasm-api/example/memory.c    | 2 +-
 third_party/wasm-api/example/multi.c     | 2 +-
 third_party/wasm-api/example/reflect.c   | 2 +-
 third_party/wasm-api/example/serialize.c | 2 +-
 third_party/wasm-api/example/start.c     | 2 +-
 third_party/wasm-api/example/table.c     | 2 +-
 third_party/wasm-api/example/threads.c   | 2 +-
 third_party/wasm-api/example/trap.c      | 2 +-
 20 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/base/logging.h b/src/base/logging.h
index 790018c98e9..7840c02de9e 100644
--- a/v8/src/base/logging.h
+++ b/v8/src/base/logging.h
@@ -8,6 +8,7 @@
 #include <cstring>
 #include <sstream>
 #include <string>
+#include <cstdint>
 
 #include "src/base/base-export.h"
 #include "src/base/build_config.h"
diff --git a/src/codegen/arm64/constants-arm64.h b/src/codegen/arm64/constants-arm64.h
index e63962993a7..e47fcb75f4b 100644
--- a/v8/src/codegen/arm64/constants-arm64.h
+++ b/v8/src/codegen/arm64/constants-arm64.h
@@ -23,7 +23,7 @@ STATIC_ASSERT(sizeof(1) == sizeof(int32_t));
 #ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
 #endif
-#include <inttypes.h>
+#include <cinttypes>
 
 namespace v8 {
 namespace internal {
diff --git a/src/codegen/mips/constants-mips.h b/src/codegen/mips/constants-mips.h
index 67d12155a31..b5395217122 100644
--- a/v8/src/codegen/mips/constants-mips.h
+++ b/v8/src/codegen/mips/constants-mips.h
@@ -128,7 +128,7 @@ const uint32_t kLeastSignificantByteInInt32Offset = 3;
 #ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
 #endif
-#include <inttypes.h>
+#include <cinttypes>
 
 // Defines constants and accessor classes to assemble, disassemble and
 // simulate MIPS32 instructions.
diff --git a/src/codegen/mips64/constants-mips64.h b/src/codegen/mips64/constants-mips64.h
index 751fa3c35ed..bea81f810ad 100644
--- a/v8/src/codegen/mips64/constants-mips64.h
+++ b/v8/src/codegen/mips64/constants-mips64.h
@@ -89,7 +89,7 @@ const uint32_t kLessSignificantWordInDoublewordOffset = 4;
 #ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
 #endif
-#include <inttypes.h>
+#include <cinttypes>
 
 // Defines constants and accessor classes to assemble, disassemble and
 // simulate MIPS32 instructions.
diff --git a/src/inspector/v8-runtime-agent-impl.cc b/src/inspector/v8-runtime-agent-impl.cc
index 5a2a49154c1..67a10577b94 100644
--- a/v8/src/inspector/v8-runtime-agent-impl.cc
+++ b/v8/src/inspector/v8-runtime-agent-impl.cc
@@ -30,7 +30,7 @@
 
 #include "src/inspector/v8-runtime-agent-impl.h"
 
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "../../third_party/inspector_protocol/crdtp/json.h"
 #include "src/debug/debug-interface.h"
diff --git a/src/inspector/v8-string-conversions.h b/src/inspector/v8-string-conversions.h
index c1d69c18f0a..66b3564ccad 100644
--- a/v8/src/inspector/v8-string-conversions.h
+++ b/v8/src/inspector/v8-string-conversions.h
@@ -6,6 +6,7 @@
 #define V8_INSPECTOR_V8_STRING_CONVERSIONS_H_
 
 #include <string>
+#include <cstdint>
 
 // Conversion routines between UT8 and UTF16, used by string-16.{h,cc}. You may
 // want to use string-16.h directly rather than these.
diff --git a/src/wasm/module-instantiate.cc b/src/wasm/module-instantiate.cc
index 08bd8ff8718..bb8e6f955bb 100644
--- a/v8/src/wasm/module-instantiate.cc
+++ b/v8/src/wasm/module-instantiate.cc
@@ -4,6 +4,8 @@
 
 #include "src/wasm/module-instantiate.h"
 
+#include <cinttypes>
+
 #include "src/asmjs/asm-js.h"
 #include "src/logging/counters.h"
 #include "src/numbers/conversions-inl.h"
diff --git a/third_party/wasm-api/example/callback.c b/third_party/wasm-api/example/callback.c
index e17429bdd24..ccacdd39040 100644
--- a/v8/third_party/wasm-api/example/callback.c
+++ b/v8/third_party/wasm-api/example/callback.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/finalize.c b/third_party/wasm-api/example/finalize.c
index 247368f28eb..b597b394238 100644
--- a/v8/third_party/wasm-api/example/finalize.c
+++ b/v8/third_party/wasm-api/example/finalize.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/global.c b/third_party/wasm-api/example/global.c
index 5fe357cd4c1..53034eb4fdb 100644
--- a/v8/third_party/wasm-api/example/global.c
+++ b/v8/third_party/wasm-api/example/global.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/hello.c b/third_party/wasm-api/example/hello.c
index e4ef9837ffc..eb48ac0cda0 100644
--- a/v8/third_party/wasm-api/example/hello.c
+++ b/v8/third_party/wasm-api/example/hello.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/hostref.c b/third_party/wasm-api/example/hostref.c
index b70218e6105..888a46338fc 100644
--- a/v8/third_party/wasm-api/example/hostref.c
+++ b/v8/third_party/wasm-api/example/hostref.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/memory.c b/third_party/wasm-api/example/memory.c
index 2c020c45974..855b98b4a92 100644
--- a/v8/third_party/wasm-api/example/memory.c
+++ b/v8/third_party/wasm-api/example/memory.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/multi.c b/third_party/wasm-api/example/multi.c
index 7bd4676bae7..6cfc02492fe 100644
--- a/v8/third_party/wasm-api/example/multi.c
+++ b/v8/third_party/wasm-api/example/multi.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/reflect.c b/third_party/wasm-api/example/reflect.c
index 15e0165d191..8d8d4d947c3 100644
--- a/v8/third_party/wasm-api/example/reflect.c
+++ b/v8/third_party/wasm-api/example/reflect.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/serialize.c b/third_party/wasm-api/example/serialize.c
index 4522c00dff5..64fcf8fa59f 100644
--- a/v8/third_party/wasm-api/example/serialize.c
+++ b/v8/third_party/wasm-api/example/serialize.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/start.c b/third_party/wasm-api/example/start.c
index 42fa317490b..0746011bdaa 100644
--- a/v8/third_party/wasm-api/example/start.c
+++ b/v8/third_party/wasm-api/example/start.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/table.c b/third_party/wasm-api/example/table.c
index 0ff6617f729..daef99004cf 100644
--- a/v8/third_party/wasm-api/example/table.c
+++ b/v8/third_party/wasm-api/example/table.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
diff --git a/third_party/wasm-api/example/threads.c b/third_party/wasm-api/example/threads.c
index 9f9d5894a66..be91f5a5da5 100644
--- a/v8/third_party/wasm-api/example/threads.c
+++ b/v8/third_party/wasm-api/example/threads.c
@@ -1,4 +1,4 @@
-#include <inttypes.h>
+#include <cinttypes>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/third_party/wasm-api/example/trap.c b/third_party/wasm-api/example/trap.c
index 975d6f8599f..34c077484c5 100644
--- a/v8/third_party/wasm-api/example/trap.c
+++ b/v8/third_party/wasm-api/example/trap.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "wasm.h"
 
