license.bot | f003cfe | 2008-08-24 09:55:55 +0900 | [diff] [blame^] | 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
|
| 3 | // found in the LICENSE file.
|
| 4 |
|
| 5 | #ifndef BASE_NOTIMPLEMENTED_H_
|
| 6 | #define BASE_NOTIMPLEMENTED_H_
|
| 7 |
|
| 8 | #include "base/basictypes.h"
|
| 9 | #include "base/logging.h"
|
| 10 |
|
| 11 | // The NOTIMPLEMENTED() macro annotates codepaths which have
|
| 12 | // not been implemented yet.
|
| 13 | //
|
| 14 | // The implementation of this macro is controlled by NOTIMPLEMENTED_POLICY:
|
| 15 | // 0 -- Do nothing (stripped by compiler)
|
| 16 | // 1 -- Warn at compile time
|
| 17 | // 2 -- Fail at compile time
|
| 18 | // 3 -- Fail at runtime (DCHECK)
|
| 19 | // 4 -- [default] LOG(ERROR) at runtime
|
| 20 | // 5 -- LOG(ERROR) at runtime, only once per call-site
|
| 21 |
|
| 22 | #ifndef NOTIMPLEMENTED_POLICY
|
| 23 | // Select default policy: LOG(ERROR)
|
| 24 | #define NOTIMPLEMENTED_POLICY 4
|
| 25 | #endif
|
| 26 |
|
| 27 | #if NOTIMPLEMENTED_POLICY == 0
|
| 28 | #define NOTIMPLEMENTED() ;
|
| 29 | #elif NOTIMPLEMENTED_POLICY == 1
|
| 30 | // TODO, figure out how to generate a warning
|
| 31 | #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED)
|
| 32 | #elif NOTIMPLEMENTED_POLICY == 2
|
| 33 | #define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED)
|
| 34 | #elif NOTIMPLEMENTED_POLICY == 3
|
| 35 | #define NOTIMPLEMENTED() NOTREACHED()
|
| 36 | #elif NOTIMPLEMENTED_POLICY == 4
|
| 37 | #define NOTIMPLEMENTED() LOG(ERROR) << "NOT IMPLEMENTED!"
|
| 38 | #elif NOTIMPLEMENTED_POLICY == 5
|
| 39 | #define NOTIMPLEMENTED() do {\
|
| 40 | static int count = 0;\
|
| 41 | LOG_IF(ERROR, 0 == count++) << "NOT IMPLEMENTED!";\
|
| 42 | } while(0)
|
| 43 | #endif
|
| 44 |
|
| 45 | #endif // BASE_NOTIMPLEMENTED_H_
|
| 46 |
|