| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <cassert> | 9 #include <cassert> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 | 957 |
| 958 #if defined(COMPILER_GCC) | 958 #if defined(COMPILER_GCC) |
| 959 // On Linux, with GCC, we can use __PRETTY_FUNCTION__ to get the demangled name | 959 // On Linux, with GCC, we can use __PRETTY_FUNCTION__ to get the demangled name |
| 960 // of the current function in the NOTIMPLEMENTED message. | 960 // of the current function in the NOTIMPLEMENTED message. |
| 961 #define NOTIMPLEMENTED_MSG "Not implemented reached in " << __PRETTY_FUNCTION__ | 961 #define NOTIMPLEMENTED_MSG "Not implemented reached in " << __PRETTY_FUNCTION__ |
| 962 #else | 962 #else |
| 963 #define NOTIMPLEMENTED_MSG "NOT IMPLEMENTED" | 963 #define NOTIMPLEMENTED_MSG "NOT IMPLEMENTED" |
| 964 #endif | 964 #endif |
| 965 | 965 |
| 966 #if NOTIMPLEMENTED_POLICY == 0 | 966 #if NOTIMPLEMENTED_POLICY == 0 |
| 967 #define NOTIMPLEMENTED() ; | 967 #define NOTIMPLEMENTED() EAT_STREAM_PARAMETERS |
| 968 #elif NOTIMPLEMENTED_POLICY == 1 | 968 #elif NOTIMPLEMENTED_POLICY == 1 |
| 969 // TODO, figure out how to generate a warning | 969 // TODO, figure out how to generate a warning |
| 970 #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) | 970 #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) |
| 971 #elif NOTIMPLEMENTED_POLICY == 2 | 971 #elif NOTIMPLEMENTED_POLICY == 2 |
| 972 #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) | 972 #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) |
| 973 #elif NOTIMPLEMENTED_POLICY == 3 | 973 #elif NOTIMPLEMENTED_POLICY == 3 |
| 974 #define NOTIMPLEMENTED() NOTREACHED() | 974 #define NOTIMPLEMENTED() NOTREACHED() |
| 975 #elif NOTIMPLEMENTED_POLICY == 4 | 975 #elif NOTIMPLEMENTED_POLICY == 4 |
| 976 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG | 976 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG |
| 977 #elif NOTIMPLEMENTED_POLICY == 5 | 977 #elif NOTIMPLEMENTED_POLICY == 5 |
| 978 #define NOTIMPLEMENTED() do {\ | 978 #define NOTIMPLEMENTED() do {\ |
| 979 static int count = 0;\ | 979 static int count = 0;\ |
| 980 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\ | 980 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\ |
| 981 } while(0) | 981 } while(0) |
| 982 #endif | 982 #endif |
| 983 | 983 |
| 984 namespace base { | 984 namespace base { |
| 985 | 985 |
| 986 template <typename STRING_TYPE> class BasicStringPiece; | 986 template <typename STRING_TYPE> class BasicStringPiece; |
| 987 typedef BasicStringPiece<std::string> StringPiece; | 987 typedef BasicStringPiece<std::string> StringPiece; |
| 988 | 988 |
| 989 // Allows StringPiece to be logged. | 989 // Allows StringPiece to be logged. |
| 990 BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); | 990 BASE_EXPORT std::ostream& operator<<(std::ostream& o, const StringPiece& piece); |
| 991 | 991 |
| 992 } // namespace base | 992 } // namespace base |
| 993 | 993 |
| 994 #endif // BASE_LOGGING_H_ | 994 #endif // BASE_LOGGING_H_ |
| OLD | NEW |