Skip to content

Commit

Permalink
Restrict the use of _s (Annex K) functions to MSVC
Browse files Browse the repository at this point in the history
These `_s` secure functions are introduced in C11 as optional bounds-checking interfaces, there is no guarantee that they are implemented/enabled by other compilers.
  • Loading branch information
Gnimuc authored and vgvassilev committed Jan 11, 2025
1 parent b93db9c commit 396d7a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Interpreter/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
#include "clang/Basic/Version.h"
#include "clang/Config/config.h"

#ifdef _WIN32
#ifdef _MSC_VER
#define dup _dup
#define dup2 _dup2
#define close _close
#define fileno _fileno
#endif

static inline char* GetEnv(const char* Var_Name) {
#ifdef _WIN32
#ifdef _MSC_VER
char* Env = nullptr;
size_t sz = 0;
getenv_s(&sz, Env, sz, Var_Name);
Expand Down
2 changes: 1 addition & 1 deletion lib/Interpreter/CppInterOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3414,7 +3414,7 @@ namespace Cpp {
int m_DupFD = -1;

public:
#ifdef _WIN32
#ifdef _MSC_VER
StreamCaptureInfo(int FD)
: m_TempFile(
[]() {
Expand Down

0 comments on commit 396d7a1

Please sign in to comment.