Skip to content

Commit 75e43a6

Browse files
saperCommit bot
authored andcommitted
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}
1 parent 58109a2 commit 75e43a6

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
7070
Luis Reis <luis.m.reis@gmail.com>
7171
Luke Zarko <lukezarko@gmail.com>
7272
Maciej Małecki <me@mmalecki.com>
73+
Marcin Cieślak <saper@marcincieslak.com>
7374
Mathias Bynens <mathias@qiwi.be>
7475
Matt Hanselman <mjhanselman@gmail.com>
7576
Matthew Sporleder <msporleder@gmail.com>

src/runtime/runtime-i18n.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ RUNTIME_FUNCTION(Runtime_CreateBreakIterator) {
626626

627627
local_object->SetInternalField(0, reinterpret_cast<Smi*>(break_iterator));
628628
// Make sure that the pointer to adopted text is NULL.
629-
local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL));
629+
local_object->SetInternalField(1, static_cast<Smi*>(nullptr));
630630

631631
Factory* factory = isolate->factory();
632632
Handle<String> key = factory->NewStringFromStaticChars("breakIterator");

test/cctest/test-heap.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ TEST(HandleNull) {
128128
Isolate* isolate = CcTest::i_isolate();
129129
HandleScope outer_scope(isolate);
130130
LocalContext context;
131-
Handle<Object> n(reinterpret_cast<Object*>(NULL), isolate);
131+
Handle<Object> n(static_cast<Object*>(nullptr), isolate);
132132
CHECK(!n.is_null());
133133
}
134134

@@ -1986,7 +1986,7 @@ TEST(TestAlignmentCalculations) {
19861986
Heap::GetMaximumFillToAlign(kSimd128Unaligned);
19871987
CHECK_EQ(maximum_simd128_misalignment, max_simd128_unaligned_fill);
19881988

1989-
Address base = reinterpret_cast<Address>(NULL);
1989+
Address base = static_cast<Address>(NULL);
19901990
int fill = 0;
19911991

19921992
// Word alignment never requires fill.

0 commit comments

Comments
 (0)