Commit e5becbdf authored by Kai Koehne's avatar Kai Koehne

Replace WIN32 define with _WIN32

Only MinGW gcc defines WIN32, MSVC compiler does not. It's
also defined by qmake (msvc-desktop.conf), but not by qbs ...

Let's just use _WIN32, that's defined everywhere.

Change-Id: I8342a70498be54a965dcf7fae63eaf406aaa3c04
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 6d7bb54e
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#pragma once #pragma once
#include <qsystemdetection.h>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <memory> #include <memory>
...@@ -35,7 +37,7 @@ namespace Memory { ...@@ -35,7 +37,7 @@ namespace Memory {
inline char *allocate(std::size_t size) inline char *allocate(std::size_t size)
{ {
#ifdef WIN32 #ifdef Q_OS_WIN32
return static_cast<char*>(_aligned_malloc(size, 64)); return static_cast<char*>(_aligned_malloc(size, 64));
#else #else
return static_cast<char*>(std::malloc(size)); return static_cast<char*>(std::malloc(size));
...@@ -44,7 +46,7 @@ inline char *allocate(std::size_t size) ...@@ -44,7 +46,7 @@ inline char *allocate(std::size_t size)
inline void deallocate(char *memory) inline void deallocate(char *memory)
{ {
#ifdef WIN32 #ifdef Q_OS_WIN32
_aligned_free(memory); _aligned_free(memory);
#else #else
#pragma GCC diagnostic push #pragma GCC diagnostic push
...@@ -58,7 +60,7 @@ inline void deallocate(char *memory) ...@@ -58,7 +60,7 @@ inline void deallocate(char *memory)
inline char *reallocate(char *oldMemory, std::size_t newSize) inline char *reallocate(char *oldMemory, std::size_t newSize)
{ {
#ifdef WIN32 #ifdef Q_OS_WIN32
return static_cast<char*>(_aligned_realloc(oldMemory, newSize, 64)); return static_cast<char*>(_aligned_realloc(oldMemory, newSize, 64));
#else #else
return static_cast<char*>(std::realloc(oldMemory, newSize)); return static_cast<char*>(std::realloc(oldMemory, newSize));
......
...@@ -35,7 +35,7 @@ namespace ClangBackEnd { ...@@ -35,7 +35,7 @@ namespace ClangBackEnd {
using USRName = llvm::SmallVector<char, 128>; using USRName = llvm::SmallVector<char, 128>;
// use std::filesystem::path if it is supported by all compilers // use std::filesystem::path if it is supported by all compilers
#ifdef WIN32 #ifdef _WIN32
const char nativeSeperator = '\\'; const char nativeSeperator = '\\';
#else #else
const char nativeSeperator = '/'; const char nativeSeperator = '/';
......
...@@ -58,7 +58,7 @@ Utils::SmallString fromNativePath(Container container) ...@@ -58,7 +58,7 @@ Utils::SmallString fromNativePath(Container container)
{ {
Utils::SmallString path(container.data(), container.size()); Utils::SmallString path(container.data(), container.size());
#ifdef WIN32 #ifdef _WIN32
std::replace(path.begin(), path.end(), '\\', '/'); std::replace(path.begin(), path.end(), '\\', '/');
#endif #endif
......
...@@ -43,7 +43,7 @@ namespace { ...@@ -43,7 +43,7 @@ namespace {
std::string toNativePath(std::string &&path) std::string toNativePath(std::string &&path)
{ {
#ifdef WIN32 #ifdef _WIN32
std::replace(path.begin(), path.end(), '/', '\\'); std::replace(path.begin(), path.end(), '/', '\\');
#endif #endif
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <string> #include <string>
// use std::filesystem::path if it is supported by all compilers // use std::filesystem::path if it is supported by all compilers
#ifdef WIN32 #ifdef _WIN32
const char nativeSeperator = '\\'; const char nativeSeperator = '\\';
#else #else
const char nativeSeperator = '/'; const char nativeSeperator = '/';
...@@ -37,7 +37,7 @@ const char nativeSeperator = '/'; ...@@ -37,7 +37,7 @@ const char nativeSeperator = '/';
inline inline
std::string toNativePath(std::string &&path) std::string toNativePath(std::string &&path)
{ {
#ifdef WIN32 #ifdef _WIN32
std::replace(path.begin(), path.end(), '/', '\\'); std::replace(path.begin(), path.end(), '/', '\\');
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment