commit:     23e62bcc9a854f4b988709b2a1e1baf2ca521cbe
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 14 15:55:58 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Apr 14 15:56:23 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23e62bcc

www-client/chromium: add patch for clang-16 compat

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 www-client/chromium/chromium-112.0.5615.49.ebuild  |  1 +
 .../chromium/files/chromium-112-sql-relax.patch    | 46 ++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/www-client/chromium/chromium-112.0.5615.49.ebuild 
b/www-client/chromium/chromium-112.0.5615.49.ebuild
index a0663b22f3f0..0c39b812a76f 100644
--- a/www-client/chromium/chromium-112.0.5615.49.ebuild
+++ b/www-client/chromium/chromium-112.0.5615.49.ebuild
@@ -340,6 +340,7 @@ src_prepare() {
                "${FILESDIR}/chromium-112-compiler.patch"
                "${FILESDIR}/chromium-112-libstdc++.patch"
                "${FILESDIR}/chromium-112-libstdc++-1.patch"
+               "${FILESDIR}/chromium-112-sql-relax.patch"
        )
 
        if use ppc64 ; then

diff --git a/www-client/chromium/files/chromium-112-sql-relax.patch 
b/www-client/chromium/files/chromium-112-sql-relax.patch
new file mode 100644
index 000000000000..2510d1000034
--- /dev/null
+++ b/www-client/chromium/files/chromium-112-sql-relax.patch
@@ -0,0 +1,46 @@
+From 7d1394bd639e3bcf68082ac3fc33eeed6a00d2e6 Mon Sep 17 00:00:00 2001
+From: Elly Fong-Jones <[email protected]>
+Date: Thu, 02 Mar 2023 00:15:11 +0000
+Subject: [PATCH] sql: relax constraints on VirtualCursor layout
+
+VirtualCursor::FromSqliteCursor required that VirtualCursor had a
+standard layout, but in fact VirtualCursor shouldn't have a standard
+layout, and the fact that it does with libc++ is a deviation from the
+C++ standard. This change:
+
+1. Relaxes the requirement that VirtualCursor has a standard layout, and
+2. Relaxes the requirement that the sqlite_cursor_ field has to be at
+   offset 0
+
+by use of offsetof() and pointer subtraction. This change both improves
+standards compliance and makes this code build with libstdc++.
+
+Bug: 1380656
+Change-Id: I9c47abd9197b187da0360ca5619ccf7dadab4f33
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4292313
+Reviewed-by: Austin Sullivan <[email protected]>
+Commit-Queue: Elly Fong-Jones <[email protected]>
+Cr-Commit-Position: refs/heads/main@{#1111925}
+---
+
+diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h
+index 1970bdca..4cb0655 100644
+--- a/sql/recover_module/cursor.h
++++ b/sql/recover_module/cursor.h
+@@ -63,12 +63,10 @@
+   // |sqlite_cursor| must have been returned by VirtualTable::SqliteCursor().
+   static inline VirtualCursor* FromSqliteCursor(
+       sqlite3_vtab_cursor* sqlite_cursor) {
+-    static_assert(std::is_standard_layout<VirtualCursor>::value,
+-                  "needed for the reinterpret_cast below");
+-    static_assert(offsetof(VirtualCursor, sqlite_cursor_) == 0,
+-                  "sqlite_cursor_ must be the first member of the class");
+-    VirtualCursor* result = reinterpret_cast<VirtualCursor*>(sqlite_cursor);
+-    DCHECK_EQ(sqlite_cursor, &result->sqlite_cursor_);
++    VirtualCursor* result = reinterpret_cast<VirtualCursor*>(
++        (reinterpret_cast<char*>(sqlite_cursor) -
++         offsetof(VirtualCursor, sqlite_cursor_)));
++    CHECK_EQ(sqlite_cursor, &result->sqlite_cursor_);
+     return result;
+   }
+ 

Reply via email to