From e5becbdfb97b9ec8c6b8f09ea405ec3289c6713d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 11 Nov 2016 14:26:52 +0100 Subject: [PATCH] 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 Reviewed-by: Tim Jenssen --- src/libs/utils/smallstringmemory.h | 8 +++++--- .../source/clangrefactoringbackend_global.h | 2 +- .../clangrefactoringbackend/source/sourcelocationsutils.h | 2 +- src/tools/clangrefactoringbackend/source/symbolfinder.cpp | 2 +- tests/unit/unittest/filesystem-utilities.h | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libs/utils/smallstringmemory.h b/src/libs/utils/smallstringmemory.h index 966d12159d8..c9687a09fb6 100644 --- a/src/libs/utils/smallstringmemory.h +++ b/src/libs/utils/smallstringmemory.h @@ -25,6 +25,8 @@ #pragma once +#include + #include #include #include @@ -35,7 +37,7 @@ namespace Memory { inline char *allocate(std::size_t size) { -#ifdef WIN32 +#ifdef Q_OS_WIN32 return static_cast(_aligned_malloc(size, 64)); #else return static_cast(std::malloc(size)); @@ -44,7 +46,7 @@ inline char *allocate(std::size_t size) inline void deallocate(char *memory) { -#ifdef WIN32 +#ifdef Q_OS_WIN32 _aligned_free(memory); #else #pragma GCC diagnostic push @@ -58,7 +60,7 @@ inline void deallocate(char *memory) inline char *reallocate(char *oldMemory, std::size_t newSize) { -#ifdef WIN32 +#ifdef Q_OS_WIN32 return static_cast(_aligned_realloc(oldMemory, newSize, 64)); #else return static_cast(std::realloc(oldMemory, newSize)); diff --git a/src/tools/clangrefactoringbackend/source/clangrefactoringbackend_global.h b/src/tools/clangrefactoringbackend/source/clangrefactoringbackend_global.h index fc286b8780e..30d4b2e1a08 100644 --- a/src/tools/clangrefactoringbackend/source/clangrefactoringbackend_global.h +++ b/src/tools/clangrefactoringbackend/source/clangrefactoringbackend_global.h @@ -35,7 +35,7 @@ namespace ClangBackEnd { using USRName = llvm::SmallVector; // use std::filesystem::path if it is supported by all compilers -#ifdef WIN32 +#ifdef _WIN32 const char nativeSeperator = '\\'; #else const char nativeSeperator = '/'; diff --git a/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h b/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h index 70e14b92d22..716c3ef5ee4 100644 --- a/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h +++ b/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h @@ -58,7 +58,7 @@ Utils::SmallString fromNativePath(Container container) { Utils::SmallString path(container.data(), container.size()); -#ifdef WIN32 +#ifdef _WIN32 std::replace(path.begin(), path.end(), '\\', '/'); #endif diff --git a/src/tools/clangrefactoringbackend/source/symbolfinder.cpp b/src/tools/clangrefactoringbackend/source/symbolfinder.cpp index 1b9a1e23f28..a86da245110 100644 --- a/src/tools/clangrefactoringbackend/source/symbolfinder.cpp +++ b/src/tools/clangrefactoringbackend/source/symbolfinder.cpp @@ -43,7 +43,7 @@ namespace { std::string toNativePath(std::string &&path) { -#ifdef WIN32 +#ifdef _WIN32 std::replace(path.begin(), path.end(), '/', '\\'); #endif diff --git a/tests/unit/unittest/filesystem-utilities.h b/tests/unit/unittest/filesystem-utilities.h index b102a596dcc..36b3e5ed703 100644 --- a/tests/unit/unittest/filesystem-utilities.h +++ b/tests/unit/unittest/filesystem-utilities.h @@ -28,7 +28,7 @@ #include // use std::filesystem::path if it is supported by all compilers -#ifdef WIN32 +#ifdef _WIN32 const char nativeSeperator = '\\'; #else const char nativeSeperator = '/'; @@ -37,7 +37,7 @@ const char nativeSeperator = '/'; inline std::string toNativePath(std::string &&path) { -#ifdef WIN32 +#ifdef _WIN32 std::replace(path.begin(), path.end(), '/', '\\'); #endif