From ba891a10252aed4b746b59db5b6bfc453148fd07 Mon Sep 17 00:00:00 2001 From: Sameer Agarwal Date: Thu, 5 Jan 2017 11:21:00 -0800 Subject: [PATCH] Add an ifdef around the use of google::GLOG_WARNING MSVC requires using google::GLOG_WARNING, but this breaks the build inside google. So add a MSVC specific ifdef to guard against it. Change-Id: I3509bb3fd2c01722a1c76545b57d2bf0224f6d6e --- internal/ceres/levenberg_marquardt_strategy_test.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/ceres/levenberg_marquardt_strategy_test.cc b/internal/ceres/levenberg_marquardt_strategy_test.cc index 950ca23b0..86054fde8 100644 --- a/internal/ceres/levenberg_marquardt_strategy_test.cc +++ b/internal/ceres/levenberg_marquardt_strategy_test.cc @@ -145,10 +145,19 @@ TEST(LevenbergMarquardtStrategy, CorrectDiagonalToLinearSolver) { { ScopedMockLog log; EXPECT_CALL(log, Log(_, _, _)).Times(AnyNumber()); + // This using directive is needed get around the fact that there + // are versions of glog which are not in the google namespace. + using namespace google; + +#if defined(_MSC_VER) // Use GLOG_WARNING to support MSVC if GLOG_NO_ABBREVIATED_SEVERITIES // is defined. - EXPECT_CALL(log, Log(google::GLOG_WARNING, _, + EXPECT_CALL(log, Log(GLOG_WARNING, _, HasSubstr("Failed to compute a step"))); +#else + EXPECT_CALL(log, Log(WARNING, _, + HasSubstr("Failed to compute a step"))); +#endif TrustRegionStrategy::Summary summary = lms.ComputeStep(pso, &dsm, &residual, x);