Chromium Code Reviews| 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 #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 Loading... | |
| 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 Loading... | |
| 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_ |
| OLD | NEW |