OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/mac/foundation_util.h" | 5 #include "base/mac/foundation_util.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // pointer incompatibility to validate this at compilation. | 324 // pointer incompatibility to validate this at compilation. |
325 #if defined(ARCH_CPU_64_BITS) | 325 #if defined(ARCH_CPU_64_BITS) |
326 typedef long FormatNSIntegerAsType; | 326 typedef long FormatNSIntegerAsType; |
327 typedef unsigned long FormatNSUIntegerAsType; | 327 typedef unsigned long FormatNSUIntegerAsType; |
328 #else | 328 #else |
329 typedef int FormatNSIntegerAsType; | 329 typedef int FormatNSIntegerAsType; |
330 typedef unsigned int FormatNSUIntegerAsType; | 330 typedef unsigned int FormatNSUIntegerAsType; |
331 #endif // defined(ARCH_CPU_64_BITS) | 331 #endif // defined(ARCH_CPU_64_BITS) |
332 | 332 |
333 NSInteger some_nsinteger; | 333 NSInteger some_nsinteger; |
334 FormatNSIntegerAsType* pointer_to_some_nsinteger ALLOW_UNUSED = | 334 FormatNSIntegerAsType* pointer_to_some_nsinteger = &some_nsinteger; |
335 &some_nsinteger; | 335 ALLOW_UNUSED_LOCAL(pointer_to_some_nsinteger); |
336 | 336 |
337 NSUInteger some_nsuinteger; | 337 NSUInteger some_nsuinteger; |
338 FormatNSUIntegerAsType* pointer_to_some_nsuinteger ALLOW_UNUSED = | 338 FormatNSUIntegerAsType* pointer_to_some_nsuinteger = &some_nsuinteger; |
339 &some_nsuinteger; | 339 ALLOW_UNUSED_LOCAL(pointer_to_some_nsuinteger); |
340 | 340 |
341 // Check that format specifier works correctly for NSInteger. | 341 // Check that format specifier works correctly for NSInteger. |
342 const struct { | 342 const struct { |
343 NSInteger value; | 343 NSInteger value; |
344 const char* expected; | 344 const char* expected; |
345 const char* expected_hex; | 345 const char* expected_hex; |
346 } nsinteger_cases[] = { | 346 } nsinteger_cases[] = { |
347 #if !defined(ARCH_CPU_64_BITS) | 347 #if !defined(ARCH_CPU_64_BITS) |
348 {12345678, "12345678", "bc614e"}, | 348 {12345678, "12345678", "bc614e"}, |
349 {-12345678, "-12345678", "ff439eb2"}, | 349 {-12345678, "-12345678", "ff439eb2"}, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 for (size_t i = 0; i < arraysize(nsuinteger_cases); ++i) { | 382 for (size_t i = 0; i < arraysize(nsuinteger_cases); ++i) { |
383 EXPECT_EQ(nsuinteger_cases[i].expected, | 383 EXPECT_EQ(nsuinteger_cases[i].expected, |
384 StringPrintf("%" PRIuNS, nsuinteger_cases[i].value)); | 384 StringPrintf("%" PRIuNS, nsuinteger_cases[i].value)); |
385 EXPECT_EQ(nsuinteger_cases[i].expected_hex, | 385 EXPECT_EQ(nsuinteger_cases[i].expected_hex, |
386 StringPrintf("%" PRIxNS, nsuinteger_cases[i].value)); | 386 StringPrintf("%" PRIxNS, nsuinteger_cases[i].value)); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 } // namespace mac | 390 } // namespace mac |
391 } // namespace base | 391 } // namespace base |
OLD | NEW |