Skip to content

Commit

Permalink
Merge pull request #7220 from nextcloud/tidy/improvePlatformDetection…
Browse files Browse the repository at this point in the history
…UtilityFunctions

use constexpr function for platform detection
  • Loading branch information
mgallien authored Sep 27, 2024
2 parents 47d16d3 + e6f6293 commit bb07ed4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/common/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ namespace Utility {
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 @@ namespace Utility {
}
/** @} */ // \addtogroup

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

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

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

inline bool Utility::isLinux()
inline constexpr bool Utility::isLinux()
{
#if defined(Q_OS_LINUX)
return true;
Expand All @@ -347,7 +347,7 @@ inline bool Utility::isLinux()
#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

0 comments on commit bb07ed4

Please sign in to comment.