Skip to content

[v20.x] deps: V8: backport build fixes for Xcode 16.3 #58342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: v20.x-staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.26',
'v8_embedder_string': '-node.29',

##### V8 defaults for Node.js #####

Expand Down
1 change: 1 addition & 0 deletions deps/v8/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Matt Hanselman <[email protected]>
Matthew Sporleder <[email protected]>
Maxim Mazurok <[email protected]>
Maxim Mossienko <[email protected]>
Meir Shpilraien <[email protected]>
Michael Lutz <[email protected]>
Michael Mclaughlin <[email protected]>
Michael Smith <[email protected]>
Expand Down
8 changes: 7 additions & 1 deletion deps/v8/src/inspector/string-16.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bool isSpaceOrNewLine(UChar c) {
return isASCII(c) && c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9));
}

int64_t charactersToInteger(const UChar* characters, size_t length,
int64_t charactersToInteger(const uint16_t* characters, size_t length,
bool* ok = nullptr) {
std::vector<char> buffer;
buffer.reserve(length + 1);
Expand All @@ -50,6 +50,8 @@ int64_t charactersToInteger(const UChar* characters, size_t length,

String16::String16(const UChar* characters, size_t size)
: m_impl(characters, size) {}
String16::String16(const uint16_t* characters, size_t size)
: m_impl(reinterpret_cast<const UChar*>(characters), size) {}

String16::String16(const UChar* characters) : m_impl(characters) {}

Expand Down Expand Up @@ -241,6 +243,10 @@ String16 String16::fromUTF16LE(const UChar* stringStart, size_t length) {
#endif // V8_TARGET_BIG_ENDIAN
}

String16 String16::fromUTF16LE(const uint16_t* stringStart, size_t length) {
return fromUTF16LE(reinterpret_cast<const UChar*>(stringStart), length);
}

std::string String16::utf8() const {
return UTF16ToUTF8(m_impl.data(), m_impl.size());
}
Expand Down
9 changes: 7 additions & 2 deletions deps/v8/src/inspector/string-16.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace v8_inspector {

using UChar = uint16_t;
using UChar = char16_t;

class String16 {
public:
Expand All @@ -27,6 +27,7 @@ class String16 {
String16(const String16&) V8_NOEXCEPT = default;
String16(String16&&) V8_NOEXCEPT = default;
String16(const UChar* characters, size_t size);
String16(const uint16_t* characters, size_t size);
V8_EXPORT String16(const UChar* characters);
V8_EXPORT String16(const char* characters);
String16(const char* characters, size_t size);
Expand All @@ -48,7 +49,9 @@ class String16 {
int toInteger(bool* ok = nullptr) const;
std::pair<size_t, size_t> getTrimmedOffsetAndLength() const;
String16 stripWhiteSpace() const;
const UChar* characters16() const { return m_impl.c_str(); }
const uint16_t* characters16() const {
return reinterpret_cast<const uint16_t*>(m_impl.c_str());
}
size_t length() const { return m_impl.length(); }
bool isEmpty() const { return !m_impl.length(); }
UChar operator[](size_t index) const { return m_impl[index]; }
Expand Down Expand Up @@ -78,6 +81,8 @@ class String16 {
// On Big endian architectures, byte order needs to be flipped.
V8_EXPORT static String16 fromUTF16LE(const UChar* stringStart,
size_t length);
V8_EXPORT static String16 fromUTF16LE(const uint16_t* stringStart,
size_t length);

std::size_t hash() const {
if (!hash_code) {
Expand Down
6 changes: 3 additions & 3 deletions deps/v8/src/inspector/v8-string-conversions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace v8_inspector {
namespace {
using UChar = uint16_t;
using UChar = char16_t;
using UChar32 = uint32_t;

bool isASCII(UChar c) { return !(c & ~0x7F); }
Expand Down Expand Up @@ -386,7 +386,7 @@ std::string UTF16ToUTF8(const UChar* stringStart, size_t length) {

std::basic_string<UChar> UTF8ToUTF16(const char* stringStart, size_t length) {
if (!stringStart || !length) return std::basic_string<UChar>();
std::vector<uint16_t> buffer(length);
std::vector<UChar> buffer(length);
UChar* bufferStart = buffer.data();

UChar* bufferCurrent = bufferStart;
Expand All @@ -395,7 +395,7 @@ std::basic_string<UChar> UTF8ToUTF16(const char* stringStart, size_t length) {
reinterpret_cast<const char*>(stringStart + length),
&bufferCurrent, bufferCurrent + buffer.size(), nullptr,
true) != conversionOK)
return std::basic_string<uint16_t>();
return std::basic_string<UChar>();
size_t utf16Length = bufferCurrent - bufferStart;
return std::basic_string<UChar>(bufferStart, bufferStart + utf16Length);
}
Expand Down
5 changes: 3 additions & 2 deletions deps/v8/src/inspector/v8-string-conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
#ifndef V8_INSPECTOR_V8_STRING_CONVERSIONS_H_
#define V8_INSPECTOR_V8_STRING_CONVERSIONS_H_


#include <cstdint>
#include <string>

// Conversion routines between UT8 and UTF16, used by string-16.{h,cc}. You may
// want to use string-16.h directly rather than these.
namespace v8_inspector {
std::basic_string<uint16_t> UTF8ToUTF16(const char* stringStart, size_t length);
std::string UTF16ToUTF8(const uint16_t* stringStart, size_t length);
std::basic_string<char16_t> UTF8ToUTF16(const char* stringStart, size_t length);
std::string UTF16ToUTF8(const char16_t* stringStart, size_t length);
} // namespace v8_inspector

#endif // V8_INSPECTOR_V8_STRING_CONVERSIONS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
namespace v8_crdtp {

std::string UTF16ToUTF8(span<uint16_t> in) {
return v8_inspector::UTF16ToUTF8(in.data(), in.size());
return v8_inspector::UTF16ToUTF8(reinterpret_cast<const char16_t*>(in.data()),
in.size());
}

std::vector<uint16_t> UTF8ToUTF16(span<uint8_t> in) {
std::basic_string<uint16_t> utf16 = v8_inspector::UTF8ToUTF16(
std::basic_string<char16_t> utf16 = v8_inspector::UTF8ToUTF16(
reinterpret_cast<const char*>(in.data()), in.size());
return std::vector<uint16_t>(utf16.begin(), utf16.end());
return std::vector<uint16_t>(
reinterpret_cast<const uint16_t*>(utf16.data()),
reinterpret_cast<const uint16_t*>(utf16.data()) + utf16.size());
}

} // namespace v8_crdtp
23 changes: 1 addition & 22 deletions deps/v8/third_party/zlib/zutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# endif
#endif

#if defined(MACOS) || defined(TARGET_OS_MAC)
#if defined(MACOS)
# define OS_CODE 7
# ifndef Z_SOLO
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
# include <unix.h> /* for fdopen */
# else
# ifndef fdopen
# define fdopen(fd,mode) NULL /* No fdopen() */
# endif
# endif
# endif
#endif

#ifdef __acorn
Expand All @@ -185,18 +176,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define OS_CODE 19
#endif

#if defined(_BEOS_) || defined(RISCOS)
# define fdopen(fd,mode) NULL /* No fdopen() */
#endif

#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
# if defined(_WIN32_WCE)
# define fdopen(fd,mode) NULL /* No fdopen() */
# else
# define fdopen(fd,type) _fdopen(fd,type)
# endif
#endif

#if defined(__BORLANDC__) && !defined(MSDOS)
#pragma warn -8004
#pragma warn -8008
Expand Down