Commit b8ede076 authored by Hans Wennborg's avatar Hans Wennborg Committed by Commit Bot

[base] Use __PRETTY_FUNCTION__ unconditionally in notreached.h

Since we use Clang everywhere, we should be able to use it unconditionally.
Anyone using GCC to build should be fine too.

Bug: 1031540
Change-Id: I798586f18dcc7037ca9a8229e072467b8d56b847
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2166189
Commit-Queue: Nico Weber <thakis@chromium.org>
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762860}
parent c63924ce
......@@ -88,11 +88,7 @@ CheckError CheckError::NotImplemented(const char* file,
int line,
const char* function) {
CheckError check_error(new LogMessage(file, line, LOG_ERROR));
if (function) {
check_error.stream() << "Not implemented reached in " << function;
} else {
check_error.stream() << "NOT IMPLEMENTED";
}
check_error.stream() << "Not implemented reached in " << function;
return check_error;
}
......
......@@ -8,7 +8,6 @@
#include "base/strings/string_piece.h"
#include "base/test/gtest_util.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -449,12 +448,8 @@ TEST_F(CheckTest, NotReached) {
}
TEST_F(CheckTest, NotImplemented) {
#if defined(COMPILER_GCC)
static const std::string expected_msg =
std::string("Not implemented reached in ") + __PRETTY_FUNCTION__;
#else
static const std::string expected_msg = "NOT IMPLEMENTED";
#endif
#if DCHECK_IS_ON()
// Expect LOG(ERROR) with streamed params intact.
......@@ -471,15 +466,11 @@ void NiLogOnce() {
}
TEST_F(CheckTest, NotImplementedLogOnce) {
#if defined(COMPILER_GCC)
static const std::string expected_msg =
"Not implemented reached in void (anonymous namespace)::NiLogOnce()\n";
#else
static const std::string expected_msg = "NOT IMPLEMENTED\n";
#endif
#if DCHECK_IS_ON()
EXPECT_LOG_ERROR(expected_msg, NiLogOnce(), __LINE__ - 12);
EXPECT_LOG_ERROR(expected_msg, NiLogOnce(), __LINE__ - 8);
EXPECT_NO_LOG(NiLogOnce());
#else
EXPECT_NO_LOG(NiLogOnce());
......
......@@ -7,7 +7,6 @@
#include "base/check.h"
#include "base/logging_buildflags.h"
#include "build/build_config.h"
namespace logging {
......@@ -24,17 +23,10 @@ void BASE_EXPORT LogErrorNotReached(const char* file, int line);
// implemented yet. If output spam is a serious concern,
// NOTIMPLEMENTED_LOG_ONCE can be used.
#if DCHECK_IS_ON()
#if defined(COMPILER_GCC)
#define NOTIMPLEMENTED() \
::logging::CheckError::NotImplemented(__FILE__, __LINE__, \
__PRETTY_FUNCTION__) \
.stream()
#else
#define NOTIMPLEMENTED() \
::logging::CheckError::NotImplemented(__FILE__, __LINE__, nullptr).stream()
#endif
#else
#define NOTIMPLEMENTED() EAT_CHECK_STREAM_PARAMS()
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment