// implementation.
// These tests depend on |int32_t| and |int64_t| having nontrivial alignment.
- MOJO_COMPILE_ASSERT(MOJO_ALIGNOF(int32_t) != 1,
- int32_t_does_not_have_to_be_aligned);
- MOJO_COMPILE_ASSERT(MOJO_ALIGNOF(int64_t) != 1,
- int64_t_does_not_have_to_be_aligned);
+ static_assert(MOJO_ALIGNOF(int32_t) != 1,
+ "int32_t does not require nontrivial alignment");
+ static_assert(MOJO_ALIGNOF(int64_t) != 1,
+ "int64_t does not require nontrivial alignment");
// Null:
{
- UserPointer<char> ptr(NULL);
+ UserPointer<char> ptr(nullptr);
char array[5] = {};
EXPECT_DEATH_IF_SUPPORTED(ptr.Check(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.Get(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.PutArray(array, 5), kMemoryCheckFailedRegex);
}
{
- UserPointer<int32_t> ptr(NULL);
+ UserPointer<int32_t> ptr(nullptr);
int32_t array[5] = {};
EXPECT_DEATH_IF_SUPPORTED(ptr.Check(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.Get(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.PutArray(array, 5), kMemoryCheckFailedRegex);
}
{
- UserPointer<int64_t> ptr(NULL);
+ UserPointer<int64_t> ptr(nullptr);
int64_t array[5] = {};
EXPECT_DEATH_IF_SUPPORTED(ptr.Check(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.Get(), kMemoryCheckFailedRegex);
}
// Also check a const pointer:
{
- UserPointer<const int32_t> ptr(NULL);
+ UserPointer<const int32_t> ptr(nullptr);
int32_t array[5] = {};
EXPECT_DEATH_IF_SUPPORTED(ptr.Check(), kMemoryCheckFailedRegex);
EXPECT_DEATH_IF_SUPPORTED(ptr.Get(), kMemoryCheckFailedRegex);