Skip to content

Commit

Permalink
devel/qt5-script: Prevent clang from optimizing the code with undefin…
Browse files Browse the repository at this point in the history
…ed behavior

PR:		277236
Obtained from:	OpenBSD ports
  • Loading branch information
melak authored and arrowd committed Mar 22, 2024
1 parent 8608214 commit 9e3ff8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion devel/qt5-script/Makefile
@@ -1,6 +1,6 @@
PORTNAME= script
PORTVERSION= ${QT5_VERSION}${QT5_KDE_PATCH}
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel
PKGNAMEPREFIX= qt5-

Expand Down
@@ -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); }

0 comments on commit 9e3ff8f

Please sign in to comment.