You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chromium/chromium-clang_lto_visibili...

54 lines
2.2 KiB

5 years ago
From 4e380a0e486c080f36adad5b035787d64cfedb3e Mon Sep 17 00:00:00 2001
From: Stephan Hartmann <stha09@googlemail.com>
Date: Sat, 27 Jun 2020 13:59:20 +0000
Subject: [PATCH] GCC: fix mixing __attribute__ with C++ attributes
GCC does not support mixing __attribute__ with [[...]] attributes.
On the other hand [[clang::lto_visibility_public]] isn't supported
by GCC and only emits a warning. Therefore define Clang specific
attribute and leave it empty for GCC.
---
base/compiler_specific.h | 6 ++++++
third_party/blink/renderer/core/frame/frame_view.h | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index c8a7649..8fd2252 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -292,4 +292,10 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
#endif // defined(__clang_analyzer__)
+#if defined(__clang__)
+#define LTO_VISIBILITY_PUBLIC [[clang::lto_visibility_public]]
+#else
+#define LTO_VISIBILITY_PUBLIC
+#endif
+
#endif // BASE_COMPILER_SPECIFIC_H_
diff --git a/third_party/blink/renderer/core/frame/frame_view.h b/third_party/blink/renderer/core/frame/frame_view.h
index aa5e42a..ec93d89 100644
--- a/third_party/blink/renderer/core/frame/frame_view.h
+++ b/third_party/blink/renderer/core/frame/frame_view.h
@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_VIEW_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_VIEW_H_
+#include "base/compiler_specific.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink.h"
#include "third_party/blink/public/platform/viewport_intersection_state.h"
#include "third_party/blink/renderer/core/frame/embedded_content_view.h"
@@ -20,7 +21,7 @@ struct IntrinsicSizingInfo;
// clang::lto_visibility_public is necessary to prevent the compiler from
// performing a vtable optimization that crashes the renderer. See
// crbug.com/1062006.
-class CORE_EXPORT [[clang::lto_visibility_public]] FrameView
+class CORE_EXPORT LTO_VISIBILITY_PUBLIC FrameView
: public EmbeddedContentView {
public:
FrameView(const IntRect& frame_rect) : EmbeddedContentView(frame_rect) {}
--
2.26.2