mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refactor: Fix readability-use-concise-preprocessor-directives
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "misc/algorithm.h"
|
||||
|
||||
#if defined(Q_OS_POSIX)
|
||||
#ifdef Q_OS_POSIX
|
||||
# include <errno.h>
|
||||
# include <stdio.h>
|
||||
#elif defined(Q_OS_WIN32)
|
||||
@@ -29,7 +29,7 @@ namespace swift::misc
|
||||
{
|
||||
bool ok = true;
|
||||
{
|
||||
#if defined(Q_OS_WIN32)
|
||||
#ifdef Q_OS_WIN32
|
||||
QNtfsPermissionCheckGuard permissionGuard;
|
||||
#endif
|
||||
if ((mode & CAtomicFile::ReadOnly) && !fileInfo.isReadable()) { ok = false; }
|
||||
@@ -71,7 +71,7 @@ namespace swift::misc
|
||||
{
|
||||
if (!isOpen()) { return; }
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#ifdef Q_OS_WIN32
|
||||
FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(handle())));
|
||||
#endif
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace swift::misc
|
||||
36, QChar('0'));
|
||||
}
|
||||
|
||||
#if defined(Q_OS_POSIX)
|
||||
#ifdef Q_OS_POSIX
|
||||
void CAtomicFile::replaceOriginal()
|
||||
{
|
||||
auto result = ::rename(qPrintable(fileName()), qPrintable(m_originalFilename));
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#ifdef Q_OS_WIN32
|
||||
# include <windows.h>
|
||||
#elif defined(Q_OS_UNIX)
|
||||
# include <ctime>
|
||||
@@ -14,7 +14,7 @@
|
||||
namespace swift::misc
|
||||
{
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#ifdef Q_OS_WIN32
|
||||
|
||||
static int getCpuTimeMs(const FILETIME &kernelTime, const FILETIME &userTime)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
#ifdef Q_OS_MACOS
|
||||
# include <libproc.h>
|
||||
#elif defined(Q_OS_WIN)
|
||||
# ifndef NOMINMAX
|
||||
@@ -30,7 +30,7 @@ namespace swift::misc
|
||||
return QStringLiteral("{ %1, %2 }").arg(QString::number(m_pid), m_name);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
#ifdef Q_OS_LINUX
|
||||
QString CProcessInfo::processNameFromId(qint64 pid)
|
||||
{
|
||||
QString path = QFileInfo(QStringLiteral("/proc/%1/exe").arg(pid)).symLinkTarget();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "misc/fileutils.h"
|
||||
#include "misc/swiftdirectories.h"
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#ifdef Q_OS_WIN
|
||||
# include <ShlObj.h>
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace swift::misc::simulation::xplane
|
||||
return lastLine;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#ifdef Q_OS_WIN
|
||||
QString getWindowsLocalAppDataPath()
|
||||
{
|
||||
QString result;
|
||||
@@ -85,7 +85,7 @@ namespace swift::misc::simulation::xplane
|
||||
{
|
||||
//! \fixme KB 8/17 we could also use the runtime CBuildConfig decision here, which looks nicer (I personally
|
||||
//! always try to avoid ifdef)
|
||||
#if defined(Q_OS_WIN)
|
||||
#ifdef Q_OS_WIN
|
||||
return CFileUtils::appendFilePathsAndFixUnc(getWindowsLocalAppDataPath(), xplaneInstallFile);
|
||||
#elif defined(Q_OS_LINUX)
|
||||
static const QString xp(".x-plane");
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <QMutexLocker>
|
||||
#include <QStringBuilder>
|
||||
|
||||
#if defined(Q_CC_MSVC)
|
||||
#ifdef Q_CC_MSVC
|
||||
# include <Windows.h>
|
||||
|
||||
# pragma warning(push)
|
||||
@@ -33,13 +33,13 @@
|
||||
namespace swift::misc
|
||||
{
|
||||
|
||||
#if defined(QT_DEBUG)
|
||||
#ifdef QT_DEBUG
|
||||
QStringList getStackTrace() { return getStackTraceAlways(); }
|
||||
#else
|
||||
QStringList getStackTrace() { return { "No stack trace with release build" }; }
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
#ifdef Q_OS_WIN32
|
||||
QStringList getStackTraceAlways()
|
||||
{
|
||||
static QMutex mutex;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* Export a class or function from the library
|
||||
*/
|
||||
#ifndef WITH_STATIC
|
||||
# if defined(BUILD_SWIFT_MISC_LIB)
|
||||
# ifdef BUILD_SWIFT_MISC_LIB
|
||||
# define SWIFT_MISC_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define SWIFT_MISC_EXPORT Q_DECL_IMPORT
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
# include "crashpad/client/simulate_crash.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_CC_MSVC)
|
||||
#ifdef Q_CC_MSVC
|
||||
# include <Windows.h>
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_CC_CLANG)
|
||||
#ifdef Q_CC_CLANG
|
||||
# if __has_builtin(__builtin_debugtrap)
|
||||
# define SWIFT_BUILTIN_DEBUGTRAP __builtin_debugtrap
|
||||
# elif __has_builtin(__builtin_debugger)
|
||||
@@ -39,8 +39,8 @@ namespace swift::misc::private_ns
|
||||
Q_UNUSED(message)
|
||||
Q_UNUSED(audit)
|
||||
|
||||
#if defined(QT_DEBUG)
|
||||
# if defined(Q_CC_MSVC)
|
||||
#ifdef QT_DEBUG
|
||||
# ifdef Q_CC_MSVC
|
||||
if (!audit || IsDebuggerPresent())
|
||||
{
|
||||
__debugbreak();
|
||||
|
||||
Reference in New Issue
Block a user