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 <cassert> | 8 #include <cassert> |
9 #include <string> | 9 #include <string> |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 // CHECK dies with a fatal error if condition is not true. It is *not* | 429 // CHECK dies with a fatal error if condition is not true. It is *not* |
430 // controlled by NDEBUG, so the check will be executed regardless of | 430 // controlled by NDEBUG, so the check will be executed regardless of |
431 // compilation mode. | 431 // compilation mode. |
432 // | 432 // |
433 // We make sure CHECK et al. always evaluates their arguments, as | 433 // We make sure CHECK et al. always evaluates their arguments, as |
434 // doing CHECK(FunctionWithSideEffect()) is a common idiom. | 434 // doing CHECK(FunctionWithSideEffect()) is a common idiom. |
435 | 435 |
436 #if defined(OFFICIAL_BUILD) && defined(NDEBUG) && !defined(OS_ANDROID) | 436 #if defined(OFFICIAL_BUILD) && defined(NDEBUG) && !defined(OS_ANDROID) |
437 | 437 |
438 // Make all CHECK functions discard their log strings to reduce code | 438 // Make all CHECK functions discard their log strings to reduce code |
439 // bloat for official release builds. | 439 // bloat for official release builds (except Android). |
440 | 440 |
441 // TODO(akalin): This would be more valuable if there were some way to | 441 // TODO(akalin): This would be more valuable if there were some way to |
442 // remove BreakDebugger() from the backtrace, perhaps by turning it | 442 // remove BreakDebugger() from the backtrace, perhaps by turning it |
443 // into a macro (like __debugbreak() on Windows). | 443 // into a macro (like __debugbreak() on Windows). |
444 #define CHECK(condition) \ | 444 #define CHECK(condition) \ |
445 !(condition) ? ::base::debug::BreakDebugger() : EAT_STREAM_PARAMETERS | 445 !(condition) ? ::base::debug::BreakDebugger() : EAT_STREAM_PARAMETERS |
446 | 446 |
447 #define PCHECK(condition) CHECK(condition) | 447 #define PCHECK(condition) CHECK(condition) |
448 | 448 |
449 #define CHECK_OP(name, op, val1, val2) CHECK((val1) op (val2)) | 449 #define CHECK_OP(name, op, val1, val2) CHECK((val1) op (val2)) |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 #elif NOTIMPLEMENTED_POLICY == 5 | 930 #elif NOTIMPLEMENTED_POLICY == 5 |
931 #define NOTIMPLEMENTED() do {\ | 931 #define NOTIMPLEMENTED() do {\ |
932 static bool logged_once = false;\ | 932 static bool logged_once = false;\ |
933 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 933 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
934 logged_once = true;\ | 934 logged_once = true;\ |
935 } while(0);\ | 935 } while(0);\ |
936 EAT_STREAM_PARAMETERS | 936 EAT_STREAM_PARAMETERS |
937 #endif | 937 #endif |
938 | 938 |
939 #endif // BASE_LOGGING_H_ | 939 #endif // BASE_LOGGING_H_ |
OLD | NEW |