From 3466a4a90a0628c1c44f06b49b38ebe709f831c6 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Tue, 28 Mar 2017 11:33:16 -0400
Subject: [PATCH] prevent TARGET_OS_IOS is not defined warnings

first check if TARGET_OS_IOS is defined to prevent warning:
configurationmanager_interface.h:285:29: warning: "TARGET_OS_IOS" is not defined [-Wundef]

Change-Id: Ia7611421992ca5d78cb6d0a4a79ec8499c2b15bc
Reviewed-by: Romain Bertozzi <romain.bertozzi@savoirfairelinux.com>
---
 src/client/ring_signal.cpp                 |  4 ++--
 src/dring/configurationmanager_interface.h |  4 ++--
 src/fileutils.cpp                          | 14 +++++++-------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/client/ring_signal.cpp b/src/client/ring_signal.cpp
index b8fd4b083f..b29ab291f6 100644
--- a/src/client/ring_signal.cpp
+++ b/src/client/ring_signal.cpp
@@ -73,10 +73,10 @@ getSignalHandlers()
         exported_callback<DRing::ConfigurationSignal::MigrationEnded>(),
         exported_callback<DRing::ConfigurationSignal::DeviceRevocationEnded>(),
         exported_callback<DRing::ConfigurationSignal::Error>(),
-#if defined(__ANDROID__) || TARGET_OS_IOS
+#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
         exported_callback<DRing::ConfigurationSignal::GetHardwareAudioFormat>(),
 #endif
-#if defined(__ANDROID__) || TARGET_OS_IOS || defined(RING_UWP)
+#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS) || defined(RING_UWP)
         exported_callback<DRing::ConfigurationSignal::GetAppDataPath>(),
 #endif
 
diff --git a/src/dring/configurationmanager_interface.h b/src/dring/configurationmanager_interface.h
index 409e0b1af9..ec08d52f91 100644
--- a/src/dring/configurationmanager_interface.h
+++ b/src/dring/configurationmanager_interface.h
@@ -282,13 +282,13 @@ struct ConfigurationSignal {
          * These are special getters for Android and UWP, so the daemon can retreive
          * information only accessible through their respective platform APIs
          */
-#if defined(__ANDROID__) || TARGET_OS_IOS
+#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
         struct GetHardwareAudioFormat {
                 constexpr static const char* name = "GetHardwareAudioFormat";
                 using cb_type = void(std::vector<int32_t>* /* params_ret */);
         };
 #endif
-#if defined(__ANDROID__) || defined(RING_UWP) || TARGET_OS_IOS
+#if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
         struct GetAppDataPath {
                 constexpr static const char* name = "GetAppDataPath";
                 using cb_type = void(const std::string& name, std::vector<std::string>* /* path_ret */);
diff --git a/src/fileutils.cpp b/src/fileutils.cpp
index c08336d215..0a5564af47 100644
--- a/src/fileutils.cpp
+++ b/src/fileutils.cpp
@@ -37,7 +37,7 @@
 #include <TargetConditionals.h>
 #endif
 
-#if defined(__ANDROID__) || TARGET_OS_IOS
+#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
 #include "client/ring_signal.h"
 #endif
 #ifdef _WIN32
@@ -175,7 +175,7 @@ create_pidfile()
 std::string
 expand_path(const std::string &path)
 {
-#if defined __ANDROID__ || defined RING_UWP || defined WIN32 || TARGET_OS_IOS
+#if defined __ANDROID__ || defined RING_UWP || defined WIN32 || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
     RING_ERR("Path expansion not implemented, returning original");
     return path;
 #else
@@ -417,7 +417,7 @@ FileHandle::~FileHandle()
     }
 }
 
-#if defined(__ANDROID__) || defined(RING_UWP) || TARGET_OS_IOS
+#if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
 static std::string files_path;
 static std::string cache_path;
 static std::string config_path;
@@ -451,7 +451,7 @@ get_cache_dir()
         return cache_home;
     } else {
 #endif
-#if defined(__ANDROID__) || TARGET_OS_IOS
+#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
         std::vector<std::string> paths;
         emitSignal<DRing::ConfigurationSignal::GetAppDataPath>("cache", &paths);
         if (not paths.empty())
@@ -473,7 +473,7 @@ get_cache_dir()
 std::string
 get_home_dir()
 {
-#if defined(__ANDROID__) || TARGET_OS_IOS
+#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
     std::vector<std::string> paths;
     emitSignal<DRing::ConfigurationSignal::GetAppDataPath>("files", &paths);
     if (not paths.empty())
@@ -517,7 +517,7 @@ get_home_dir()
 std::string
 get_data_dir()
 {
-#if defined(__ANDROID__) || TARGET_OS_IOS
+#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
     std::vector<std::string> paths;
     emitSignal<DRing::ConfigurationSignal::GetAppDataPath>("files", &paths);
     if (not paths.empty())
@@ -553,7 +553,7 @@ get_data_dir()
 std::string
 get_config_dir()
 {
-#if defined(__ANDROID__) || TARGET_OS_IOS
+#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
     std::vector<std::string> paths;
     emitSignal<DRing::ConfigurationSignal::GetAppDataPath>("config", &paths);
     if (not paths.empty())
-- 
GitLab