[前][次][番号順一覧][スレッド一覧]

ruby-changes:56052

From: Nobuyoshi <ko1@a...>
Date: Sat, 8 Jun 2019 19:45:39 +0900 (JST)
Subject: [ruby-changes:56052] Nobuyoshi Nakada: 27a59ca2c8 (trunk): file.c: fix compile error with MacPorts gcc

https://git.ruby-lang.org/ruby.git/commit/?id=27a59ca2c8

From 27a59ca2c846e14ec6dbcb86fd2d6f65399ff28d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 8 Jun 2019 19:40:55 +0900
Subject: file.c: fix compile error with MacPorts gcc

With the SDK of Xcode 10.2.1, `API_AVAILABLE` and so on macros are
not defined in <os/availability.h> when using a compiler other
than clang (which has `__has_feature` and `__has_attribute`), but
`__API_AVAILABLE` macro and so on are defined, which are also
defined in <Availability.h>.

I suspect this is a bug of the SDK.

diff --git a/file.c b/file.c
index a04fe53..3da358a 100644
--- a/file.c
+++ b/file.c
@@ -20,6 +20,14 @@ https://github.com/ruby/ruby/blob/trunk/file.c#L20
 #include <wchar.h>
 #endif
 #ifdef __APPLE__
+# if !(defined(__has_feature) && defined(__has_attribute))
+/* Maybe a bug in SDK of Xcode 10.2.1 */
+/* In this condition, <os/availability.h> does not define
+ * API_AVAILABLE and similar, but __API_AVAILABLE and similar which
+ * are defined in <Availability.h> */
+#   define API_AVAILABLE(...)
+#   define API_DEPRECATED(...)
+# endif
 #include <CoreFoundation/CFString.h>
 #endif
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]