1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_NOTREACHED_H_
6 #define BASE_NOTREACHED_H_
8 #include "base/base_export.h"
9 #include "base/check.h"
10 #include "base/dcheck_is_on.h"
11 #include "base/logging_buildflags.h"
15 // Under these conditions NOTREACHED() will effectively either log or DCHECK.
16 #if BUILDFLAG(ENABLE_LOG_ERROR_NOT_REACHED) || DCHECK_IS_ON()
17 #define NOTREACHED() \
19 ::logging::CheckError::NotReached(__FILE__, __LINE__).stream(), true)
21 #define NOTREACHED() EAT_CHECK_STREAM_PARAMS()
22 #endif // BUILDFLAG(ENABLE_LOG_ERROR_NOT_REACHED) || DCHECK_IS_ON()
24 // The NOTIMPLEMENTED() macro annotates codepaths which have not been
25 // implemented yet. If output spam is a serious concern,
26 // NOTIMPLEMENTED_LOG_ONCE can be used.
28 #define NOTIMPLEMENTED() \
29 ::logging::CheckError::NotImplemented(__FILE__, __LINE__, \
30 __PRETTY_FUNCTION__) \
33 #define NOTIMPLEMENTED() EAT_CHECK_STREAM_PARAMS()
36 #define NOTIMPLEMENTED_LOG_ONCE() \
38 static bool logged_once = false; \
44 EAT_CHECK_STREAM_PARAMS()
46 } // namespace logging
48 #endif // BASE_NOTREACHED_H_