| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 8 #include <string> |
| 9 #include <cstring> | 9 #include <cstring> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 // 2 -- Fail at compile time | 506 // 2 -- Fail at compile time |
| 507 // 3 -- Fail at runtime (DCHECK) | 507 // 3 -- Fail at runtime (DCHECK) |
| 508 // 4 -- [default] LOG(ERROR) at runtime | 508 // 4 -- [default] LOG(ERROR) at runtime |
| 509 // 5 -- LOG(ERROR) at runtime, only once per call-site | 509 // 5 -- LOG(ERROR) at runtime, only once per call-site |
| 510 | 510 |
| 511 #ifndef NOTIMPLEMENTED_POLICY | 511 #ifndef NOTIMPLEMENTED_POLICY |
| 512 // Select default policy: LOG(ERROR) | 512 // Select default policy: LOG(ERROR) |
| 513 #define NOTIMPLEMENTED_POLICY 4 | 513 #define NOTIMPLEMENTED_POLICY 4 |
| 514 #endif | 514 #endif |
| 515 | 515 |
| 516 #if defined(COMPILER_GCC) |
| 517 // On Linux, with GCC, we can use __PRETTY_FUNCTION__ to get the demangled name |
| 518 // of the current function in the NOTIMPLEMENTED message. |
| 519 #define NOTIMPLEMENTED_MSG "Not implemented reached in " << __PRETTY_FUNCTION__ |
| 520 #else |
| 521 #define NOTIMPLEMENTED_MSG "NOT IMPLEMENTED" |
| 522 #endif |
| 523 |
| 516 #if NOTIMPLEMENTED_POLICY == 0 | 524 #if NOTIMPLEMENTED_POLICY == 0 |
| 517 #define NOTIMPLEMENTED() ; | 525 #define NOTIMPLEMENTED() ; |
| 518 #elif NOTIMPLEMENTED_POLICY == 1 | 526 #elif NOTIMPLEMENTED_POLICY == 1 |
| 519 // TODO, figure out how to generate a warning | 527 // TODO, figure out how to generate a warning |
| 520 #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) | 528 #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) |
| 521 #elif NOTIMPLEMENTED_POLICY == 2 | 529 #elif NOTIMPLEMENTED_POLICY == 2 |
| 522 #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) | 530 #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) |
| 523 #elif NOTIMPLEMENTED_POLICY == 3 | 531 #elif NOTIMPLEMENTED_POLICY == 3 |
| 524 #define NOTIMPLEMENTED() NOTREACHED() | 532 #define NOTIMPLEMENTED() NOTREACHED() |
| 525 #elif NOTIMPLEMENTED_POLICY == 4 | 533 #elif NOTIMPLEMENTED_POLICY == 4 |
| 526 #define NOTIMPLEMENTED() LOG(ERROR) << "NOT IMPLEMENTED!" | 534 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG |
| 527 #elif NOTIMPLEMENTED_POLICY == 5 | 535 #elif NOTIMPLEMENTED_POLICY == 5 |
| 528 #define NOTIMPLEMENTED() do {\ | 536 #define NOTIMPLEMENTED() do {\ |
| 529 static int count = 0;\ | 537 static int count = 0;\ |
| 530 LOG_IF(ERROR, 0 == count++) << "NOT IMPLEMENTED!";\ | 538 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\ |
| 531 } while(0) | 539 } while(0) |
| 532 #endif | 540 #endif |
| 533 | 541 |
| 534 #endif // BASE_LOGGING_H_ | 542 #endif // BASE_LOGGING_H_ |
| 535 | 543 |
| OLD | NEW |