Skip to content

Commit faa9541

Browse files
mati865jeremyd2019
authored andcommitted
[LLVM][Cygwin] Fix Signals compatibility with Cygwin API (llvm#138117)
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.
1 parent ff8cad1 commit faa9541

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Support/Unix/Signals.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ void llvm::sys::PrintStackTrace(raw_ostream &OS, int Depth) {
842842

843843
const char *name = strrchr(dlinfo.dli_fname, '/');
844844
if (!name)
845-
OS << format(" %-*s", width, dlinfo.dli_fname);
845+
OS << format(" %-*s", width, static_cast<const char *>(dlinfo.dli_fname));
846846
else
847847
OS << format(" %-*s", width, name + 1);
848848

0 commit comments

Comments
 (0)