Use static_cast<> for NULL (clang 3.7)

The following errors come up when compiling v8
 with clang 3.7 on FreeBSD/amd64:

src/runtime/runtime-i18n.cc:629:37: error: reinterpret_cast from
'nullptr_t' to 'v8::internal::Smi *' is not allowed
  local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL));
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

test/cctest/test-heap.cc:131:20: error: reinterpret_cast from
      'nullptr_t' to 'v8::internal::Object *' is not allowed
  Handle<Object> n(reinterpret_cast<Object*>(NULL), isolate);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test/cctest/test-heap.cc:1989:18: error: reinterpret_cast from
      'nullptr_t' to 'Address' (aka 'unsigned char *') is not
      allowed
  Address base = reinterpret_cast<Address>(NULL);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+add myself to the AUTHORS file.

BUG=

Review URL: https://codereview.chromium.org/1277353002

Cr-Commit-Position: refs/heads/master@{#30103}
This commit is contained in:
saper 2015-08-11 00:48:49 -07:00 committed by Commit bot
parent 58109a2c50
commit 75e43a6681
3 changed files with 4 additions and 3 deletions

View File

@ -70,6 +70,7 @@ Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
Luis Reis <luis.m.reis@gmail.com>
Luke Zarko <lukezarko@gmail.com>
Maciej Małecki <me@mmalecki.com>
Marcin Cieślak <saper@marcincieslak.com>
Mathias Bynens <mathias@qiwi.be>
Matt Hanselman <mjhanselman@gmail.com>
Matthew Sporleder <msporleder@gmail.com>

View File

@ -626,7 +626,7 @@ RUNTIME_FUNCTION(Runtime_CreateBreakIterator) {
local_object->SetInternalField(0, reinterpret_cast<Smi*>(break_iterator));
// Make sure that the pointer to adopted text is NULL.
local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL));
local_object->SetInternalField(1, static_cast<Smi*>(nullptr));
Factory* factory = isolate->factory();
Handle<String> key = factory->NewStringFromStaticChars("breakIterator");

View File

@ -128,7 +128,7 @@ TEST(HandleNull) {
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
LocalContext context;
Handle<Object> n(reinterpret_cast<Object*>(NULL), isolate);
Handle<Object> n(static_cast<Object*>(nullptr), isolate);
CHECK(!n.is_null());
}
@ -1986,7 +1986,7 @@ TEST(TestAlignmentCalculations) {
Heap::GetMaximumFillToAlign(kSimd128Unaligned);
CHECK_EQ(maximum_simd128_misalignment, max_simd128_unaligned_fill);
Address base = reinterpret_cast<Address>(NULL);
Address base = static_cast<Address>(NULL);
int fill = 0;
// Word alignment never requires fill.