Change #if-ery to be more in line with cmake logic (LINUX = NOT WIN32 AND NOT APPLE)

This commit is contained in:
Ilya Fedin 2023-09-15 09:51:42 +04:00 committed by John Preston
parent c12743925e
commit 7906be37b6
19 changed files with 93 additions and 93 deletions

View File

@ -267,7 +267,7 @@ int main(int argc, char *argv[])
} }
QByteArray inner = f.readAll(); QByteArray inner = f.readAll();
stream << name << quint32(inner.size()) << inner; stream << name << quint32(inner.size()) << inner;
#ifdef Q_OS_UNIX #ifndef Q_OS_WIN
stream << (QFileInfo(fullName).isExecutable() ? true : false); stream << (QFileInfo(fullName).isExecutable() ? true : false);
#endif #endif
} }
@ -496,7 +496,7 @@ int main(int argc, char *argv[])
QString outName((targetwin64 ? QString("tx64upd%1") : QString("tupdate%1")).arg(AlphaVersion ? AlphaVersion : version)); QString outName((targetwin64 ? QString("tx64upd%1") : QString("tupdate%1")).arg(AlphaVersion ? AlphaVersion : version));
#elif defined Q_OS_MAC #elif defined Q_OS_MAC
QString outName((targetarmac ? QString("tarmacupd%1") : QString("tmacupd%1")).arg(AlphaVersion ? AlphaVersion : version)); QString outName((targetarmac ? QString("tarmacupd%1") : QString("tmacupd%1")).arg(AlphaVersion ? AlphaVersion : version));
#elif defined Q_OS_UNIX #else
QString outName(QString("tlinuxupd%1").arg(AlphaVersion ? AlphaVersion : version)); QString outName(QString("tlinuxupd%1").arg(AlphaVersion ? AlphaVersion : version));
#else #else
#error Unknown platform! #error Unknown platform!

View File

@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <client/windows/handler/exception_handler.h> #include <client/windows/handler/exception_handler.h>
#pragma warning(pop) #pragma warning(pop)
#elif defined Q_OS_UNIX // Q_OS_WIN #else // Q_OS_WIN
#include <execinfo.h> #include <execinfo.h>
#include <sys/syscall.h> #include <sys/syscall.h>
@ -197,13 +197,15 @@ const int HandledSignals[] = {
SIGABRT, SIGABRT,
SIGFPE, SIGFPE,
SIGILL, SIGILL,
#ifdef Q_OS_UNIX #ifndef Q_OS_WIN
SIGBUS, SIGBUS,
SIGTRAP, SIGTRAP,
#endif // Q_OS_UNIX #endif // !Q_OS_WIN
}; };
#ifdef Q_OS_UNIX #ifdef Q_OS_WIN
void SignalHandler(int signum) {
#else // Q_OS_WIN
struct sigaction OldSigActions[32]/* = { 0 }*/; struct sigaction OldSigActions[32]/* = { 0 }*/;
void RestoreSignalHandlers() { void RestoreSignalHandlers() {
@ -229,9 +231,7 @@ void InvokeOldSignalHandler(int signum, siginfo_t *info, void *ucontext) {
void SignalHandler(int signum, siginfo_t *info, void *ucontext) { void SignalHandler(int signum, siginfo_t *info, void *ucontext) {
RestoreSignalHandlers(); RestoreSignalHandlers();
#else // Q_OS_UNIX #endif // else for Q_OS_WIN
void SignalHandler(int signum) {
#endif // else for Q_OS_UNIX
const char* name = 0; const char* name = 0;
switch (signum) { switch (signum) {
@ -253,9 +253,9 @@ void SignalHandler(int signum) {
ReportingThreadId = nullptr; ReportingThreadId = nullptr;
} }
#ifdef Q_OS_UNIX #ifndef Q_OS_WIN
InvokeOldSignalHandler(signum, info, ucontext); InvokeOldSignalHandler(signum, info, ucontext);
#endif // Q_OS_UNIX #endif // !Q_OS_WIN
} }
bool SetSignalHandlers = true; bool SetSignalHandlers = true;
@ -267,9 +267,9 @@ google_breakpad::ExceptionHandler* BreakpadExceptionHandler = 0;
bool DumpCallback(const wchar_t* _dump_dir, const wchar_t* _minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool success) bool DumpCallback(const wchar_t* _dump_dir, const wchar_t* _minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool success)
#elif defined Q_OS_MAC // Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WIN
bool DumpCallback(const char* _dump_dir, const char* _minidump_id, void *context, bool success) bool DumpCallback(const char* _dump_dir, const char* _minidump_id, void *context, bool success)
#elif defined Q_OS_UNIX // Q_OS_MAC #else // Q_OS_MAC
bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context, bool success) bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context, bool success)
#endif // Q_OS_UNIX #endif // else for Q_OS_WIN || Q_OS_MAC
{ {
if (CrashLogged) return success; if (CrashLogged) return success;
CrashLogged = true; CrashLogged = true;
@ -370,7 +370,7 @@ void StartCatching() {
false)) { // asynchronous_start false)) { // asynchronous_start
} }
#endif // else for MAC_USE_BREAKPAD #endif // else for MAC_USE_BREAKPAD
#elif defined Q_OS_UNIX #else
BreakpadExceptionHandler = new google_breakpad::ExceptionHandler( BreakpadExceptionHandler = new google_breakpad::ExceptionHandler(
google_breakpad::MinidumpDescriptor(QFile::encodeName(dumpspath).toStdString()), google_breakpad::MinidumpDescriptor(QFile::encodeName(dumpspath).toStdString()),
/*FilterCallback*/ 0, /*FilterCallback*/ 0,
@ -379,7 +379,7 @@ void StartCatching() {
true, true,
-1 -1
); );
#endif // Q_OS_UNIX #endif // else for Q_OS_WIN || Q_OS_MAC
#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS #endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS
} }

View File

@ -49,9 +49,9 @@ extern "C" {
#endif // else of Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED #endif // else of Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
#endif // !TDESKTOP_DISABLE_AUTOUPDATE #endif // !TDESKTOP_DISABLE_AUTOUPDATE
#ifdef Q_OS_UNIX #ifndef Q_OS_WIN
#include <unistd.h> #include <unistd.h>
#endif // Q_OS_UNIX #endif // !Q_OS_WIN
namespace Core { namespace Core {
namespace { namespace {
@ -448,9 +448,9 @@ bool UnpackUpdate(const QString &filepath) {
bool executable = false; bool executable = false;
stream >> relativeName >> fileSize >> fileInnerData; stream >> relativeName >> fileSize >> fileInnerData;
#ifdef Q_OS_UNIX #ifndef Q_OS_WIN
stream >> executable; stream >> executable;
#endif // Q_OS_UNIX #endif // !Q_OS_WIN
if (stream.status() != QDataStream::Ok) { if (stream.status() != QDataStream::Ok) {
LOG(("Update Error: cant read file from downloaded stream, status: %1").arg(stream.status())); LOG(("Update Error: cant read file from downloaded stream, status: %1").arg(stream.status()));
return false; return false;
@ -1554,10 +1554,10 @@ bool checkReadyUpdate() {
#elif defined Q_OS_MAC // Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WIN
QString curUpdater = (cExeDir() + cExeName() + u"/Contents/Frameworks/Updater"_q); QString curUpdater = (cExeDir() + cExeName() + u"/Contents/Frameworks/Updater"_q);
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Telegram.app/Contents/Frameworks/Updater"_q); QFileInfo updater(cWorkingDir() + u"tupdates/temp/Telegram.app/Contents/Frameworks/Updater"_q);
#elif defined Q_OS_UNIX // Q_OS_MAC #else // Q_OS_MAC
QString curUpdater = (cExeDir() + u"Updater"_q); QString curUpdater = (cExeDir() + u"Updater"_q);
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Updater"_q); QFileInfo updater(cWorkingDir() + u"tupdates/temp/Updater"_q);
#endif // Q_OS_UNIX #endif // else for Q_OS_WIN || Q_OS_MAC
if (!updater.exists()) { if (!updater.exists()) {
QFileInfo current(curUpdater); QFileInfo current(curUpdater);
if (!current.exists()) { if (!current.exists()) {
@ -1591,7 +1591,7 @@ bool checkReadyUpdate() {
ClearAll(); ClearAll();
return false; return false;
} }
#elif defined Q_OS_UNIX // Q_OS_MAC #else // Q_OS_MAC
// if the files in the directory are owned by user, while the directory is not, // if the files in the directory are owned by user, while the directory is not,
// update will still fail since it's not possible to remove files // update will still fail since it's not possible to remove files
if (QFile::exists(curUpdater) if (QFile::exists(curUpdater)
@ -1619,7 +1619,7 @@ bool checkReadyUpdate() {
return false; return false;
} }
} }
#endif // Q_OS_UNIX #endif // else for Q_OS_WIN || Q_OS_MAC
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
base::Platform::RemoveQuarantine(QFileInfo(curUpdater).absolutePath()); base::Platform::RemoveQuarantine(QFileInfo(curUpdater).absolutePath());

View File

@ -159,14 +159,7 @@ wv xm xml ym yuv").split(' ');
bool IsExecutableName(const QString &filepath) { bool IsExecutableName(const QString &filepath) {
static const auto kExtensions = [] { static const auto kExtensions = [] {
const auto joined = const auto joined =
#ifdef Q_OS_MAC #ifdef Q_OS_WIN
u"\
applescript action app bin command csh osx workflow terminal url caction \
mpkg pkg scpt scptd xhtm webarchive"_q;
#elif defined Q_OS_UNIX // Q_OS_MAC
u"bin csh deb desktop ksh out pet pkg pup rpm run sh shar \
slp zsh"_q;
#else // Q_OS_MAC || Q_OS_UNIX
u"\ u"\
ad ade adp app application appref-ms asp asx bas bat bin cab cdxml cer cfg \ ad ade adp app application appref-ms asp asx bas bat bin cab cdxml cer cfg \
chi chm cmd cnt com cpl crt csh der diagcab dll drv eml exe fon fxp gadget \ chi chm cmd cnt com cpl crt csh der diagcab dll drv eml exe fon fxp gadget \
@ -179,7 +172,14 @@ psd1 psm1 pssc pst py py3 pyc pyd pyi pyo pyw pywz pyz rb reg rgs scf scr \
sct search-ms settingcontent-ms sh shb shs slk sys t tmp u3p url vb vbe vbp \ sct search-ms settingcontent-ms sh shb shs slk sys t tmp u3p url vb vbe vbp \
vbs vbscript vdx vsmacros vsd vsdm vsdx vss vssm vssx vst vstm vstx vsw vsx \ vbs vbscript vdx vsmacros vsd vsdm vsdx vss vssm vssx vst vstm vstx vsw vsx \
vtx website ws wsc wsf wsh xbap xll xnk xs"_q; vtx website ws wsc wsf wsh xbap xll xnk xs"_q;
#endif // !Q_OS_MAC && !Q_OS_UNIX #elif defined Q_OS_MAC // Q_OS_MAC
u"\
applescript action app bin command csh osx workflow terminal url caction \
mpkg pkg scpt scptd xhtm webarchive"_q;
#else // Q_OS_WIN || Q_OS_MAC
u"bin csh deb desktop ksh out pet pkg pup rpm run sh shar \
slp zsh"_q;
#endif // !Q_OS_WIN && !Q_OS_MAC
const auto list = joined.split(' '); const auto list = joined.split(' ');
return base::flat_set<QString>(list.begin(), list.end()); return base::flat_set<QString>(list.begin(), list.end());
}(); }();

View File

@ -560,7 +560,7 @@ void writeDebug(const QString &v) {
//OutputDebugString(reinterpret_cast<const wchar_t *>(msg.utf16())); //OutputDebugString(reinterpret_cast<const wchar_t *>(msg.utf16()));
#elif defined Q_OS_MAC #elif defined Q_OS_MAC
//objc_outputDebugString(msg); //objc_outputDebugString(msg);
#elif defined Q_OS_UNIX && defined _DEBUG #elif defined _DEBUG
//std::cout << msg.toUtf8().constData(); //std::cout << msg.toUtf8().constData();
#endif #endif
} }

View File

@ -43,10 +43,10 @@ bool Get(
// Platform dependent implementations. // Platform dependent implementations.
#ifdef Q_OS_MAC #if defined Q_OS_WINRT || defined Q_OS_WIN
#include "platform/mac/file_utilities_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/file_utilities_linux.h"
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#include "platform/win/file_utilities_win.h" #include "platform/win/file_utilities_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WINRT || Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
#include "platform/mac/file_utilities_mac.h"
#else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
#include "platform/linux/file_utilities_linux.h"
#endif // else for Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC

View File

@ -7,13 +7,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "platform/platform_integration.h" #include "platform/platform_integration.h"
#ifdef Q_OS_MAC #if defined Q_OS_WINRT || defined Q_OS_WIN
#include "platform/mac/integration_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/integration_linux.h"
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#include "platform/win/integration_win.h" #include "platform/win/integration_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WINRT || Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
#include "platform/mac/integration_mac.h"
#else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
#include "platform/linux/integration_linux.h"
#endif // else Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
namespace Platform { namespace Platform {
namespace { namespace {

View File

@ -21,10 +21,10 @@ namespace Platform {
// Platform dependent implementations. // Platform dependent implementations.
#ifdef Q_OS_MAC #if defined Q_OS_WINRT || defined Q_OS_WIN
#include "platform/mac/launcher_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/launcher_linux.h"
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#include "platform/win/launcher_win.h" #include "platform/win/launcher_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WINRT || Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
#include "platform/mac/launcher_mac.h"
#else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
#include "platform/linux/launcher_linux.h"
#endif // else for Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC

View File

@ -17,10 +17,10 @@ class MainWindow;
// Platform dependent implementations. // Platform dependent implementations.
#ifdef Q_OS_MAC #ifdef Q_OS_WIN
#include "platform/mac/main_window_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/main_window_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#include "platform/win/main_window_win.h" #include "platform/win/main_window_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WIN
#include "platform/mac/main_window_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/main_window_linux.h"
#endif // else Q_OS_WIN || Q_OS_MAC

View File

@ -27,10 +27,10 @@ void Create(Window::Notifications::System *system);
// Platform dependent implementations. // Platform dependent implementations.
#ifdef Q_OS_MAC #ifdef Q_OS_WIN
#include "platform/mac/notifications_manager_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/notifications_manager_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#include "platform/win/notifications_manager_win.h" #include "platform/win/notifications_manager_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_MAC
#include "platform/mac/notifications_manager_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/notifications_manager_linux.h"
#endif // else for Q_OS_WIN || Q_OS_MAC

View File

@ -95,10 +95,10 @@ private:
// Platform dependent implementations. // Platform dependent implementations.
#ifdef Q_OS_MAC #ifdef Q_OS_WIN
#include "platform/mac/overlay_widget_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/overlay_widget_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#include "platform/win/overlay_widget_win.h" #include "platform/win/overlay_widget_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WIN
#include "platform/mac/overlay_widget_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/overlay_widget_linux.h"
#endif // else for Q_OS_WIN || Q_OS_MAC

View File

@ -63,10 +63,10 @@ void finish();
} // namespace ThirdParty } // namespace ThirdParty
} // namespace Platform } // namespace Platform
#ifdef Q_OS_MAC #ifdef Q_OS_WIN
#include "platform/mac/specific_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/specific_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#include "platform/win/specific_win.h" #include "platform/win/specific_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WIN
#include "platform/mac/specific_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/specific_linux.h"
#endif // else for Q_OS_WIN || Q_OS_MAC

View File

@ -15,10 +15,10 @@ class Tray;
// Platform dependent implementations. // Platform dependent implementations.
#ifdef Q_OS_MAC #ifdef Q_OS_WIN
#include "platform/mac/tray_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/tray_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#include "platform/win/tray_win.h" #include "platform/win/tray_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN #elif defined Q_OS_MAC // Q_OS_WIN
#include "platform/mac/tray_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/tray_linux.h"
#endif // else for Q_OS_WIN || Q_OS_MAC

View File

@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "platform/platform_notifications_manager.h" #include "platform/platform_notifications_manager.h"
#include "base/platform/base_platform_info.h" #include "base/platform/base_platform_info.h"
#include "base/call_delayed.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "core/application.h" #include "core/application.h"
#include "main/main_session.h" #include "main/main_session.h"
@ -49,7 +50,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
#include <QSvgRenderer> #include <QSvgRenderer>
#include <QTimer>
namespace Settings { namespace Settings {
namespace { namespace {
@ -675,11 +675,11 @@ void NotificationsCount::SampleWidget::destroyDelayed() {
_deleted = true; _deleted = true;
// Ubuntu has a lag if deleteLater() called immediately. // Ubuntu has a lag if deleteLater() called immediately.
#if defined Q_OS_UNIX && !defined Q_OS_MAC if constexpr (Platform::IsLinux()) {
QTimer::singleShot(1000, [this] { delete this; }); base::call_delayed(1000, this, [this] { delete this; });
#else // Q_OS_UNIX && !Q_OS_MAC } else {
deleteLater(); deleteLater();
#endif // Q_OS_UNIX && !Q_OS_MAC }
} }
class NotifyPreview final { class NotifyPreview final {

View File

@ -76,9 +76,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QOpenGLWidget> #include <QOpenGLWidget>
// Fix Google Breakpad build for Mac App Store and Linux version // Fix Google Breakpad build for Mac App Store and Linux version
#ifdef Q_OS_UNIX #ifndef Q_OS_WIN
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif // Q_OS_UNIX #endif // !Q_OS_WIN
// Remove 'small' macro definition. // Remove 'small' macro definition.
#ifdef Q_OS_WIN #ifdef Q_OS_WIN

@ -1 +1 @@
Subproject commit 07d3c631d45f2ce50e8373dc934827350ed20758 Subproject commit ed2134a980be19258b2e7c557367c12b94fda35d

@ -1 +1 @@
Subproject commit dfc42b20ce602b105e5400e03eed626fd5bab7df Subproject commit 135cb95b1606b9051b3a150a99b9db9c20bb1c11

@ -1 +1 @@
Subproject commit 839609369d04615475cb1518636de3619106a917 Subproject commit 1dfd1c186dd67e8de5f0721e6fae487a05f3ea94

@ -1 +1 @@
Subproject commit 8f7fe24ac49e5644749770f54e81fb5290c354d5 Subproject commit 8d005bc820ac2653d15c07d974ede1e17a6ce0fa