Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use constexpr function for platform detection #7220

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/common/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define UTILITY_H


#include "csync/ocsynclib.h"

Check failure on line 24 in src/common/utility.h

View workflow job for this annotation

GitHub Actions / build

src/common/utility.h:24:10 [clang-diagnostic-error]

'csync/ocsynclib.h' file not found
#include <QString>
#include <QByteArray>
#include <QDateTime>
Expand Down Expand Up @@ -141,11 +141,11 @@
OCSYNC_EXPORT bool hasDarkSystray();

// convenience OS detection methods
inline bool isWindows();
inline bool isMac();
inline bool isUnix();
inline bool isLinux(); // use with care
inline bool isBSD(); // use with care, does not match OS X
constexpr bool isWindows();
constexpr bool isMac();
constexpr bool isUnix();
constexpr bool isLinux(); // use with care
constexpr bool isBSD(); // use with care, does not match OS X

OCSYNC_EXPORT QString platformName();
// crash helper for --debug
Expand Down Expand Up @@ -311,7 +311,7 @@
}
/** @} */ // \addtogroup

inline bool Utility::isWindows()
inline constexpr bool Utility::isWindows()
{
#ifdef Q_OS_WIN
return true;
Expand All @@ -320,7 +320,7 @@
#endif
}

inline bool Utility::isMac()
inline constexpr bool Utility::isMac()
{
#ifdef Q_OS_MAC
return true;
Expand All @@ -329,7 +329,7 @@
#endif
}

inline bool Utility::isUnix()
inline constexpr bool Utility::isUnix()
{
#ifdef Q_OS_UNIX
return true;
Expand All @@ -338,7 +338,7 @@
#endif
}

inline bool Utility::isLinux()
inline constexpr bool Utility::isLinux()
{
#if defined(Q_OS_LINUX)
return true;
Expand All @@ -347,7 +347,7 @@
#endif
}

inline bool Utility::isBSD()
inline constexpr bool Utility::isBSD()
{
#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD)
return true;
Expand Down
Loading