summaryrefslogtreecommitdiffstats
path: root/base/mac
diff options
context:
space:
mode:
authorrbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-08 17:56:06 +0000
committerrbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-08 17:56:06 +0000
commit4dcd2e3c23db81f7ff1c6dfec08452660e8fb4f7 (patch)
treeffae7cc1a65861842c4d1d4a58991b1b70fce1ea /base/mac
parentf55912772d8e171c6c7881dba789440ca11fc829 (diff)
downloadchromium_src-4dcd2e3c23db81f7ff1c6dfec08452660e8fb4f7.zip
chromium_src-4dcd2e3c23db81f7ff1c6dfec08452660e8fb4f7.tar.gz
chromium_src-4dcd2e3c23db81f7ff1c6dfec08452660e8fb4f7.tar.bz2
Revert 255755 "Define print format macros for NSInteger & NSUInt..."
Reason for revert: caused unit test failures on Mac ASAN bots, eg: http://build.chromium.org/p/chromium.memory/builders/Mac%20ASan%2064%20Tests%20%281%29/builds/69/steps/base_unittests/logs/FormatNSInteger > Define print format macros for NSInteger & NSUInteger > > The size of NSInteger and NSUInteger varies between 32-bit and 64-bit > architectures, however does not provides macro to safely format them > and instead recommend casting the value to the larger version that is > used on 64-bit architecture. > > Using a cast could cause some formatting to be missed (if the type of > a variable changes), so instead we define our own macros to format those > types safely. > > BUG=349458 > > Review URL: https://codereview.chromium.org/187793003 TBR=sdefresne@chromium.org Review URL: https://codereview.chromium.org/192023002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r--base/mac/foundation_util_unittest.mm67
1 files changed, 0 insertions, 67 deletions
diff --git a/base/mac/foundation_util_unittest.mm b/base/mac/foundation_util_unittest.mm
index 8bb7d0b..3b72b12 100644
--- a/base/mac/foundation_util_unittest.mm
+++ b/base/mac/foundation_util_unittest.mm
@@ -5,12 +5,9 @@
#include "base/mac/foundation_util.h"
#include "base/basictypes.h"
-#include "base/compiler_specific.h"
#include "base/files/file_path.h"
-#include "base/format_macros.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_nsautorelease_pool.h"
-#include "base/strings/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
@@ -317,69 +314,5 @@ TEST(FoundationUtilTest, NSStringToFilePath) {
EXPECT_EQ(FilePath("/a/b"), NSStringToFilePath(@"/a/b"));
}
-TEST(StringNumberConversionsTest, FormatNSInteger) {
- // The PRI[dxu]NS macro assumes that NSInteger is a typedef to "int" on
- // 32-bit architecture and a typedef to "long" on 64-bit architecture
- // (respectively "unsigned int" and "unsigned long" for NSUInteger). Use
- // pointer incompatibility to validate this at compilation.
-#if defined(ARCH_CPU_64_BITS)
- typedef long FormatNSIntegerAsType;
- typedef unsigned long FormatNSUIntegerAsType;
-#else
- typedef int FormatNSIntegerAsType;
- typedef unsigned int FormatNSUIntegerAsType;
-#endif // defined(ARCH_CPU_64_BITS)
-
- NSInteger some_nsinteger;
- FormatNSIntegerAsType* pointer_to_some_nsinteger ALLOW_UNUSED =
- &some_nsinteger;
-
- NSUInteger some_nsuinteger;
- FormatNSUIntegerAsType* pointer_to_some_nsuinteger ALLOW_UNUSED =
- &some_nsuinteger;
-
- // Check that format specifier works correctly for NSInteger.
- const struct {
- NSInteger value;
- const char* expected;
- const char* expected_hex;
- } nsinteger_cases[] = {
- {12345678, "12345678", "bc614e"},
- {-12345678, "-12345678", "ff439eb2"},
-#if defined(ARCH_CPU_64_BITS)
- {137451299150l, "137451299150", "2000bc614e"},
- {-137451299150l, "-137451299150", "ffffffdfff439eb2"},
-#endif
- };
-
- for (size_t i = 0; i < arraysize(nsinteger_cases); ++i) {
- EXPECT_EQ(nsinteger_cases[i].expected,
- StringPrintf("%" PRIdNS, nsinteger_cases[i].value));
- EXPECT_EQ(nsinteger_cases[i].expected_hex,
- StringPrintf("%" PRIxNS, nsinteger_cases[i].value));
- }
-
- // Check that format specifier works correctly for NSUInteger.
- const struct {
- NSUInteger value;
- const char* expected;
- const char* expected_hex;
- } nsuinteger_cases[] = {
- {12345678u, "12345678", "bc614e"},
- {4282621618u, "4282621618", "ff439eb2"},
-#if defined(ARCH_CPU_64_BITS)
- {137451299150ul, "137451299150", "2000bc614e"},
- {18446743936258252466ul, "18446743936258252466", "ffffffdfff439eb2"},
-#endif
- };
-
- for (size_t i = 0; i < arraysize(nsuinteger_cases); ++i) {
- EXPECT_EQ(nsuinteger_cases[i].expected,
- StringPrintf("%" PRIuNS, nsuinteger_cases[i].value));
- EXPECT_EQ(nsuinteger_cases[i].expected_hex,
- StringPrintf("%" PRIxNS, nsuinteger_cases[i].value));
- }
-}
-
} // namespace mac
} // namespace base