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

Side by Side Diff: base/logging.h

Issue 2720453003: Hack analysis macros for Windows to avoid compiler bug (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | no next file with comments »
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_LOGGING_H_ 5 #ifndef BASE_LOGGING_H_
6 #define BASE_LOGGING_H_ 6 #define BASE_LOGGING_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <cassert> 10 #include <cassert>
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 #elif defined(_PREFAST_) && defined(OS_WIN) 313 #elif defined(_PREFAST_) && defined(OS_WIN)
314 314
315 // |arg| is a universal reference for compatibility with lvalue and rvalue 315 // |arg| is a universal reference for compatibility with lvalue and rvalue
316 // arguments. 316 // arguments.
317 template <typename TVal> 317 template <typename TVal>
318 inline constexpr TVal&& AnalysisAssumeTrue(TVal&& arg) { 318 inline constexpr TVal&& AnalysisAssumeTrue(TVal&& arg) {
319 __analysis_assume(!!arg); 319 __analysis_assume(!!arg);
320 return std::forward<TVal>(arg); 320 return std::forward<TVal>(arg);
321 } 321 }
322 322
323 #define ANALYZER_ASSUME_TRUE(val) ::logging::AnalysisAssumeTrue(val) 323 // Disable using AnalysisAssumeTrue because of VC++ compiler bug
324 // https://connect.microsoft.com/VisualStudio/feedback/details/3124774
Wez 2017/02/25 00:25:47 This is the same as the no-analysis case, below, s
325 #define ANALYZER_ASSUME_TRUE(val) (val)
324 326
325 #else // !_PREFAST_ & !__clang_analyzer__ 327 #else // !_PREFAST_ & !__clang_analyzer__
326 328
327 #define ANALYZER_ASSUME_TRUE(val) (val) 329 #define ANALYZER_ASSUME_TRUE(val) (val)
328 330
329 #endif // !_PREFAST_ & !__clang_analyzer__ 331 #endif // !_PREFAST_ & !__clang_analyzer__
330 332
331 typedef int LogSeverity; 333 typedef int LogSeverity;
332 const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity 334 const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity
333 // Note: the log severities are used to index into the array of names, 335 // Note: the log severities are used to index into the array of names,
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 #elif NOTIMPLEMENTED_POLICY == 5 1132 #elif NOTIMPLEMENTED_POLICY == 5
1131 #define NOTIMPLEMENTED() do {\ 1133 #define NOTIMPLEMENTED() do {\
1132 static bool logged_once = false;\ 1134 static bool logged_once = false;\
1133 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 1135 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
1134 logged_once = true;\ 1136 logged_once = true;\
1135 } while(0);\ 1137 } while(0);\
1136 EAT_STREAM_PARAMETERS 1138 EAT_STREAM_PARAMETERS
1137 #endif 1139 #endif
1138 1140
1139 #endif // BASE_LOGGING_H_ 1141 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698