MSYS2-packages/llvm/0004-LLVM-Cygwin-Fix-Signals-compatibility-with-Cygwin-AP.patch
2025-07-09 17:24:53 -07:00

43 lines
2.1 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 8314bcc191800d31784a88137ded12cf06b43c71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= <oss@mateuszmikula.dev>
Date: Fri, 2 May 2025 10:02:51 +0200
Subject: [PATCH] [LLVM][Cygwin] Fix Signals compatibility with Cygwin API
(#138117)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cygwin types sometimes do not match Linux exactly. Like in this case:
```
In file included from /h/projects/llvm-project/llvm/include/llvm/Support/Error.h:23,
from /h/projects/llvm-project/llvm/include/llvm/Support/FileSystem.h:34,
from /h/projects/llvm-project/llvm/lib/Support/Signals.cpp:22:
/h/projects/llvm-project/llvm/include/llvm/Support/Format.h: In instantiation of llvm::format_object<Ts>::format_object(const char*, const Ts& ...) [with Ts = {int, char [4096]}]:
/h/projects/llvm-project/llvm/include/llvm/Support/Format.h:126:10: required from llvm::format_object<Ts ...> llvm::format(const char*, const Ts& ...) [with Ts = {int, char [4096]}]
/h/projects/llvm-project/llvm/lib/Support/Unix/Signals.inc:850:19: required from here
/h/projects/llvm-project/llvm/include/llvm/Support/Format.h:106:34: error: no matching function for call to std::tuple<int, char [4096]>::tuple(const int&, const char [4096])
106 | : format_object_base(fmt), Vals(vals...) {
| ^~~~~~~~~~~~~
```
Casting here is safe and solves the issue.
---
llvm/lib/Support/Unix/Signals.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc
index 2e7b467a14..ac01d05ab6 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -842,7 +842,7 @@ void llvm::sys::PrintStackTrace(raw_ostream &OS, int Depth) {
const char *name = strrchr(dlinfo.dli_fname, '/');
if (!name)
- OS << format(" %-*s", width, dlinfo.dli_fname);
+ OS << format(" %-*s", width, static_cast<const char *>(dlinfo.dli_fname));
else
OS << format(" %-*s", width, name + 1);
--
2.50.1.windows.1