• Wanchang Ryu's avatar
    GCC: Check defined(__clang__) macro to using __has_builtin in location.h · 6ca0bda5
    Wanchang Ryu authored
    There are many places defining __has_builtin(x) to 0 if __has_builtin
    is not defined.
    When building chrom with gcc, depending on include file it can be
    undfined or defined to 0.
    So SUPPORTS_LOCATION_BUILTINS can be different depending on include
    header file before including base/location.h file.
    
    This patch changes checking defined(__has_builtin) to defined(__clang__)
    for using __has_builtin macro. This would be enough to detect clang
    compiler for using __has_builtin.
    
    Here is a link error what I met when compiling with gcc and this patch
    fixes below link error.
    
    g++ -Wl,--version-script=../../build/linux/chrome.map -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -fuse-ld=gold -Wl,--threads -Wl,--thread-count=4 -m64 -Wl,-O2 -Wl,--gc-sections -rdynamic -pie -Wl,--disable-new-dtags -o "./chrome" -Wl,--start-group @"./chrome.rsp"  -Wl,--end-group  -latomic -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 -latk-1.0 -latk-bridge-2.0 -lcups -ldbus-1 -lresolv -lgio-2.0 -lexpat -luuid -ldrm -lxkbcommon -lm -lz -lwayland-cursor -lwayland-egl -lwayland-client -lpci -lasound -lpangocairo-1.0 -lpango-1.0 -lcairo -latspi -lgtk-3 -lgdk-3 -lcairo-gobject -lgdk_pixbuf-2.0
    obj/ui/gtk/libgtk.a(obj/ui/gtk/gtk/print_dialog_gtk.o):print_dialog_gtk.cc:function PrintDialogGtk::SendDocumentToPrinter(std::__cxx11::basic_string<unsigned short, base::string16_internals::string16_char_traits, std::allocator<unsigned short> > const&): error: undefined reference to 'base::Location::Current()'
    obj/ui/gtk/libgtk.a(obj/ui/gtk/gtk/select_file_dialog_impl_kde.o):select_file_dialog_impl_kde.cc:function gtk::SelectFileDialogImpl::CheckKDEDialogWorksOnUIThread(): error: undefined reference to 'base::Location::Current()'
    obj/ui/gtk/libgtk.a(obj/ui/gtk/gtk/print_dialog_gtk.o):print_dialog_gtk.cc:function PrintDialogGtk::ReleaseDialog(): error: undefined reference to 'base::Location::Current()'
    obj/ui/gtk/libgtk.a(obj/ui/gtk/gtk/select_file_dialog_impl_kde.o):select_file_dialog_impl_kde.cc:function gtk::SelectFileDialogImplKDE::CreateSelectFolderDialog(ui::SelectFileDialog::Type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, base::FilePath const&, unsigned long, void*): error: undefined reference to 'base::Location::Current()'
    collect2: error: ld returned 1 exit status
    
    Change-Id: Ic025681762c2c4efafe6f1e972d78dcf85b89c2b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303232Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
    Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Commit-Queue: Wanchang Ryu <wanchang.ryu@lge.com>
    Cr-Commit-Position: refs/heads/master@{#790335}
    6ca0bda5
location.h 4.89 KB