Skip to content

Commit 88dcc7f

Browse files
bnoordhuisrvagg
authored andcommitted
v8: fix -Wsign-compare warning in Zone::New()
Use unsigned types for size calculations. Fixes a warning that was drowning out everything else because zone-inl.h is included in every source file: ../deps/v8/src/zone-inl.h: In member function 'void* v8::internal::Zone::New(int)': ../deps/v8/src/zone-inl.h:61:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (limit < position || size > limit - position) { PR-URL: nodejs-private/node-private#62 Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent fd8ac56 commit 88dcc7f

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

deps/v8/src/version.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define MAJOR_VERSION 3
3636
#define MINOR_VERSION 14
3737
#define BUILD_NUMBER 5
38-
#define PATCH_LEVEL 10
38+
#define PATCH_LEVEL 11
3939
// Use 1 for candidates and 0 otherwise.
4040
// (Boolean macro values are not supported by all preprocessors.)
4141
#define IS_CANDIDATE_VERSION 0

deps/v8/src/zone-inl.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace v8 {
3939
namespace internal {
4040

4141

42-
inline void* Zone::New(int size) {
42+
inline void* Zone::New(size_t size) {
4343
ASSERT(scope_nesting_ > 0);
4444
// Round up the requested size to fit the alignment.
4545
size = RoundUp(size, kAlignment);
@@ -72,7 +72,7 @@ inline void* Zone::New(int size) {
7272

7373

7474
template <typename T>
75-
T* Zone::NewArray(int length) {
75+
T* Zone::NewArray(size_t length) {
7676
return static_cast<T*>(New(length * sizeof(T)));
7777
}
7878

@@ -98,18 +98,18 @@ ZoneSplayTree<Config>::~ZoneSplayTree() {
9898

9999

100100
void* ZoneObject::operator new(size_t size, Zone* zone) {
101-
return zone->New(static_cast<int>(size));
101+
return zone->New(size);
102102
}
103103

104104
inline void* ZoneAllocationPolicy::New(size_t size) {
105105
ASSERT(zone_);
106-
return zone_->New(static_cast<int>(size));
106+
return zone_->New(size);
107107
}
108108

109109

110110
template <typename T>
111111
void* ZoneList<T>::operator new(size_t size, Zone* zone) {
112-
return zone->New(static_cast<int>(size));
112+
return zone->New(size);
113113
}
114114

115115

deps/v8/src/zone.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ class Zone {
6868
~Zone() { DeleteKeptSegment(); }
6969
// Allocate 'size' bytes of memory in the Zone; expands the Zone by
7070
// allocating new segments of memory on demand using malloc().
71-
inline void* New(int size);
71+
inline void* New(size_t size);
7272

7373
template <typename T>
74-
inline T* NewArray(int length);
74+
inline T* NewArray(size_t length);
7575

7676
// Deletes all objects and free all memory allocated in the Zone. Keeps one
7777
// small (size <= kMaximumKeptSegmentSize) segment around if it finds one.

0 commit comments

Comments
 (0)