mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Fixes needed to compile swift with MSVC with the /permissive- switch
which enables more C++ standard conformance.
This commit is contained in:
committed by
Klaus Basan
parent
919a31b250
commit
df563d5b29
@@ -175,6 +175,12 @@ defineTest(addLibraryDependency) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################
|
||||||
|
# Workarounds needed when using MSVC /permissive- flag
|
||||||
|
################################
|
||||||
|
|
||||||
|
msvc:contains(QMAKE_CXXFLAGS, /permissive-): QMAKE_CXXFLAGS *= /FIpermissiveworkarounds.h
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# Experimental support for Clang on Windows
|
# Experimental support for Clang on Windows
|
||||||
################################
|
################################
|
||||||
|
|||||||
@@ -70,6 +70,9 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef BLACK_USE_CRASHPAD
|
#ifdef BLACK_USE_CRASHPAD
|
||||||
|
#if defined(Q_OS_WIN) && !defined(NOMINMAX)
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include "crashpad/client/crashpad_client.h"
|
#include "crashpad/client/crashpad_client.h"
|
||||||
#include "crashpad/client/crash_report_database.h"
|
#include "crashpad/client/crash_report_database.h"
|
||||||
#include "crashpad/client/settings.h"
|
#include "crashpad/client/settings.h"
|
||||||
|
|||||||
@@ -279,7 +279,8 @@ namespace BlackMisc
|
|||||||
template <size_t I>
|
template <size_t I>
|
||||||
using index = std::integral_constant<size_t, I>;
|
using index = std::integral_constant<size_t, I>;
|
||||||
|
|
||||||
constexpr static auto members() { return MetaClass::getMemberList(); }
|
// Trailing return type needed to work around MSVC "function returning auto can not be used before it has been defined" with /permissive-
|
||||||
|
constexpr static auto members() -> decltype(MetaClass::getMemberList()) { return MetaClass::getMemberList(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Private
|
namespace Private
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
#include <libproc.h>
|
#include <libproc.h>
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
|
#ifndef NOMINMAX
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
14
src/permissiveworkarounds.h
Normal file
14
src/permissiveworkarounds.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/* Copyright (C) 2018
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
// Workaround for "unexpected token 'identifier'" in combaseapi.h when compiling with /permissive-
|
||||||
|
// https://developercommunity.visualstudio.com/solutions/187139/view.html
|
||||||
|
struct IUnknown;
|
||||||
@@ -165,7 +165,7 @@ namespace XSwiftBus
|
|||||||
|
|
||||||
//! Set the value of part of the string (if it is writable)
|
//! Set the value of part of the string (if it is writable)
|
||||||
void setSubstr(size_t offset, std::string const &s)
|
void setSubstr(size_t offset, std::string const &s)
|
||||||
{ assert((s.size() + 1) <= (DataRefTraits::size - offset)); XPLMSetDatab(m_ref, s.c_str(), offset, s.size() + 1); }
|
{ assert((s.size() + 1) <= (DataRefTraits::size - offset)); XPLMSetDatab(m_ref, (void *)s.c_str(), (int)offset, (int)s.size() + 1); }
|
||||||
|
|
||||||
//! Get the value of part of the string
|
//! Get the value of part of the string
|
||||||
std::string getSubstr(size_t offset, size_t size) const
|
std::string getSubstr(size_t offset, size_t size) const
|
||||||
|
|||||||
Reference in New Issue
Block a user