Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qtwebengine] Fix stuff #35639

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions ports/qtwebengine/clang-cl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/src/3rdparty/gn/build/build_win.ninja.template b/src/3rdparty/gn/build/build_win.ninja.template
index 7d2704c..b14186b 100644
--- a/src/3rdparty/gn/build/build_win.ninja.template
+++ b/src/3rdparty/gn/build/build_win.ninja.template
@@ -8,5 +8,5 @@ rule alink_thin
description = LIB $out

rule link
- command = $ld /nologo $in /link $ldflags /PDB:$out.pdb /OUT:$out $solibs $libs
+ command = $ld /nologo $in $ldflags /PDB:$out.pdb /OUT:$out $solibs $libs
description = LINK $out
diff --git a/src/gn/CMakeLists.txt b/src/gn/CMakeLists.txt
index 0fe3e4e..1e2556f 100644
--- a/src/gn/CMakeLists.txt
+++ b/src/gn/CMakeLists.txt
@@ -31,7 +31,7 @@ find_package(Ninja 1.7.2 REQUIRED)

if(WIN32)
set(GN_EXECUTABLE gn.exe)
- if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT MINGW)
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT MINGW OR MSVC)
# Use lld-link instead of clang-cl.
set(GN_LINKER ${CMAKE_LINKER})
endif()
124 changes: 124 additions & 0 deletions ports/qtwebengine/msvc-template.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
diff --git a/src/3rdparty/chromium/third_party/webrtc/rtc_base/checks.h b/src/3rdparty/chromium/third_party/webrtc/rtc_base/checks.h
index 459c6a5..687a364 100644
--- a/src/3rdparty/chromium/third_party/webrtc/rtc_base/checks.h
+++ b/src/3rdparty/chromium/third_party/webrtc/rtc_base/checks.h
@@ -224,60 +224,13 @@ ToStringVal MakeVal(const T& x) {
template <typename... Ts>
class LogStreamer;

-// Base case: Before the first << argument.
-template <>
-class LogStreamer<> final {
- public:
- template <typename U,
- typename V = decltype(MakeVal(std::declval<U>())),
- absl::enable_if_t<std::is_arithmetic<U>::value ||
- std::is_enum<U>::value>* = nullptr>
- RTC_FORCE_INLINE LogStreamer<V> operator<<(U arg) const {
- return LogStreamer<V>(MakeVal(arg), this);
- }
-
- template <typename U,
- typename V = decltype(MakeVal(std::declval<U>())),
- absl::enable_if_t<!std::is_arithmetic<U>::value &&
- !std::is_enum<U>::value>* = nullptr>
- RTC_FORCE_INLINE LogStreamer<V> operator<<(const U& arg) const {
- return LogStreamer<V>(MakeVal(arg), this);
- }
-
-#if RTC_CHECK_MSG_ENABLED
- template <typename... Us>
- RTC_NORETURN RTC_FORCE_INLINE static void Call(const char* file,
- const int line,
- const char* message,
- const Us&... args) {
- static constexpr CheckArgType t[] = {Us::Type()..., CheckArgType::kEnd};
- FatalLog(file, line, message, t, args.GetVal()...);
- }
-
- template <typename... Us>
- RTC_NORETURN RTC_FORCE_INLINE static void CallCheckOp(const char* file,
- const int line,
- const char* message,
- const Us&... args) {
- static constexpr CheckArgType t[] = {CheckArgType::kCheckOp, Us::Type()...,
- CheckArgType::kEnd};
- FatalLog(file, line, message, t, args.GetVal()...);
- }
-#else
- template <typename... Us>
- RTC_NORETURN RTC_FORCE_INLINE static void Call(const char* file,
- const int line) {
- FatalLog(file, line);
- }
-#endif
-};

// Inductive case: We've already seen at least one << argument. The most recent
// one had type `T`, and the earlier ones had types `Ts`.
template <typename T, typename... Ts>
class LogStreamer<T, Ts...> final {
public:
- RTC_FORCE_INLINE LogStreamer(T arg, const LogStreamer<Ts...>* prior)
+ RTC_FORCE_INLINE LogStreamer(T arg, const LogStreamer<Ts...> * const prior)
: arg_(arg), prior_(prior) {}

template <typename U,
@@ -328,6 +281,57 @@ class LogStreamer<T, Ts...> final {
const LogStreamer<Ts...>* prior_;
};

+
+// Base case: Before the first << argument.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beyond Compare screenshot

Observations:

  • Changing the return type to auto appears OK because the code before was always returning a prvalue and there's no intended SFINAE happening there
  • The previous code is doing decltype(MakeVal(an xvalue)) while the new code is doing decltype(MakeVal(an lvalue)). But the runtime code in both cases is calling with an lvalue.
  • You don't need C++20 remove_cvref_t; template argument deduction will never deduce a ref here, so C++14 remove_const_t should be sufficient. Probably not worth resetting the build over this..

I'm testing to see if just changing decltype(MakeVal(std::declval<U>())) to decltype(MakeVal(std::declval<U&>())) to match the runtime code fixes it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove remove_cvref_t I just used it for testing. Seems like I removed it from the enum test but forgot to remove it from the arithmetic check.

I'm testing to see if just changing decltype(MakeVal(std::declval())) to decltype(MakeVal(std::declval<U&>())) to match the runtime code fixes it

Shouldn't make a difference since the signature of MakeVal is in almost all cases RetType MakeVal(const argtype& x) and that doesn't care about U or U&. However cl is strange from time to time.

Copy link
Member

@BillyONeal BillyONeal Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm testing to see if just changing decltype(MakeVal(std::declval())) to decltype(MakeVal(std::declval<U&>())) to match the runtime code fixes it

Test failed

+template <>
+class LogStreamer<> final {
+ public:
+ template <typename U,
+ absl::enable_if_t<std::is_arithmetic<std::remove_cvref_t<U>>::value ||
+ std::is_enum<U>::value>* = nullptr>
+ RTC_FORCE_INLINE auto operator<<(U arg) const {
+ return LogStreamer<decltype(MakeVal(arg))>(MakeVal(arg), this);
+ }
+
+ template <typename U,
+ absl::enable_if_t<!std::is_arithmetic<std::remove_cvref_t<U>>::value &&
+ !std::is_enum<U>::value>* = nullptr>
+ RTC_FORCE_INLINE auto operator<<(const U& arg) const {
+ return LogStreamer<decltype(MakeVal(arg))>(MakeVal(arg), this);
+ }
+
+ //RTC_FORCE_INLINE auto operator<<(const std::string& arg) const {
+ // return LogStreamer<Val<CheckArgType::kStdString, const std::string*>>(MakeVal(arg), this);
+ //
+
Comment on lines +90 to +93
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ //RTC_FORCE_INLINE auto operator<<(const std::string& arg) const {
+ // return LogStreamer<Val<CheckArgType::kStdString, const std::string*>>(MakeVal(arg), this);
+ //
+

Not worth resetting a build of qtwebengine over this

+#if RTC_CHECK_MSG_ENABLED
+ template <typename... Us>
+ RTC_NORETURN RTC_FORCE_INLINE static void Call(const char* file,
+ const int line,
+ const char* message,
+ const Us&... args) {
+ static constexpr CheckArgType t[] = {Us::Type()..., CheckArgType::kEnd};
+ FatalLog(file, line, message, t, args.GetVal()...);
+ }
+
+ template <typename... Us>
+ RTC_NORETURN RTC_FORCE_INLINE static void CallCheckOp(const char* file,
+ const int line,
+ const char* message,
+ const Us&... args) {
+ static constexpr CheckArgType t[] = {CheckArgType::kCheckOp, Us::Type()...,
+ CheckArgType::kEnd};
+ FatalLog(file, line, message, t, args.GetVal()...);
+ }
+#else
+ template <typename... Us>
+ RTC_NORETURN RTC_FORCE_INLINE static void Call(const char* file,
+ const int line) {
+ FatalLog(file, line);
+ }
+#endif
+};
+
template <bool isCheckOp>
class FatalLogCall final {
public:
7 changes: 5 additions & 2 deletions ports/qtwebengine/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
set(SCRIPT_PATH "${CURRENT_INSTALLED_DIR}/share/qtbase")
include("${SCRIPT_PATH}/qt_install_submodule.cmake")

set(${PORT}_PATCHES "")
set(${PORT}_PATCHES
"clang-cl.patch"
"msvc-template.patch"
)

set(TOOL_NAMES gn QtWebEngineProcess qwebengine_convert_dict)

Expand Down Expand Up @@ -29,7 +32,7 @@ set(deactivated_features webengine_webrtc_pipewire)
foreach(_feat IN LISTS deactivated_features)
list(APPEND FEATURE_OPTIONS "-DFEATURE_${_feat}=OFF")
endforeach()
set(enabled_features webengine_webrtc webengine_v8_snapshot_support)
set(enabled_features webengine_webrtc)
foreach(_feat IN LISTS enabled_features)
list(APPEND FEATURE_OPTIONS "-DFEATURE_${_feat}=ON")
endforeach()
Expand Down
7 changes: 5 additions & 2 deletions ports/qtwebengine/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$comment": "x86-windows is not within the upstream support matrix of Qt6",
"name": "qtwebengine",
"version": "6.6.1",
"port-version": 1,
"port-version": 2,
"description": "Qt WebEngine",
"homepage": "https://www.qt.io/",
"license": null,
Expand Down Expand Up @@ -152,7 +152,10 @@
"dependencies": [
{
"name": "qtwebchannel",
"default-features": false
"default-features": false,
"features": [
"qml"
]
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7266,7 +7266,7 @@
},
"qtwebengine": {
"baseline": "6.6.1",
"port-version": 1
"port-version": 2
},
"qtwebsockets": {
"baseline": "6.6.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qtwebengine.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0da0e5d03340ccc05f77e90cb898e62237746107",
"version": "6.6.1",
"port-version": 2
},
{
"git-tree": "f84af713f1090d7294c2707dc722373c06857114",
"version": "6.6.1",
Expand Down