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

Side by Side Diff: base/compiler_specific.h

Issue 650393002: Modify ALLOW_UNUSED to allow enabling unused local warnings on MSVC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extraneous use Created 6 years, 2 months 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 | « no previous file | base/logging_unittest.cc » ('j') | base/logging_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef BASE_COMPILER_SPECIFIC_H_ 5 #ifndef BASE_COMPILER_SPECIFIC_H_
6 #define BASE_COMPILER_SPECIFIC_H_ 6 #define BASE_COMPILER_SPECIFIC_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(COMPILER_MSVC) 10 #if defined(COMPILER_MSVC)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #if defined(COMPILER_MSVC) 87 #if defined(COMPILER_MSVC)
88 #define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany) 88 #define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany)
89 #else 89 #else
90 #define STATIC_CONST_MEMBER_DEFINITION 90 #define STATIC_CONST_MEMBER_DEFINITION
91 #endif 91 #endif
92 92
93 // Annotate a variable indicating it's ok if the variable is not used. 93 // Annotate a variable indicating it's ok if the variable is not used.
94 // (Typically used to silence a compiler warning when the assignment 94 // (Typically used to silence a compiler warning when the assignment
95 // is important for some other reason.) 95 // is important for some other reason.)
96 // Use like: 96 // Use like:
97 // int x ALLOW_UNUSED = ...; 97 // int x = ...;
98 // ALLOW_UNUSED_LOCAL(x);
99 #define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
100
101 // Annotate a typedef or function indicating it's ok if it's not used.
102 // Use like:
103 // typedef Foo Bar ALLOW_UNUSED_TYPE;
98 #if defined(COMPILER_GCC) 104 #if defined(COMPILER_GCC)
99 #define ALLOW_UNUSED __attribute__((unused)) 105 #define ALLOW_UNUSED_TYPE __attribute__((unused))
100 #else 106 #else
101 #define ALLOW_UNUSED 107 #define ALLOW_UNUSED_TYPE
102 #endif 108 #endif
103 109
104 // Annotate a function indicating it should not be inlined. 110 // Annotate a function indicating it should not be inlined.
105 // Use like: 111 // Use like:
106 // NOINLINE void DoStuff() { ... } 112 // NOINLINE void DoStuff() { ... }
107 #if defined(COMPILER_GCC) 113 #if defined(COMPILER_GCC)
108 #define NOINLINE __attribute__((noinline)) 114 #define NOINLINE __attribute__((noinline))
109 #elif defined(COMPILER_MSVC) 115 #elif defined(COMPILER_MSVC)
110 #define NOINLINE __declspec(noinline) 116 #define NOINLINE __declspec(noinline)
111 #else 117 #else
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // Macro for hinting that an expression is likely to be false. 205 // Macro for hinting that an expression is likely to be false.
200 #if !defined(UNLIKELY) 206 #if !defined(UNLIKELY)
201 #if defined(COMPILER_GCC) 207 #if defined(COMPILER_GCC)
202 #define UNLIKELY(x) __builtin_expect(!!(x), 0) 208 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
203 #else 209 #else
204 #define UNLIKELY(x) (x) 210 #define UNLIKELY(x) (x)
205 #endif // defined(COMPILER_GCC) 211 #endif // defined(COMPILER_GCC)
206 #endif // !defined(UNLIKELY) 212 #endif // !defined(UNLIKELY)
207 213
208 #endif // BASE_COMPILER_SPECIFIC_H_ 214 #endif // BASE_COMPILER_SPECIFIC_H_
OLDNEW
« no previous file with comments | « no previous file | base/logging_unittest.cc » ('j') | base/logging_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698