Skip to content

Commit

Permalink
wrappers: Only add -stdlib=libc++ in clang-scan-deps-wrapper if the t…
Browse files Browse the repository at this point in the history
…arget is mingw
  • Loading branch information
mstorsjo committed Apr 29, 2024
1 parent a29cee5 commit 3cc7cda
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion wrappers/clang-scan-deps-wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ int _tmain(int argc, TCHAR *argv[]) {
// -target after cmd_exe.
exec_argv[arg++] = _T("-target");
exec_argv[arg++] = target;
exec_argv[arg++] = _T("-stdlib=libc++");

// Only add -stdlib=libc++ if the target actually is mingw.
if (_tcsstr(target, _T("-mingw32")) ||
_tcsstr(target, _T("-windows-gnu")))
exec_argv[arg++] = _T("-stdlib=libc++");
}
}

Expand Down
9 changes: 8 additions & 1 deletion wrappers/clang-scan-deps-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ if [ -n "$CMD_EXE" ]; then
fi

if [ -n "$TARGET" ]; then
"$EXE" "${FLAGS[@]}" "$CMD_EXE" -target $TARGET -stdlib=libc++ "$@"
TARGETFLAGS=""
case $TARGET in
*-mingw32*|*-windows-gnu*)
# Only add -stdlib=libc++ if the target actually is mingw.
TARGETFLAGS="$TARGETFLAGS -stdlib=libc++"
;;
esac
"$EXE" "${FLAGS[@]}" "$CMD_EXE" -target $TARGET $TARGETFLAGS "$@"
else
"$EXE" "${FLAGS[@]}" "$@"
fi
1 change: 1 addition & 0 deletions wrappers/native-wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ typedef char TCHAR;
#define _tcslen strlen
#define _tcscmp strcmp
#define _tcsncmp strncmp
#define _tcsstr strstr
#define _tperror perror
#define _texecvp execvp
#define _tmain main
Expand Down

0 comments on commit 3cc7cda

Please sign in to comment.