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
2 changes: 1 addition & 1 deletion src/include/nacl_compiler_annotations.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "native_client/src/include/build_config.h"

/* MSVC supports "inline" only in C++ */
#if NACL_WINDOWS
#if defined(_MSC_VER)
# define INLINE __forceinline
#else
# define INLINE __inline__
Expand Down
5 changes: 4 additions & 1 deletion src/include/portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#ifndef NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_H_
#define NATIVE_CLIENT_SRC_INCLUDE_PORTABILITY_H_ 1

#include <stdint.h>
#include <stdlib.h>

#include "native_client/src/include/build_config.h"
Expand All @@ -30,7 +31,9 @@

#if NACL_WINDOWS
/* disable warnings for deprecated functions like getenv, etc. */
#if defined(_MSC_VER)
#pragma warning(disable : 4996)
#endif
# include <malloc.h>
/* TODO: eliminate port_win.h */
# include "native_client/src/include/win/port_win.h"
Expand Down Expand Up @@ -59,7 +62,7 @@
#define GG_UINT32_C(x) (x ## U)
#define GG_UINT64_C(x) GG_ULONGLONG(x)

#if NACL_WINDOWS
#if NACL_WINDOWS && defined(_MSC_VER)
#define GG_LONGLONG(x) x##I64
#define GG_ULONGLONG(x) x##UI64
#else
Expand Down
4 changes: 4 additions & 0 deletions src/include/portability_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

#if NACL_WINDOWS
/* disable warnings for deprecated _snprintf */
#if defined(_MSC_VER)
#pragma warning(disable : 4996)
#endif

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

/* from bits/fcntl.h */
#if defined(_MSC_VER)
#define O_ACCMODE 0003
#endif

#else

Expand Down
2 changes: 2 additions & 0 deletions src/include/portability_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ size_t strnlen(const char* str, size_t max);

#if NACL_WINDOWS
/* disable warnings for deprecated strncpy */
#if defined(_MSC_VER)
#pragma warning(disable : 4996)
#endif

#define STRDUP _strdup
#define STRTOLL _strtoi64
Expand Down
8 changes: 7 additions & 1 deletion src/include/win/port_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

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

#if defined(_MSC_VER)
/* wchar_t and unsigned short are not always equivalent*/
#pragma warning(disable : 4255)
/* padding added after struct member */
Expand All @@ -46,6 +47,7 @@
#pragma warning(disable: 4826)
/* conditional expression is constant */
#pragma warning(disable : 4127)
#endif

/* TODO: limit this include to files that really need it */
#ifndef NOMINMAX
Expand Down Expand Up @@ -74,7 +76,9 @@ typedef __int64_t int64_t;
typedef __uint64_t uint64_t;

typedef long off_t;
#if defined(_MSC_VER)
typedef int mode_t;
#endif
typedef long _off_t;
typedef long int __loff_t;
typedef unsigned long DWORD;
Expand All @@ -94,7 +98,7 @@ typedef int32_t ssize_t;
*
* Only including range values actually used in our codebase.
*/
#if _MSC_VER >= 1800
#if !defined(_MSC_VER) || _MSC_VER >= 1800
#include <stdint.h>
#else
# if !defined(UINT8_MAX)
Expand Down Expand Up @@ -160,6 +164,8 @@ EXTERN_C_END


/* from linux/limits.h, via sys/param.h */
#if defined(_MSC_VER)
#define PATH_MAX 4096
#endif

#endif /* NATIVE_CLIENT_SRC_INCLUDE_WIN_PORT_WIN_H_ */
2 changes: 1 addition & 1 deletion src/shared/platform/win/lock_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_WIN_LOCK_IMPL_H_
#define NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_WIN_LOCK_IMPL_H_

#include <Windows.h>
#include <windows.h>
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/shared/platform/nacl_sync.h"

Expand Down
4 changes: 4 additions & 0 deletions src/shared/platform/win/nacl_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ void NaClAbort(void) {
* http://code.google.com/p/nativeclient/issues/detail?id=2772).
*/
while (1) {
#if defined(_MSC_VER)
__halt();
#else
__asm__("hlt");
#endif
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/platform/win/port_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "native_client/src/include/portability.h"

#if ( DO_NOT_USE_FAST_ASSEMBLER_VERSION_FOR_FFS || defined(_WIN64) )
#if ( DO_NOT_USE_FAST_ASSEMBLER_VERSION_FOR_FFS || defined(_WIN64) || !defined(_MSC_VER) )
int ffs(int x) {
int r = 1;

Expand Down
2 changes: 1 addition & 1 deletion src/shared/platform/win/xlate_system_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

#include <errno.h>
#include <WinError.h>
#include <winerror.h>

#include "native_client/src/shared/platform/nacl_log.h"
#include "native_client/src/shared/platform/win/xlate_system_error.h"
Expand Down
2 changes: 2 additions & 0 deletions src/trusted/fault_injection/fault_injection.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
*/
# define NACL_HAS_STRNDUP 0
/* could use TLS if not built into a DLL, otherwise must use TLSALLOC */
# define NACL_USE_TLS 0
# define NACL_USE_TSD 0
# define NACL_USE_TLSALLOC 1
# include <windows.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/trusted/service_runtime/arch/x86_32/sel_rt_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int NaClAppThreadInitArchSpecific(struct NaClAppThread *natp,
* Save the system's state of the x87 FPU control word so we can restore
* the same state when returning to trusted code.
*/
#if NACL_WINDOWS
#if defined(_MSC_VER)
{
uint16_t sys_fcw;
__asm {
Expand Down
2 changes: 1 addition & 1 deletion src/trusted/service_runtime/nacl_signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct NaClExceptionFrame;
#define NACL_ABI_WIFSIGNALED(status) ((((status) + 1) & 0x7f) > 1)
#define NACL_ABI_W_EXITCODE(ret, sig) ((((ret) & 0xff) << 8) + ((sig) & 0x7f))

#if NACL_WINDOWS
#if NACL_WINDOWS && defined(_MSC_VER)
enum PosixSignals {
SIGINT = 2,
SIGQUIT = 3,
Expand Down
2 changes: 1 addition & 1 deletion src/trusted/service_runtime/sel_ldr.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ void NaClVmIoPendingCheck_mu(struct NaClApp *nap,
* We need its symbol in the symbol table so don't inline it.
* TODO(dje): add some explanation for the non-GDB person.
*/
#if NACL_WINDOWS
#if NACL_WINDOWS && defined(_MSVC_VER)
__declspec(dllexport noinline)
#endif
#ifdef __GNUC__
Expand Down
2 changes: 1 addition & 1 deletion src/trusted/validator/validation_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "native_client/src/trusted/validator/validation_metadata.h"

#if NACL_WINDOWS
#include <Windows.h>
#include <windows.h>
#include <io.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/trusted/validator_ragel/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/include/portability.h"

#if NACL_WINDOWS
#if defined(_MSC_VER)
# define FORCEINLINE __forceinline
#else
# define FORCEINLINE __inline __attribute__ ((always_inline))
Expand Down
2 changes: 1 addition & 1 deletion src/trusted/validator_ragel/decoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "native_client/src/include/build_config.h"
#include "native_client/src/trusted/validator_ragel/decoder.h"

#if NACL_WINDOWS
#if defined(_MSC_VER)
# define FORCEINLINE __forceinline
#else
# define FORCEINLINE __inline __attribute__ ((always_inline))
Expand Down