Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: mojo/public/cpp/system/tests/macros_unittest.cc

Issue 731373002: Enable MSVC warning for unused locals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another Windows fix Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.cc ('k') | net/base/file_stream_context_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This file tests the C++ Mojo system macros and consists of "positive" tests, 5 // This file tests the C++ Mojo system macros and consists of "positive" tests,
6 // i.e., those verifying that things work (without compile errors, or even 6 // i.e., those verifying that things work (without compile errors, or even
7 // warnings if warnings are treated as errors). 7 // warnings if warnings are treated as errors).
8 // TODO(vtl): Maybe rename "MacrosCppTest" -> "MacrosTest" if/when this gets 8 // TODO(vtl): Maybe rename "MacrosCppTest" -> "MacrosTest" if/when this gets
9 // compiled into a different binary from the C API tests. 9 // compiled into a different binary from the C API tests.
10 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388) 10 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 y.NoOp(); 60 y.NoOp();
61 } 61 }
62 62
63 // Test that |MOJO_ARRAYSIZE()| works in a |static_assert()|. 63 // Test that |MOJO_ARRAYSIZE()| works in a |static_assert()|.
64 const int kGlobalArray[5] = {1, 2, 3, 4, 5}; 64 const int kGlobalArray[5] = {1, 2, 3, 4, 5};
65 static_assert(MOJO_ARRAYSIZE(kGlobalArray) == 5u, 65 static_assert(MOJO_ARRAYSIZE(kGlobalArray) == 5u,
66 "MOJO_ARRAY_SIZE() failed in static_assert()"); 66 "MOJO_ARRAY_SIZE() failed in static_assert()");
67 67
68 TEST(MacrosCppTest, ArraySize) { 68 TEST(MacrosCppTest, ArraySize) {
69 double local_array[4] = {6.7, 7.8, 8.9, 9.0}; 69 double local_array[4] = {6.7, 7.8, 8.9, 9.0};
70 MOJO_ALLOW_UNUSED_LOCAL(local_array);
70 EXPECT_EQ(4u, MOJO_ARRAYSIZE(local_array)); 71 EXPECT_EQ(4u, MOJO_ARRAYSIZE(local_array));
71 } 72 }
72 73
73 // Note: MSVS is very strict (and arguably buggy) about warnings for classes 74 // Note: MSVS is very strict (and arguably buggy) about warnings for classes
74 // defined in a local scope, so define these globally. 75 // defined in a local scope, so define these globally.
75 class MoveOnlyInt { 76 class MoveOnlyInt {
76 MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(MoveOnlyInt, RValue) 77 MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(MoveOnlyInt, RValue)
77 78
78 public: 79 public:
79 MoveOnlyInt() : is_set_(false), value_() {} 80 MoveOnlyInt() : is_set_(false), value_() {}
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 EXPECT_FALSE(y.is_set()); 117 EXPECT_FALSE(y.is_set());
117 EXPECT_TRUE(z.is_set()); 118 EXPECT_TRUE(z.is_set());
118 EXPECT_EQ(123, z.value()); 119 EXPECT_EQ(123, z.value());
119 z = z.Pass(); 120 z = z.Pass();
120 EXPECT_TRUE(z.is_set()); 121 EXPECT_TRUE(z.is_set());
121 EXPECT_EQ(123, z.value()); 122 EXPECT_EQ(123, z.value());
122 } 123 }
123 124
124 } // namespace 125 } // namespace
125 } // namespace mojo 126 } // namespace mojo
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.cc ('k') | net/base/file_stream_context_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698