Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/runtime_src/core/common/detail/windows/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ sys_dep_get_last_err_msg()
inline std::string
getenv(const char* name)
{
#ifdef _MSC_VER
char* value = nullptr;
size_t len = 0;

Expand All @@ -62,6 +63,10 @@ getenv(const char* name)
// Use unique_ptr to ensure memory is freed even if string constructor throws
std::unique_ptr<char, decltype(&std::free)> guard(value, &std::free);
return std::string(guard.get());
#else
const char* value = std::getenv(name);
return value ? std::string(value) : std::string{};
#endif
Comment on lines 55 to +69

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear that these changes check for MinGW, please adjust, e.g. maybe #ifdef __MINGW32__ / #else .
Also changes seem a little haphazardly, for example, I don't believe strerror_s works with MinGW, so why wasn't this fixed? Is this PR even needed, it is a concerted effort to build XRT with MinGW, or is just change a little here and there?

}

inline std::string
Expand Down
2 changes: 1 addition & 1 deletion src/runtime_src/core/include/xrt/detail/windows/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <stdint.h>

#ifndef __GNU__
#ifndef __GNUC__
typedef int64_t ssize_t;
typedef int pid_t;
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2018-2022 Xilinx, Inc. All rights Reserved.
# Copyright (C) 2022-2026 Advanced Micro Devices, Inc. All rights Reserved.
if(NOT WIN32)
if(NOT MSVC)
add_compile_options(-Wextra -fvisibility=default)
else()
add_compile_options(/wd4244 /wd4267 /wd4477 /wd4245)
Comment on lines +4 to 7

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverse, /wd* are MSVC specific

Expand Down
Loading