Compile error in EXPECT_EQ() of bools (simple Chrome workflow)

291 views
Skip to first unread message

Simon Que

unread,
Feb 17, 2016, 4:09:09 PM2/17/16
to Chromium-dev
I'm trying to build unit_tests using the simple Chrome workflow: http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/building-chromium-browser

I am getting a compile error on this line in chrome/common/chrome_content_client_unittest.cc:
162:    EXPECT_EQ(false, most_recent->is_debug);

It is having trouble resolving the EXPECT_EQ() macro when the two inputs are bools. The error message shown below says it's trying to resolve "false" as a pointer.

I only run into this problem with the simplechrome build. This problem does not occur on a Linux GN build, and it obviously passes the build bots.

I could fix it by replacing it with "EXPECT_FALSE" but I'd like to know why this is happening at all.

You can see the build command and error messages below.

Simon

================================
FAILED: /usr/local/ssd/cros/chromium/.cros_cache/common/goma+2/gomacc x86_64-cros-linux-gnu-g++ -B/usr/local/ssd/cros/chromium/.cros_cache/chrome-sdk/tarballs/peppy+7871.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51-gold -MMD -MF obj/chrome/common/unit_tests.chrome_content_client_unittest.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=257955-1 -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_ASH=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_CRAS=1 -DUSE_OZONE=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DIMAGE_LOADER_EXTENSION=1 -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DENABLE_TOPCHROME_MD=1 -DENABLE_WAYLAND_SERVER=1 -DUSE_UDEV -DDONT_EMBED_BUILD_METADATA -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DENABLE_LEAK_DETECTOR=1 -DMOJO_USE_SYSTEM_IMPL -DTOOLKIT_VIEWS=1 -DUSE_BRLAPI -DGTEST_HAS_POSIX_RE=0 -DGTEST_LANG_CXX11=0 -DPROTOBUF_USE_DLLS -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DUSE_V4L2_CODEC -DCHROME_PNG_WRITE_SUPPORT -DPNG_USER_CONFIG -DUNIT_TEST -DGTEST_HAS_RTTI=0 -DSK_SUPPORT_GPU=1 -DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_STATIC_IMPLEMENTATION -DLIBXML_STATIC '-DI18N_ADDRESS_VALIDATION_DATA_URL="https://i18napis.appspot.com/ssl-aggregate-address/"' -DI18N_ADDRESSINPUT_USE_BASICTYPES_OVERRIDE=1 -DI18N_PHONENUMBERS_USE_ICU_REGEXP=1 -DI18N_PHONENUMBERS_NO_THREAD_SAFETY=1 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_LINUX -DWEBRTC_POSIX -DMESA_EGL_NO_X11_HEADERS -DHUNSPELL_STATIC -DHUNSPELL_CHROME_CLIENT -DUSE_HUNSPELL -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DUSE_NSS_CERTS=1 -DOS_CHROMEOS=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -D_FORTIFY_SOURCE=2 -Igen -I../.. -Igen/chrome -I../../skia/config -I../../third_party/khronos -I../../gpu -Igen/angle -I../../third_party/WebKit/Source -Igen/protoc_out -I../../third_party/protobuf -I../../third_party/protobuf/src -I../../third_party/WebKit -Igen/components -I../../third_party/WebKit -I../../third_party/npapi -I../../third_party/npapi/bindings -I../../third_party/libpng -I../../third_party/zlib -I../../third_party/libwebp -I../../third_party/ots/include -I../../third_party/qcms/src -I../../third_party/iccjpeg -I../../third_party/libjpeg_turbo -I../../testing/gmock/include -I../../testing/gtest/include -Igen/policy -I../../third_party/skia/include/core -I../../third_party/skia/include/effects -I../../third_party/skia/include/pdf -I../../third_party/skia/include/gpu -I../../third_party/skia/include/lazy -I../../third_party/skia/include/pathops -I../../third_party/skia/include/pipe -I../../third_party/skia/include/ports -I../../third_party/skia/include/utils -I../../skia/ext -I../../third_party/cacheinvalidation/overrides -I../../third_party/cacheinvalidation/src -I../../third_party/icu/source/i18n -I../../third_party/icu/source/common -I../../third_party/libxml/linux/include -I../../third_party/libxml/src/include -Igen/ui/resources -Igen/components/strings -Igen/content/app/resources/ -I../../third_party/leveldatabase/src/include -I../../third_party/leveldatabase/src -I../../third_party/leveldatabase -I../../third_party/libaddressinput/chromium/override -I../../third_party/libaddressinput/src/cpp/include -Igen/third_party/libaddressinput/ -Igen/protoc_out/third_party/libphonenumber -I../../third_party/libphonenumber/src -I../../third_party/webrtc_overrides -I../../third_party -I../../third_party/mesa/src/include -I../../v8/include -Igen/extensions -Igen/extensions/strings -Igen/ash/resources -Igen/ash/strings -Igen/ui/chromeos/resources -Igen/ui/views/resources -Werror -pthread -fno-strict-aliasing -Wall -Wno-extra -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wno-unused-local-typedefs -I/usr/local/ssd/cros/chromium/.cros_cache/chrome-sdk/tarballs/peppy+7871.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz/build/peppy/usr/include/freetype2 -I/usr/local/ssd/cros/chromium/.cros_cache/chrome-sdk/tarballs/peppy+7871.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz/usr/include/freetype2 -I/usr/local/ssd/cros/chromium/.cros_cache/chrome-sdk/tarballs/peppy+7871.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz/usr/include/nss -I/usr/local/ssd/cros/chromium/.cros_cache/chrome-sdk/tarballs/peppy+7871.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz/usr/include/nspr -I/usr/local/ssd/cros/chromium/.cros_cache/chrome-sdk/tarballs/peppy+7871.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz/usr/include/dbus-1.0 -I/usr/local/ssd/cros/chromium/.cros_cache/chrome-sdk/tarballs/peppy+7871.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz/usr/lib64/dbus-1.0/include -m64 -march=x86-64 --sysroot=/usr/local/ssd/cros/chromium/.cros_cache/chrome-sdk/tarballs/peppy+7871.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz -O2 -fno-ident -fdata-sections -ffunction-sections -funwind-tables -fno-omit-frame-pointer -g -pipe -pipe -pipe -march=corei7 -D__google_stl_debug_vector=1 -gsplit-dwarf -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wno-narrowing -Wno-literal-suffix  -c ../../chrome/common/chrome_content_client_unittest.cc -o obj/chrome/common/unit_tests.chrome_content_client_unittest.o

In file included from ../../testing/gtest/include/gtest/gtest.h:1878:0,

                 from ../../chrome/common/chrome_content_client_unittest.cc:15:

../../chrome/common/chrome_content_client_unittest.cc: In member function 'virtual void chrome_common::ChromeContentClientTest_FindMostRecent_Test::TestBody()':

../../testing/gtest/include/gtest/internal/gtest-internal.h:133:55: error: converting 'false' to pointer type for argument 1 of 'char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)' [-Werror=conversion-null]

     (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)

                                                       ^

../../testing/gtest/include/gtest/gtest_pred_impl.h:77:52: note: in definition of macro 'GTEST_ASSERT_'
EXPECT_EQ(false, most_recent->is_debug);

   if (const ::testing::AssertionResult gtest_ar = (expression)) \

                                                    ^

../../testing/gtest/include/gtest/gtest_pred_impl.h:162:3: note: in expansion of macro 'GTEST_PRED_FORMAT2_'

   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)

   ^

../../testing/gtest/include/gtest/gtest.h:1927:3: note: in expansion of macro 'EXPECT_PRED_FORMAT2'

   EXPECT_PRED_FORMAT2(::testing::internal:: \

   ^

../../testing/gtest/include/gtest/gtest.h:1928:32: note: in expansion of macro 'GTEST_IS_NULL_LITERAL_'

                       EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \

                                ^

../../chrome/common/chrome_content_client_unittest.cc:162:3: note: in expansion of macro 'EXPECT_EQ'

   EXPECT_EQ(false, most_recent->is_debug);

   ^

Daniel Cheng

unread,
Feb 17, 2016, 4:13:34 PM2/17/16
to sq...@chromium.org, Chromium-dev
Gtest has some magic to make EXPECT_EQ(NULL, foo) work (since NULL is not actually a pointer type). I guess false can mistakenly trigger this logic sometimes. See https://github.com/google/googletest/issues/322.

Solution: just use EXPECT_FALSE. =)

Daniel

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
Reply all
Reply to author
Forward
0 new messages