Skip to content

Commit

Permalink
Print warnings about unsupported OS/compiler only once.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Apr 29, 2021
1 parent ed29184 commit e1fc85d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions tdutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions tdutils/td/utils/port/platform.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Copyright Aliaksei Levin ([email protected]), Arseny Smirnov ([email protected]) 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
10 changes: 5 additions & 5 deletions tdutils/td/utils/port/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
#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
#define TD_DARWIN_TV_OS 1
#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__)
Expand All @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit e1fc85d

Please sign in to comment.