Skip to content

Commit 396d7a1

Browse files
Gnimucvgvassilev
authored andcommitted
Restrict the use of _s (Annex K) functions to MSVC
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.
1 parent b93db9c commit 396d7a1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Interpreter/Compatibility.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
#include "clang/Basic/Version.h"
1111
#include "clang/Config/config.h"
1212

13-
#ifdef _WIN32
13+
#ifdef _MSC_VER
1414
#define dup _dup
1515
#define dup2 _dup2
1616
#define close _close
1717
#define fileno _fileno
1818
#endif
1919

2020
static inline char* GetEnv(const char* Var_Name) {
21-
#ifdef _WIN32
21+
#ifdef _MSC_VER
2222
char* Env = nullptr;
2323
size_t sz = 0;
2424
getenv_s(&sz, Env, sz, Var_Name);

lib/Interpreter/CppInterOp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3414,7 +3414,7 @@ namespace Cpp {
34143414
int m_DupFD = -1;
34153415

34163416
public:
3417-
#ifdef _WIN32
3417+
#ifdef _MSC_VER
34183418
StreamCaptureInfo(int FD)
34193419
: m_TempFile(
34203420
[]() {

0 commit comments

Comments
 (0)