From e1fc85d6101988f1a79102936923c8841fad9828 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 30 Apr 2021 01:24:42 +0300 Subject: [PATCH] Print warnings about unsupported OS/compiler only once. --- tdutils/CMakeLists.txt | 1 + tdutils/td/utils/port/platform.cpp | 23 +++++++++++++++++++++++ tdutils/td/utils/port/platform.h | 10 +++++----- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 tdutils/td/utils/port/platform.cpp diff --git a/tdutils/CMakeLists.txt b/tdutils/CMakeLists.txt index 2fb587663..7fe0d9340 100644 --- a/tdutils/CMakeLists.txt +++ b/tdutils/CMakeLists.txt @@ -51,6 +51,7 @@ set(TDUTILS_SOURCE td/utils/port/IPAddress.cpp td/utils/port/MemoryMapping.cpp td/utils/port/path.cpp + td/utils/port/platform.cpp td/utils/port/PollFlags.cpp td/utils/port/rlimit.cpp td/utils/port/ServerSocketFd.cpp diff --git a/tdutils/td/utils/port/platform.cpp b/tdutils/td/utils/port/platform.cpp new file mode 100644 index 000000000..615cc8b65 --- /dev/null +++ b/tdutils/td/utils/port/platform.cpp @@ -0,0 +1,23 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +#include "td/utils/port/platform.h" + +#if !TD_MSVC + +#if TD_DARWIN_UNKNOWN +#warning "Probably unsupported Apple operating system. Feel free to try to compile" +#endif + +#if TD_UNIX_UNKNOWN +#warning "Probably unsupported Unix operating system. Feel free to try to compile" +#endif + +#if TD_COMPILER_UNKNOWN +#warning "Probably unsupported compiler. Feel free to try to compile" +#endif + +#endif \ No newline at end of file diff --git a/tdutils/td/utils/port/platform.h b/tdutils/td/utils/port/platform.h index 1a596c3ed..fb881f134 100644 --- a/tdutils/td/utils/port/platform.h +++ b/tdutils/td/utils/port/platform.h @@ -20,7 +20,7 @@ #elif defined(__APPLE__) #include "TargetConditionals.h" #if TARGET_OS_IPHONE - // iOS/watchOS/tvOS + // iOS/iPadOS/watchOS/tvOS #if TARGET_OS_IOS #define TD_DARWIN_IOS 1 #elif TARGET_OS_TV @@ -28,13 +28,13 @@ #elif TARGET_OS_WATCH #define TD_DARWIN_WATCH_OS 1 #else - #warning "Probably unsupported Apple iPhone platform. Feel free to try to compile" + #define TD_DARWIN_UNKNOWN 1 #endif #elif TARGET_OS_MAC // Other kinds of macOS #define TD_DARWIN_MAC 1 #else - #warning "Probably unsupported Apple platform. Feel free to try to compile" + #define TD_DARWIN_UNKNOWN 1 #endif #define TD_DARWIN 1 #elif defined(ANDROID) || defined(__ANDROID__) @@ -55,7 +55,7 @@ #define TD_EMSCRIPTEN 1 #elif defined(TD_ILLUMOS) #elif defined(__unix__) // all unices not caught above - #warning "Probably unsupported Unix platform. Feel free to try to compile" + #define TD_UNIX_UNKNOWN 1 #define TD_CYGWIN 1 #else #error "Probably unsupported platform. Feel free to remove the error and try to recompile" @@ -70,7 +70,7 @@ #elif defined(_MSC_VER) #define TD_MSVC 1 #else - #warning "Probably unsupported compiler. Feel free to try to compile" + #define TD_COMPILER_UNKNOWN 1 #endif #if TD_GCC || TD_CLANG || TD_INTEL