Skip to content

Commit

Permalink
v8: fix build errors with g++ 6.1.1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bnoordhuis authored and rvagg committed Sep 27, 2016
1 parent 0d7e21e commit fd8ac56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion deps/v8/src/liveedit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ class Differencer {

static const int kDirectionSizeBits = 2;
static const int kDirectionMask = (1 << kDirectionSizeBits) - 1;
static const int kEmptyCellValue = -1 << kDirectionSizeBits;
static const int kEmptyCellValue =
static_cast<unsigned int>(-1) << kDirectionSizeBits;

// This method only holds static assert statement (unfortunately you cannot
// place one in class scope).
Expand Down
7 changes: 4 additions & 3 deletions deps/v8/src/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -5185,7 +5185,8 @@ class Map: public HeapObject {
static const int kElementsKindBitCount = 5;

// Derived values from bit field 2
static const int kElementsKindMask = (-1 << kElementsKindShift) &
static const int kElementsKindMask =
(static_cast<unsigned int>(-1) << kElementsKindShift) &
((1 << (kElementsKindShift + kElementsKindBitCount)) - 1);
static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>(
(FAST_ELEMENTS + 1) << Map::kElementsKindShift) - 1;
Expand Down Expand Up @@ -7373,8 +7374,8 @@ class String: public HeapObject {
STATIC_CHECK(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1));

static const int kContainsCachedArrayIndexMask =
(~kMaxCachedArrayIndexLength << kArrayIndexHashLengthShift) |
kIsNotArrayIndexMask;
(static_cast<unsigned int>(~kMaxCachedArrayIndexLength)
<< kArrayIndexHashLengthShift) | kIsNotArrayIndexMask;

// Value of empty hash field indicating that the hash is not computed.
static const int kEmptyHashField =
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 14
#define BUILD_NUMBER 5
#define PATCH_LEVEL 9
#define PATCH_LEVEL 10
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
Expand Down

0 comments on commit fd8ac56

Please sign in to comment.