Use _WIN32 instead WIN32. (#4484)

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
Yonggang Luo
2021-01-16 20:22:28 +00:00
committed by GitHub
parent fe3b0a8435
commit 3ce4dce805
6 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -342,7 +342,7 @@ ecma_number_is_finite (ecma_number_t num) /**< ecma-number */
{
#if defined (__GNUC__) || defined (__clang__)
return __builtin_isfinite (num);
#elif defined (WIN32)
#elif defined (_WIN32)
return isfinite (num);
#else
return !ecma_number_is_nan (num) && !ecma_number_is_infinity (num);
@@ -28,7 +28,7 @@
#include "jrt.h"
#include "jrt-libc-includes.h"
#if defined (WIN32)
#if defined (_WIN32)
#include <intrin.h>
#endif
@@ -553,7 +553,7 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
uint32_t n = ecma_number_to_uint32 (x);
#if defined (__GNUC__) || defined (__clang__)
x = n ? __builtin_clz (n) : 32;
#elif defined (WIN32)
#elif defined (_WIN32)
unsigned long ret;
x = _BitScanReverse (&ret, n) ? 31 - ret : 32;
#else
+3 -3
View File
@@ -17,7 +17,7 @@
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
#if (defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined WIN32
#if (defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined _WIN32
#include <errno.h>
#include <fcntl.h>
@@ -393,7 +393,7 @@ jerryx_debugger_serial_create (const char *config) /**< specify the configuratio
return true;
} /* jerryx_debugger_serial_create */
#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) || WIN32 */
#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) || _WIN32 */
/**
* Dummy function when debugger is disabled.
*
@@ -406,4 +406,4 @@ jerryx_debugger_serial_create (const char *config)
return false;
} /* jerryx_debugger_serial_create */
#endif /* (defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined WIN32 */
#endif /* (defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined _WIN32 */
+17 -17
View File
@@ -21,7 +21,7 @@
#include <errno.h>
#ifdef WIN32
#ifdef _WIN32
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#include <WS2tcpip.h>
@@ -36,7 +36,7 @@ typedef SSIZE_T ssize_t;
/* On Windows sockets have a SOCKET typedef */
typedef SOCKET jerryx_socket;
#else /* !WIN32 */
#else /* !_WIN32 */
#include <arpa/inet.h>
#include <fcntl.h>
@@ -51,7 +51,7 @@ typedef SOCKET jerryx_socket;
/* On *nix the sockets are integer identifiers */
typedef int jerryx_socket;
#endif /* WIN32 */
#endif /* _WIN32 */
/**
* Implementation of transport over tcp/ip.
@@ -74,11 +74,11 @@ typedef struct
static inline int
jerryx_debugger_tcp_get_errno (void)
{
#ifdef WIN32
#ifdef _WIN32
return WSAGetLastError ();
#else /* !WIN32 */
#else /* !_WIN32 */
return errno;
#endif /* WIN32 */
#endif /* _WIN32 */
} /* jerryx_debugger_tcp_get_errno */
/**
@@ -87,11 +87,11 @@ jerryx_debugger_tcp_get_errno (void)
static inline void
jerryx_debugger_tcp_close_socket (jerryx_socket socket_id) /**< socket to close */
{
#ifdef WIN32
#ifdef _WIN32
closesocket (socket_id);
#else /* !WIN32 */
#else /* !_WIN32 */
close (socket_id);
#endif /* WIN32 */
#endif /* _WIN32 */
} /* jerryx_debugger_tcp_close_socket */
/**
@@ -105,7 +105,7 @@ jerryx_debugger_tcp_log_error (int errno_value) /**< error value to log */
return;
}
#ifdef WIN32
#ifdef _WIN32
char *error_message = NULL;
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
@@ -116,9 +116,9 @@ jerryx_debugger_tcp_log_error (int errno_value) /**< error value to log */
NULL);
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "TCP Error: %s\n", error_message);
LocalFree (error_message);
#else /* !WIN32 */
#else /* !_WIN32 */
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "TCP Error: %s\n", strerror (errno_value));
#endif /* WIN32 */
#endif /* _WIN32 */
} /* jerryx_debugger_tcp_log_error */
/**
@@ -279,7 +279,7 @@ jerryx_debugger_tcp_configure_socket (jerryx_socket server_socket, /** < socket
bool
jerryx_debugger_tcp_create (uint16_t port) /**< listening port */
{
#ifdef WIN32
#ifdef _WIN32
WSADATA wsaData;
int wsa_init_status = WSAStartup (MAKEWORD (2, 2), &wsaData);
if (wsa_init_status != NO_ERROR)
@@ -287,7 +287,7 @@ jerryx_debugger_tcp_create (uint16_t port) /**< listening port */
JERRYX_ERROR_MSG ("WSA Error: %d\n", wsa_init_status);
return false;
}
#endif /* WIN32*/
#endif /* _WIN32*/
jerryx_socket server_socket = socket (AF_INET, SOCK_STREAM, 0);
if (server_socket == JERRYX_SOCKET_INVALID)
@@ -320,14 +320,14 @@ jerryx_debugger_tcp_create (uint16_t port) /**< listening port */
}
/* Set non-blocking mode. */
#ifdef WIN32
#ifdef _WIN32
u_long nonblocking_enabled = 1;
if (ioctlsocket (tcp_socket, FIONBIO, &nonblocking_enabled) != NO_ERROR)
{
jerryx_debugger_tcp_close_socket (tcp_socket);
return false;
}
#else /* !WIN32 */
#else /* !_WIN32 */
int socket_flags = fcntl (tcp_socket, F_GETFL, 0);
if (socket_flags < 0)
@@ -341,7 +341,7 @@ jerryx_debugger_tcp_create (uint16_t port) /**< listening port */
close (tcp_socket);
return false;
}
#endif /* WIN32 */
#endif /* _WIN32 */
JERRYX_DEBUG_MSG ("Connected from: %s\n", inet_ntoa (addr.sin_addr));
+3 -3
View File
@@ -19,13 +19,13 @@
#define _XOPEN_SOURCE 500
#endif
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
#elif defined (HAVE_TIME_H)
#include <time.h>
#elif defined (HAVE_UNISTD_H)
#include <unistd.h>
#endif /* WIN32 */
#endif /* _WIN32 */
#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
@@ -36,7 +36,7 @@
*/
void jerry_port_sleep (uint32_t sleep_time) /**< milliseconds to sleep */
{
#ifdef WIN32
#ifdef _WIN32
Sleep (sleep_time);
#elif defined (HAVE_TIME_H)
struct timespec sleep_timespec;
+3 -3
View File
@@ -13,9 +13,9 @@
* limitations under the License.
*/
#if !defined (WIN32)
#if !defined (_WIN32)
#include <libgen.h>
#endif /* !defined (WIN32) */
#endif /* !defined (_WIN32) */
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -116,7 +116,7 @@ jerry_port_normalize_path (const char *in_path_p, /**< input file path */
{
size_t ret = 0;
#if defined (WIN32)
#if defined (_WIN32)
size_t base_drive_dir_len;
const size_t in_path_len = strnlen (in_path_p, _MAX_PATH);
char *path_p;