From e743eef448f60941cf96303ea4424f9c42d3ef64 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Fri, 24 Oct 2014 13:21:17 +0000 Subject: [PATCH] only define ARRAYSIZE_UNSAFE for NaCl builds Now that C++11 is allowed, we can use arraysize instead of ARRAYSIZE_UNSAFE, except in NaCl builds. So let's move this macro inside an NaCl ifdef. BUG=chromium:405225 LOG=y R=jochen@chromium.org Review URL: https://codereview.chromium.org/668303002 Patch from Mostyn Bramley-Moore . Cr-Commit-Position: refs/heads/master@{#24875} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24875 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/base/macros.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/base/macros.h b/src/base/macros.h index b8f2a72f0..80a89496a 100644 --- a/src/base/macros.h +++ b/src/base/macros.h @@ -25,6 +25,8 @@ (reinterpret_cast(&(reinterpret_cast(4)->field)) - 4) +#if V8_OS_NACL + // ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize, // but can be used on anonymous types or types defined inside // functions. It's less safe than arraysize as it accepts some @@ -65,9 +67,6 @@ ((sizeof(a) / sizeof(*(a))) / \ static_cast(!(sizeof(a) % sizeof(*(a))))) // NOLINT - -#if V8_OS_NACL - // TODO(bmeurer): For some reason, the NaCl toolchain cannot handle the correct // definition of arraysize() below, so we have to use the unsafe version for // now. -- 2.34.1