Skip to content

Commit 017dc68

Browse files
committed
win32: silence some MSVC pragma and redefinitions on MinGW
1 parent 79108ef commit 017dc68

4 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎src/include/portability.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131

3232
#if NACL_WINDOWS
3333
/* disable warnings for deprecated functions like getenv, etc. */
34+
#if defined(_MSC_VER)
3435
#pragma warning(disable : 4996)
36+
#endif
3537
# include <malloc.h>
3638
/* TODO: eliminate port_win.h */
3739
# include "native_client/src/include/win/port_win.h"

‎src/include/portability_io.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
#if NACL_WINDOWS
1919
/* disable warnings for deprecated _snprintf */
20+
#if defined(_MSC_VER)
2021
#pragma warning(disable : 4996)
22+
#endif
2123

2224
#include <io.h>
2325
#include <direct.h>
@@ -43,7 +45,9 @@
4345
/* missing from win stdio.h and fcntl.h */
4446

4547
/* from bits/fcntl.h */
48+
#if defined(_MSC_VER)
4649
#define O_ACCMODE 0003
50+
#endif
4751

4852
#else
4953

‎src/include/portability_string.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ size_t strnlen(const char* str, size_t max);
5353

5454
#if NACL_WINDOWS
5555
/* disable warnings for deprecated strncpy */
56+
#if defined(_MSC_VER)
5657
#pragma warning(disable : 4996)
58+
#endif
5759

5860
#define STRDUP _strdup
5961
#define STRTOLL _strtoi64

‎src/include/win/port_win.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
/* TODO: eliminated this file and move its contents to portability*.h */
4040

41+
#if defined(_MSC_VER)
4142
/* wchar_t and unsigned short are not always equivalent*/
4243
#pragma warning(disable : 4255)
4344
/* padding added after struct member */
@@ -46,6 +47,7 @@
4647
#pragma warning(disable: 4826)
4748
/* conditional expression is constant */
4849
#pragma warning(disable : 4127)
50+
#endif
4951

5052
/* TODO: limit this include to files that really need it */
5153
#ifndef NOMINMAX
@@ -96,7 +98,7 @@ typedef int32_t ssize_t;
9698
*
9799
* Only including range values actually used in our codebase.
98100
*/
99-
#if _MSC_VER >= 1800
101+
#if !defined(_MSC_VER) || _MSC_VER >= 1800
100102
#include <stdint.h>
101103
#else
102104
# if !defined(UINT8_MAX)
@@ -162,6 +164,8 @@ EXTERN_C_END
162164

163165

164166
/* from linux/limits.h, via sys/param.h */
167+
#if defined(_MSC_VER)
165168
#define PATH_MAX 4096
169+
#endif
166170

167171
#endif /* NATIVE_CLIENT_SRC_INCLUDE_WIN_PORT_WIN_H_ */

0 commit comments

Comments
 (0)