summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-10 02:50:27 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-10 02:50:27 +0000
commitf57f28bc5f898518083c10a05f779e31275b7b31 (patch)
treeb7b5e6053a958a9d870b64131d0c872cd9a60a3d
parentca888139d781d74f3f71391f97ac26e515543d38 (diff)
downloadchromium_src-f57f28bc5f898518083c10a05f779e31275b7b31.zip
chromium_src-f57f28bc5f898518083c10a05f779e31275b7b31.tar.gz
chromium_src-f57f28bc5f898518083c10a05f779e31275b7b31.tar.bz2
Add a NOTIMPLEMENTED() macro to annotate the code paths which need revisiting for the mac/linux port.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@635 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/base.xcodeproj/project.pbxproj4
-rw-r--r--base/build/base.vcproj4
-rw-r--r--base/notimplemented.h70
3 files changed, 78 insertions, 0 deletions
diff --git a/base/base.xcodeproj/project.pbxproj b/base/base.xcodeproj/project.pbxproj
index ee18135..83f82cc 100644
--- a/base/base.xcodeproj/project.pbxproj
+++ b/base/base.xcodeproj/project.pbxproj
@@ -96,6 +96,7 @@
829E31340DBFDB6F00819EBF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 829E31330DBFDB6F00819EBF /* CoreGraphics.framework */; };
829E35D50DC0DC9400819EBF /* logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 825403270D92D2090006B936 /* logging.cc */; };
829E35D60DC0DC9400819EBF /* logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 825403280D92D2090006B936 /* logging.h */; };
+ 829E35D60DC0DC9400819EBF /* notimplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = 825403280D92D2090006B936 /* notimplemented.h */; };
829E35DA0DC0DD0400819EBF /* lock_impl_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BEFC29D0D99832D000829AD /* lock_impl_posix.cc */; };
829E35DB0DC0DD0500819EBF /* lock_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BEFC29C0D99832D000829AD /* lock_impl.h */; };
829E36420DC0F69D00819EBF /* string16.h in Headers */ = {isa = PBXBuildFile; fileRef = 821B91680DAABD7F00F350D7 /* string16.h */; };
@@ -405,6 +406,7 @@
825403260D92D2090006B936 /* lock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lock.h; sourceTree = "<group>"; };
825403270D92D2090006B936 /* logging.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = logging.cc; sourceTree = "<group>"; };
825403280D92D2090006B936 /* logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = logging.h; sourceTree = "<group>"; };
+ 825403280D92D2090006B936 /* notimplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = notimplemented.h; sourceTree = "<group>"; };
825403290D92D2090006B936 /* md5.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = md5.cc; sourceTree = "<group>"; };
8254032A0D92D2090006B936 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
8254032B0D92D2090006B936 /* memory_debug.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = memory_debug.cc; sourceTree = "<group>"; };
@@ -652,6 +654,7 @@
7BEFC29D0D99832D000829AD /* lock_impl_posix.cc */,
825403270D92D2090006B936 /* logging.cc */,
825403280D92D2090006B936 /* logging.h */,
+ 825403280D92D2090006B936 /* notimplemented.h */,
825403290D92D2090006B936 /* md5.cc */,
8254032A0D92D2090006B936 /* md5.h */,
8254032B0D92D2090006B936 /* memory_debug.cc */,
@@ -871,6 +874,7 @@
buildActionMask = 2147483647;
files = (
829E35D60DC0DC9400819EBF /* logging.h in Headers */,
+ 829E35D60DC0DC9400819EBF /* notimplemented.h in Headers */,
829E35DB0DC0DD0500819EBF /* lock_impl.h in Headers */,
829E36420DC0F69D00819EBF /* string16.h in Headers */,
829E36430DC0F69E00819EBF /* string_util_mac.h in Headers */,
diff --git a/base/build/base.vcproj b/base/build/base.vcproj
index 9a732b0..7f362aa 100644
--- a/base/build/base.vcproj
+++ b/base/build/base.vcproj
@@ -426,6 +426,10 @@
>
</File>
<File
+ RelativePath="..\notimplemented.h"
+ >
+ </File>
+ <File
RelativePath="..\object_watcher.cc"
>
</File>
diff --git a/base/notimplemented.h b/base/notimplemented.h
new file mode 100644
index 0000000..3b8b732
--- /dev/null
+++ b/base/notimplemented.h
@@ -0,0 +1,70 @@
+// Copyright 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef BASE_NOTIMPLEMENTED_H_
+#define BASE_NOTIMPLEMENTED_H_
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+
+// 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_NOTIMPLEMENTED_H_