Skip to content

Commit 59c903c

Browse files
committed
refactor: Fix readability-use-concise-preprocessor-directives
1 parent 1b46aab commit 59c903c

File tree

16 files changed

+31
-30
lines changed

16 files changed

+31
-30
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Checks: >
5151
cppcoreguidelines-init-variables,
5252
readability-static-accessed-through-instance,
5353
readability-simplify-boolean-expr,
54+
readability-use-concise-preprocessor-directives,
5455
5556
CheckOptions:
5657
- key: readability-identifier-naming.ClassCase

src/core/swiftcoreexport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
#ifndef WITH_STATIC
17-
# if defined(BUILD_SWIFT_CORE_LIB)
17+
# ifdef BUILD_SWIFT_CORE_LIB
1818
# define SWIFT_CORE_EXPORT Q_DECL_EXPORT
1919
# else
2020
# define SWIFT_CORE_EXPORT Q_DECL_IMPORT

src/gui/swiftguiexport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Export a class or function from the library
1414
*/
1515
#ifndef WITH_STATIC
16-
# if defined(BUILD_SWIFT_GUI_LIB)
16+
# ifdef BUILD_SWIFT_GUI_LIB
1717
# define SWIFT_GUI_EXPORT Q_DECL_EXPORT
1818
# else
1919
# define SWIFT_GUI_EXPORT Q_DECL_IMPORT

src/input/joystick.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "joystick.h"
55

6-
#if defined(Q_OS_WIN)
6+
#ifdef Q_OS_WIN
77
# include "win/joystickwindows.h"
88
#elif defined(Q_OS_LINUX)
99
# include "linux/joysticklinux.h"
@@ -20,7 +20,7 @@ namespace swift::input
2020

2121
std::unique_ptr<IJoystick> IJoystick::create(QObject *parent)
2222
{
23-
#if defined(Q_OS_WIN)
23+
#ifdef Q_OS_WIN
2424
std::unique_ptr<IJoystick> ptr(new CJoystickWindows(parent));
2525
#elif defined(Q_OS_LINUX)
2626
std::unique_ptr<IJoystick> ptr(new CJoystickLinux(parent));

src/input/keyboard.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "keyboard.h"
55

6-
#if defined(Q_OS_WIN)
6+
#ifdef Q_OS_WIN
77
# include "win/keyboardwindows.h"
88
#elif defined(Q_OS_LINUX)
99
# include "linux/keyboardlinux.h"
@@ -19,7 +19,7 @@ namespace swift::input
1919

2020
std::unique_ptr<IKeyboard> IKeyboard::create(QObject *parent)
2121
{
22-
#if defined(Q_OS_WIN)
22+
#ifdef Q_OS_WIN
2323
std::unique_ptr<IKeyboard> ptr(new CKeyboardWindows(parent));
2424
#elif defined(Q_OS_LINUX)
2525
std::unique_ptr<IKeyboard> ptr(new CKeyboardLinux(parent));

src/input/swiftinputexport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
#ifndef WITH_STATIC
17-
# if defined(BUILD_SWIFT_INPUT_LIB)
17+
# ifdef BUILD_SWIFT_INPUT_LIB
1818
# define SWIFT_INPUT_EXPORT Q_DECL_EXPORT
1919
# else
2020
# define SWIFT_INPUT_EXPORT Q_DECL_IMPORT

src/misc/atomicfile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "misc/algorithm.h"
1414

15-
#if defined(Q_OS_POSIX)
15+
#ifdef Q_OS_POSIX
1616
# include <errno.h>
1717
# include <stdio.h>
1818
#elif defined(Q_OS_WIN32)
@@ -29,7 +29,7 @@ namespace swift::misc
2929
{
3030
bool ok = true;
3131
{
32-
#if defined(Q_OS_WIN32)
32+
#ifdef Q_OS_WIN32
3333
QNtfsPermissionCheckGuard permissionGuard;
3434
#endif
3535
if ((mode & CAtomicFile::ReadOnly) && !fileInfo.isReadable()) { ok = false; }
@@ -71,7 +71,7 @@ namespace swift::misc
7171
{
7272
if (!isOpen()) { return; }
7373

74-
#if defined(Q_OS_WIN32)
74+
#ifdef Q_OS_WIN32
7575
FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(handle())));
7676
#endif
7777

@@ -118,7 +118,7 @@ namespace swift::misc
118118
36, QChar('0'));
119119
}
120120

121-
#if defined(Q_OS_POSIX)
121+
#ifdef Q_OS_POSIX
122122
void CAtomicFile::replaceOriginal()
123123
{
124124
auto result = ::rename(qPrintable(fileName()), qPrintable(m_originalFilename));

src/misc/cputime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <QtGlobal>
77

8-
#if defined(Q_OS_WIN32)
8+
#ifdef Q_OS_WIN32
99
# include <windows.h>
1010
#elif defined(Q_OS_UNIX)
1111
# include <ctime>
@@ -14,7 +14,7 @@
1414
namespace swift::misc
1515
{
1616

17-
#if defined(Q_OS_WIN32)
17+
#ifdef Q_OS_WIN32
1818

1919
static int getCpuTimeMs(const FILETIME &kernelTime, const FILETIME &userTime)
2020
{

src/misc/processinfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <QFile>
99
#include <QFileInfo>
1010

11-
#if defined(Q_OS_MACOS)
11+
#ifdef Q_OS_MACOS
1212
# include <libproc.h>
1313
#elif defined(Q_OS_WIN)
1414
# ifndef NOMINMAX
@@ -30,7 +30,7 @@ namespace swift::misc
3030
return QStringLiteral("{ %1, %2 }").arg(QString::number(m_pid), m_name);
3131
}
3232

33-
#if defined(Q_OS_LINUX)
33+
#ifdef Q_OS_LINUX
3434
QString CProcessInfo::processNameFromId(qint64 pid)
3535
{
3636
QString path = QFileInfo(QStringLiteral("/proc/%1/exe").arg(pid)).symLinkTarget();

src/misc/simulation/xplane/xplaneutil.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "misc/fileutils.h"
1616
#include "misc/swiftdirectories.h"
1717

18-
#if defined(Q_OS_WIN)
18+
#ifdef Q_OS_WIN
1919
# include <ShlObj.h>
2020
#endif
2121

@@ -47,7 +47,7 @@ namespace swift::misc::simulation::xplane
4747
return lastLine;
4848
}
4949

50-
#if defined(Q_OS_WIN)
50+
#ifdef Q_OS_WIN
5151
QString getWindowsLocalAppDataPath()
5252
{
5353
QString result;
@@ -85,7 +85,7 @@ namespace swift::misc::simulation::xplane
8585
{
8686
//! \fixme KB 8/17 we could also use the runtime CBuildConfig decision here, which looks nicer (I personally
8787
//! always try to avoid ifdef)
88-
#if defined(Q_OS_WIN)
88+
#ifdef Q_OS_WIN
8989
return CFileUtils::appendFilePathsAndFixUnc(getWindowsLocalAppDataPath(), xplaneInstallFile);
9090
#elif defined(Q_OS_LINUX)
9191
static const QString xp(".x-plane");

0 commit comments

Comments
 (0)