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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 582 |
583 // Helper functions for CHECK_OP macro. | 583 // Helper functions for CHECK_OP macro. |
584 // The (int, int) specialization works around the issue that the compiler | 584 // The (int, int) specialization works around the issue that the compiler |
585 // will not instantiate the template version of the function on values of | 585 // will not instantiate the template version of the function on values of |
586 // unnamed enum type - see comment below. | 586 // unnamed enum type - see comment below. |
587 #define DEFINE_CHECK_OP_IMPL(name, op) \ | 587 #define DEFINE_CHECK_OP_IMPL(name, op) \ |
588 template <class t1, class t2> \ | 588 template <class t1, class t2> \ |
589 inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \ | 589 inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \ |
590 const char* names) { \ | 590 const char* names) { \ |
591 if (v1 op v2) return NULL; \ | 591 if (v1 op v2) return NULL; \ |
592 else return MakeCheckOpString(v1, v2, names); \ | 592 else return ::logging::MakeCheckOpString(v1, v2, names); \ |
593 } \ | 593 } \ |
594 inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \ | 594 inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \ |
595 if (v1 op v2) return NULL; \ | 595 if (v1 op v2) return NULL; \ |
596 else return MakeCheckOpString(v1, v2, names); \ | 596 else return ::logging::MakeCheckOpString(v1, v2, names); \ |
597 } | 597 } |
598 DEFINE_CHECK_OP_IMPL(EQ, ==) | 598 DEFINE_CHECK_OP_IMPL(EQ, ==) |
599 DEFINE_CHECK_OP_IMPL(NE, !=) | 599 DEFINE_CHECK_OP_IMPL(NE, !=) |
600 DEFINE_CHECK_OP_IMPL(LE, <=) | 600 DEFINE_CHECK_OP_IMPL(LE, <=) |
601 DEFINE_CHECK_OP_IMPL(LT, < ) | 601 DEFINE_CHECK_OP_IMPL(LT, < ) |
602 DEFINE_CHECK_OP_IMPL(GE, >=) | 602 DEFINE_CHECK_OP_IMPL(GE, >=) |
603 DEFINE_CHECK_OP_IMPL(GT, > ) | 603 DEFINE_CHECK_OP_IMPL(GT, > ) |
604 #undef DEFINE_CHECK_OP_IMPL | 604 #undef DEFINE_CHECK_OP_IMPL |
605 | 605 |
606 #define CHECK_EQ(val1, val2) CHECK_OP(EQ, ==, val1, val2) | 606 #define CHECK_EQ(val1, val2) CHECK_OP(EQ, ==, val1, val2) |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 #elif NOTIMPLEMENTED_POLICY == 5 | 988 #elif NOTIMPLEMENTED_POLICY == 5 |
989 #define NOTIMPLEMENTED() do {\ | 989 #define NOTIMPLEMENTED() do {\ |
990 static bool logged_once = false;\ | 990 static bool logged_once = false;\ |
991 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 991 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
992 logged_once = true;\ | 992 logged_once = true;\ |
993 } while(0);\ | 993 } while(0);\ |
994 EAT_STREAM_PARAMETERS | 994 EAT_STREAM_PARAMETERS |
995 #endif | 995 #endif |
996 | 996 |
997 #endif // BASE_LOGGING_H_ | 997 #endif // BASE_LOGGING_H_ |
OLD | NEW |