summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-09-10 03:22:26 (GMT)
committer卜部昌平 <shyouhei@ruby-lang.org>2019-09-10 03:25:36 (GMT)
commit20e428ec40ee1c83708b3ade6a0007ab2a435f83 (patch)
tree8b155d47ed40fafbc7dca4bd55739ab2e670193a
parent8d3db4f26cbbc920c717dfa2784a467014b954a6 (diff)
fix CentOS 6 compile error
See also https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-master/log/20190910T003005Z.fail.html.gz
-rw-r--r--configure.ac15
-rw-r--r--include/ruby/backward/cxxanyargs.hpp34
-rw-r--r--include/ruby/defines.h3
-rw-r--r--win32/Makefile.sub1
4 files changed, 36 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index 94e07e7..c2197f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1399,6 +1399,21 @@ AS_IF([test "$rb_cv_func_weak" != x], [
AC_DEFINE(HAVE_FUNC_WEAK)
])
+AC_CACHE_CHECK([for __attribute__((__depreacted__(msg))) in C++],
+ rb_cv_CentOS6_CXX_workaround,
+ RUBY_WERROR_FLAG([
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [],
+ [__attribute__((__deprecated__("message"))) int conftest(...);])],
+ [rb_cv_CentOS6_CXX_workaround=yes],
+ [rb_cv_CentOS6_CXX_workaround=no])
+ AC_LANG_POP()]))
+AS_IF([test "rb_cv_CentOS6_CXX_workaround" != no],[
+ AC_DEFINE([RUBY_CXX_DEPRECATED(msg)],
+ [__attribute__((__deprecated__(msg)))])])
+
if_i386=${universal_binary+[defined __i386__]}
RUBY_FUNC_ATTRIBUTE(__stdcall__, FUNC_STDCALL, rb_cv_func_stdcall, ${if_i386})
RUBY_FUNC_ATTRIBUTE(__cdecl__, FUNC_CDECL, rb_cv_func_cdecl, ${if_i386})
diff --git a/include/ruby/backward/cxxanyargs.hpp b/include/ruby/backward/cxxanyargs.hpp
index 1c36cda..51f7302 100644
--- a/include/ruby/backward/cxxanyargs.hpp
+++ b/include/ruby/backward/cxxanyargs.hpp
@@ -47,7 +47,7 @@ typedef int int_type(ANYARGS);
/// @name Hooking global variables
/// @{
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Define a function-backended global variable.
/// @param[in] q Name of the variable.
/// @param[in] w Getter function.
@@ -63,7 +63,7 @@ rb_define_virtual_variable(const char *q, type *w, void_type *e)
::rb_define_virtual_variable(q, r, t);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Define a function-backended global variable.
/// @param[in] q Name of the variable.
/// @param[in] w Variable storage.
@@ -84,7 +84,7 @@ rb_define_hooked_variable(const char *q, VALUE *w, type *e, void_type *r)
/// @name Exceptions and tag jumps
/// @{
-DEPRECATED_TYPE(("Use rb_block_call instead"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Old way to implement iterators.
/// @param[in] q A function that can yield.
/// @param[in] w Passed to `q`.
@@ -101,7 +101,7 @@ rb_iterate(VALUE(*q)(VALUE), VALUE w, type *e, VALUE r)
return ::rb_iterate(q, w, t, r);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Call a method with a block.
/// @param[in] q The self.
/// @param[in] w The method.
@@ -119,7 +119,7 @@ rb_block_call(VALUE q, ID w, int e, const VALUE *r, type *t, VALUE y)
return ::rb_block_call(q, w, e, r, u, y);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief An equivalent of `rescue` clause.
/// @param[in] q A function that can raise.
/// @param[in] w Passed to `q`.
@@ -142,7 +142,7 @@ rb_rescue(type *q, VALUE w, type *e, VALUE r)
return ::rb_rescue(t, w, y, r);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief An equivalent of `rescue` clause.
/// @param[in] q A function that can raise.
/// @param[in] w Passed to `q`.
@@ -169,7 +169,7 @@ rb_rescue2(type *q, VALUE w, type *e, VALUE r, ...)
va_end(ap);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief An equivalent of `ensure` clause.
/// @param[in] q A function that can raise.
/// @param[in] w Passed to `q`.
@@ -190,7 +190,7 @@ rb_ensure(type *q, VALUE w, type *e, VALUE r)
return ::rb_ensure(t, w, y, r);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief An equivalent of `Kernel#catch`.
/// @param[in] q The "tag" string.
/// @param[in] w A function that can throw.
@@ -209,7 +209,7 @@ rb_catch(const char *q, type *w, VALUE e)
return ::rb_catch(q, r, e);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief An equivalent of `Kernel#catch`.
/// @param[in] q The "tag" object.
/// @param[in] w A function that can throw.
@@ -232,7 +232,7 @@ rb_catch_obj(VALUE q, type *w, VALUE e)
/// @name Procs, Fibers and Threads
/// @{
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Creates a @ref rb_cFiber instance.
/// @param[in] q The fiber body.
/// @param[in] w Passed to `q`.
@@ -248,7 +248,7 @@ rb_fiber_new(type *q, VALUE w)
return ::rb_fiber_new(e, w);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Creates a @ref rb_cProc instance.
/// @param[in] q The proc body.
/// @param[in] w Passed to `q`.
@@ -264,7 +264,7 @@ rb_proc_new(type *q, VALUE w)
return ::rb_proc_new(e, w);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Creates a @ref rb_cThread instance.
/// @param[in] q The thread body.
/// @param[in] w Passed to `q`.
@@ -285,7 +285,7 @@ rb_thread_create(type *q, void *w)
/// @name Hash and st_table
/// @{
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Iteration over the given table.
/// @param[in] q A table to scan.
/// @param[in] w A function to iterate.
@@ -303,7 +303,7 @@ st_foreach(st_table *q, int_type *w, st_data_t e)
return ::st_foreach(q, r, e);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Iteration over the given table.
/// @param[in] q A table to scan.
/// @param[in] w A function to iterate.
@@ -321,7 +321,7 @@ st_foreach_check(st_table *q, int_type *w, st_data_t e, st_data_t)
return ::st_foreach_check(q, t, e, 0);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Iteration over the given table.
/// @param[in] q A table to scan.
/// @param[in] w A function to iterate.
@@ -337,7 +337,7 @@ st_foreach_safe(st_table *q, int_type *w, st_data_t e)
::st_foreach_safe(q, r, e);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Iteration over the given hash.
/// @param[in] q A hash to scan.
/// @param[in] w A function to iterate.
@@ -353,7 +353,7 @@ rb_hash_foreach(VALUE q, int_type *w, VALUE e)
::rb_hash_foreach(q, r, e);
}
-DEPRECATED_TYPE(("Use of ANYARGS in this function is deprected"),)
+RUBY_CXX_DEPRECATED("Use of ANYARGS in this function is deprected")
/// @brief Iteration over each instance variable of the object.
/// @param[in] q An object.
/// @param[in] w A function to iterate.
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index 5d890df..72ec11d 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -38,6 +38,9 @@ extern "C" {
#ifndef DEPRECATED_TYPE
# define DEPRECATED_TYPE(mesg, decl) decl
#endif
+#ifndef RUBY_CXX_DEPRECATED
+# define RUBY_CXX_DEPRECATED(mesg) /* nothing */
+#endif
#ifndef NOINLINE
# define NOINLINE(x) x
#endif
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 13463d3..9b3cd4a 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -695,6 +695,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
!if $(MSC_VER) >= 1300
#define DEPRECATED(x) __declspec(deprecated) x
#define DEPRECATED_TYPE(mesg, x) __declspec(deprecated mesg) x
+#define RUBY_CXX_DEPRECATED(mesg) __declspec(deprecated(mesg))
#define NOINLINE(x) __declspec(noinline) x
!endif
#define ALWAYS_INLINE(x) __forceinline x