Skip to content

Commit fd8ac56

Browse files
bnoordhuisrvagg
authored andcommitted
v8: fix build errors with g++ 6.1.1
Shifting a negative constant value is no longer allowed unless the -fpermissive flag is in effect. Fixes the following build errors: ../deps/v8/src/objects.h:5188:47: warning: left shift of negative value [-Wshift-negative-value] static const int kElementsKindMask = (-1 << kElementsKindShift) & ../deps/v8/src/objects.h:5188:44: error: left operand of shift expression '(-1 << 3)' is negative [-fpermissive] static const int kElementsKindMask = (-1 << kElementsKindShift) & ../deps/v8/src/objects.h:7376:39: warning: left shift of negative value [-Wshift-negative-value] (~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) | ../deps/v8/src/objects.h:7376:36: error: left operand of shift expression '(-8 << 26)' is negative [-fpermissive] (~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) | And: ../deps/v8/src/liveedit.cc:205:44: warning: left shift of negative value [-Wshift-negative-value] static const int kEmptyCellValue = -1 << kDirectionSizeBits; ../deps/v8/src/liveedit.cc:205:41: error: left operand of shift expression '(-1 << 2)' is negative [-fpermissive] static const int kEmptyCellValue = -1 << kDirectionSizeBits; PR-URL: nodejs-private/node-private#62 Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent 0d7e21e commit fd8ac56

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

deps/v8/src/liveedit.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ class Differencer {
202202

203203
static const int kDirectionSizeBits = 2;
204204
static const int kDirectionMask = (1 << kDirectionSizeBits) - 1;
205-
static const int kEmptyCellValue = -1 << kDirectionSizeBits;
205+
static const int kEmptyCellValue =
206+
static_cast<unsigned int>(-1) << kDirectionSizeBits;
206207

207208
// This method only holds static assert statement (unfortunately you cannot
208209
// place one in class scope).

deps/v8/src/objects.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5185,7 +5185,8 @@ class Map: public HeapObject {
51855185
static const int kElementsKindBitCount = 5;
51865186

51875187
// Derived values from bit field 2
5188-
static const int kElementsKindMask = (-1 << kElementsKindShift) &
5188+
static const int kElementsKindMask =
5189+
(static_cast<unsigned int>(-1) << kElementsKindShift) &
51895190
((1 << (kElementsKindShift + kElementsKindBitCount)) - 1);
51905191
static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>(
51915192
(FAST_ELEMENTS + 1) << Map::kElementsKindShift) - 1;
@@ -7373,8 +7374,8 @@ class String: public HeapObject {
73737374
STATIC_CHECK(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1));
73747375

73757376
static const int kContainsCachedArrayIndexMask =
7376-
(~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) |
7377-
kIsNotArrayIndexMask;
7377+
(static_cast<unsigned int>(~kMaxCachedArrayIndexLength)
7378+
<< kArrayIndexHashLengthShift) | kIsNotArrayIndexMask;
73787379

73797380
// Value of empty hash field indicating that the hash is not computed.
73807381
static const int kEmptyHashField =

deps/v8/src/version.cc

Lines changed: 1 addition & 1 deletion
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 9
38+
#define PATCH_LEVEL 10
3939
// Use 1 for candidates and 0 otherwise.
4040
// (Boolean macro values are not supported by all preprocessors.)
4141
#define IS_CANDIDATE_VERSION 0

0 commit comments

Comments
 (0)