ruby-changes:58499
From: Nobuyoshi <ko1@a...>
Date: Tue, 29 Oct 2019 18:24:20 +0900 (JST)
Subject: [ruby-changes:58499] ad4da86669 (master): Check for nonnull attribute in configure
https://git.ruby-lang.org/ruby.git/commit/?id=ad4da86669 From ad4da86669454dee86844b3e0a3ecf9177084db3 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 29 Oct 2019 12:12:07 +0900 Subject: Check for nonnull attribute in configure diff --git a/configure.ac b/configure.ac index 653f3bb..67ce5f9 100644 --- a/configure.ac +++ b/configure.ac @@ -1495,6 +1495,11 @@ done https://github.com/ruby/ruby/blob/trunk/configure.ac#L1495 AS_IF([test "$rb_cv_func_exported" != no], [ AC_DEFINE_UNQUOTED(RUBY_FUNC_EXPORTED, [$rb_cv_func_exported extern]) ]) +RUBY_DECL_ATTRIBUTE([__nonnull__(n)], [RUBY_FUNC_NONNULL(n,x)], [rb_cv_func_nonnull], + [], [function], [ +@%:@define x int conftest_attribute_check(void *p) +@%:@define n 1 +]) RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT) diff --git a/include/ruby/defines.h b/include/ruby/defines.h index 0d95209..8603ade 100644 --- a/include/ruby/defines.h +++ b/include/ruby/defines.h @@ -464,6 +464,9 @@ void rb_sparc_flush_register_windows(void); https://github.com/ruby/ruby/blob/trunk/include/ruby/defines.h#L464 #define RUBY_ALIAS_FUNCTION(prot, name, args) \ RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args) #endif +#ifndef RUBY_FUNC_NONNULL +#define RUBY_FUNC_NONNULL(n, x) x +#endif #ifndef UNALIGNED_WORD_ACCESS # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ diff --git a/internal.h b/internal.h index c296a99..5b9b9b6 100644 --- a/internal.h +++ b/internal.h @@ -2387,16 +2387,16 @@ struct rb_call_data { https://github.com/ruby/ruby/blob/trunk/internal.h#L2387 struct rb_call_cache cc; struct rb_call_info ci; }; -VALUE rb_funcallv_with_cc(struct rb_call_data*, VALUE, ID, int, const VALUE*) -#if (defined(__clang__) || GCC_VERSION_SINCE(3, 3, 0)) && defined(__OPTIMIZE__) -__attribute__((__visibility__("default"), __nonnull__(1))) +RUBY_FUNC_EXPORTED +RUBY_FUNC_NONNULL(1, VALUE rb_funcallv_with_cc(struct rb_call_data*, VALUE, ID, int, const VALUE*)); + +#ifdef __GNUC__ # define rb_funcallv(recv, mid, argc, argv) \ __extension__({ \ static struct rb_call_data rb_funcallv_data = { { 0, }, { 0, }, }; \ rb_funcallv_with_cc(&rb_funcallv_data, recv, mid, argc, argv); \ }) #endif - ; /* miniprelude.c, prelude.c */ void Init_prelude(void); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/