git: 9e3ff8f0b99e - main - devel/qt5-script: Prevent clang from optimizing the code with undefined behavior

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Fri, 22 Mar 2024 21:19:51 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9e3ff8f0b99e7b3074f3e83c954a0395185f63f0

commit 9e3ff8f0b99e7b3074f3e83c954a0395185f63f0
Author:     Tomas Tevesz <ice@extreme.hu>
AuthorDate: 2024-03-22 21:16:49 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-03-22 21:18:36 +0000

    devel/qt5-script: Prevent clang from optimizing the code with undefined behavior
    
    PR:             277236
    Obtained from:  OpenBSD ports
---
 devel/qt5-script/Makefile                                 |  2 +-
 ..._javascriptcore_JavaScriptCore_interpreter_CallFrame.h | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/devel/qt5-script/Makefile b/devel/qt5-script/Makefile
index cd8e2cddefbc..5fbf625428c9 100644
--- a/devel/qt5-script/Makefile
+++ b/devel/qt5-script/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	script
 PORTVERSION=	${QT5_VERSION}${QT5_KDE_PATCH}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel
 PKGNAMEPREFIX=	qt5-
 
diff --git a/devel/qt5-script/files/patch-src_3rdparty_javascriptcore_JavaScriptCore_interpreter_CallFrame.h b/devel/qt5-script/files/patch-src_3rdparty_javascriptcore_JavaScriptCore_interpreter_CallFrame.h
new file mode 100644
index 000000000000..bce9105b6145
--- /dev/null
+++ b/devel/qt5-script/files/patch-src_3rdparty_javascriptcore_JavaScriptCore_interpreter_CallFrame.h
@@ -0,0 +1,15 @@
+Index: src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h
+--- src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h.orig
++++ src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h
+@@ -135,9 +135,11 @@ namespace JSC  {
+         static CallFrame* noCaller() { return reinterpret_cast<CallFrame*>(HostCallFrameFlag); }
+         int returnValueRegister() const { return this[RegisterFile::ReturnValueRegister].i(); }
+ 
++#pragma clang optimize off
+         bool hasHostCallFrameFlag() const { return reinterpret_cast<intptr_t>(this) & HostCallFrameFlag; }
+         CallFrame* addHostCallFrameFlag() const { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) | HostCallFrameFlag); }
+         CallFrame* removeHostCallFrameFlag() { return reinterpret_cast<CallFrame*>(reinterpret_cast<intptr_t>(this) & ~HostCallFrameFlag); }
++#pragma clang optimize on
+ 
+     private:
+         void setArgumentCount(int count) { static_cast<Register*>(this)[RegisterFile::ArgumentCount] = Register::withInt(count); }