Commit 6ca0bda5 authored by Wanchang Ryu's avatar Wanchang Ryu Committed by Commit Bot

GCC: Check defined(__clang__) macro to using __has_builtin in location.h

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}
parent 91d907f7
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
namespace base { namespace base {
#if defined(__has_builtin) #if defined(__clang__)
// Clang allows detection of these builtins. // Clang allows detection of these builtins.
#define SUPPORTS_LOCATION_BUILTINS \ #define SUPPORTS_LOCATION_BUILTINS \
(__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \ (__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \
......
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