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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 LAZY_STREAM(LOG_STREAM(DCHECK), false) \ | 646 LAZY_STREAM(LOG_STREAM(DCHECK), false) \ |
647 << "Check failed: " #condition ". " | 647 << "Check failed: " #condition ". " |
648 | 648 |
649 #define DPCHECK(condition) \ | 649 #define DPCHECK(condition) \ |
650 __analysis_assume(!!(condition)), \ | 650 __analysis_assume(!!(condition)), \ |
651 LAZY_STREAM(PLOG_STREAM(DCHECK), false) \ | 651 LAZY_STREAM(PLOG_STREAM(DCHECK), false) \ |
652 << "Check failed: " #condition ". " | 652 << "Check failed: " #condition ". " |
653 | 653 |
654 #else // _PREFAST_ | 654 #else // _PREFAST_ |
655 | 655 |
656 #define DCHECK(condition) \ | 656 #define DCHECK(condition) \ |
657 LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() ? !(condition) : false) \ | 657 LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \ |
658 << "Check failed: " #condition ". " | 658 << "Check failed: " #condition ". " |
659 | 659 |
660 #define DPCHECK(condition) \ | 660 #define DPCHECK(condition) \ |
661 LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() ? !(condition) : false) \ | 661 LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \ |
662 << "Check failed: " #condition ". " | 662 << "Check failed: " #condition ". " |
663 | 663 |
664 #endif // _PREFAST_ | 664 #endif // _PREFAST_ |
665 | 665 |
666 // Helper macro for binary operators. | 666 // Helper macro for binary operators. |
667 // Don't use this macro directly in your code, use DCHECK_EQ et al below. | 667 // Don't use this macro directly in your code, use DCHECK_EQ et al below. |
668 #define DCHECK_OP(name, op, val1, val2) \ | 668 #define DCHECK_OP(name, op, val1, val2) \ |
669 if (DCHECK_IS_ON()) \ | 669 if (DCHECK_IS_ON()) \ |
670 if (std::string* _result = logging::Check##name##Impl( \ | 670 if (std::string* _result = logging::Check##name##Impl( \ |
671 (val1), (val2), #val1 " " #op " " #val2)) \ | 671 (val1), (val2), #val1 " " #op " " #val2)) \ |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 #elif NOTIMPLEMENTED_POLICY == 5 | 926 #elif NOTIMPLEMENTED_POLICY == 5 |
927 #define NOTIMPLEMENTED() do {\ | 927 #define NOTIMPLEMENTED() do {\ |
928 static bool logged_once = false;\ | 928 static bool logged_once = false;\ |
929 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 929 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
930 logged_once = true;\ | 930 logged_once = true;\ |
931 } while(0);\ | 931 } while(0);\ |
932 EAT_STREAM_PARAMETERS | 932 EAT_STREAM_PARAMETERS |
933 #endif | 933 #endif |
934 | 934 |
935 #endif // BASE_LOGGING_H_ | 935 #endif // BASE_LOGGING_H_ |
OLD | NEW |