diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-25 03:44:40 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-25 03:44:40 +0000 |
commit | 0dfc81bbe403cd98f4cd2d58e7817cdc8a881a5f (patch) | |
tree | e78c0118849d836de89315d25ad3980a10fea171 /base/logging.h | |
parent | 42be0ca594ed7980c7ee73ef04919cd890463e9a (diff) | |
download | chromium_src-0dfc81bbe403cd98f4cd2d58e7817cdc8a881a5f.zip chromium_src-0dfc81bbe403cd98f4cd2d58e7817cdc8a881a5f.tar.gz chromium_src-0dfc81bbe403cd98f4cd2d58e7817cdc8a881a5f.tar.bz2 |
Move NOTIMPLEMENTED() macro from "base/notimplemented.h" into "base/logging.h".
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/logging.h')
-rw-r--r-- | base/logging.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/base/logging.h b/base/logging.h index 168bc32..95cbfac 100644 --- a/base/logging.h +++ b/base/logging.h @@ -497,5 +497,39 @@ inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) { return out << wstr.c_str(); } +// The NOTIMPLEMENTED() macro annotates codepaths which have +// not been implemented yet. +// +// The implementation of this macro is controlled by NOTIMPLEMENTED_POLICY: +// 0 -- Do nothing (stripped by compiler) +// 1 -- Warn at compile time +// 2 -- Fail at compile time +// 3 -- Fail at runtime (DCHECK) +// 4 -- [default] LOG(ERROR) at runtime +// 5 -- LOG(ERROR) at runtime, only once per call-site + +#ifndef NOTIMPLEMENTED_POLICY +// Select default policy: LOG(ERROR) +#define NOTIMPLEMENTED_POLICY 4 +#endif + +#if NOTIMPLEMENTED_POLICY == 0 +#define NOTIMPLEMENTED() ; +#elif NOTIMPLEMENTED_POLICY == 1 +// TODO, figure out how to generate a warning +#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) +#elif NOTIMPLEMENTED_POLICY == 2 +#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) +#elif NOTIMPLEMENTED_POLICY == 3 +#define NOTIMPLEMENTED() NOTREACHED() +#elif NOTIMPLEMENTED_POLICY == 4 +#define NOTIMPLEMENTED() LOG(ERROR) << "NOT IMPLEMENTED!" +#elif NOTIMPLEMENTED_POLICY == 5 +#define NOTIMPLEMENTED() do {\ + static int count = 0;\ + LOG_IF(ERROR, 0 == count++) << "NOT IMPLEMENTED!";\ +} while(0) +#endif + #endif // BASE_LOGGING_H_ |