1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* configure.in, include/ruby/defines.h (RUBY_FUNC_EXPORTED): macro

to declare exported function.

* array.c (rb_ary_memsize), string.c (rb_str_memsize),
  variable.c (rb_objspace_data_type_memsize): used in
  objspace.  [ruby-dev:42022]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-08-14 06:33:06 +00:00
parent a23b1f7450
commit dccf9e0c45
9 changed files with 31 additions and 23 deletions

View file

@ -1,4 +1,11 @@
Sat Aug 14 15:19:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat Aug 14 15:33:02 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in, include/ruby/defines.h (RUBY_FUNC_EXPORTED): macro
to declare exported function.
* array.c (rb_ary_memsize), string.c (rb_str_memsize),
variable.c (rb_objspace_data_type_memsize): used in
objspace. [ruby-dev:42022]
* io.c (rb_io_memsize): constified.

View file

@ -386,7 +386,7 @@ rb_ary_free(VALUE ary)
}
}
size_t
RUBY_FUNC_EXPORTED size_t
rb_ary_memsize(VALUE ary)
{
if (ARY_OWNS_HEAP_P(ary)) {

View file

@ -359,19 +359,11 @@ f_complex_new_bang2(VALUE klass, VALUE x, VALUE y)
#ifdef CANON
static int canonicalization = 0;
#if defined __GNUC__ && __GNUC__ >= 4
#pragma GCC visibility push(default)
#endif
void
RUBY_FUNC_EXPORTED void
nucomp_canonicalization(int f)
{
canonicalization = f;
}
#if defined __GNUC__ && __GNUC__ >= 4
#pragma GCC visibility pop
#endif
#endif
inline static void

View file

@ -753,6 +753,19 @@ if test "$GCC" = yes; then
fi
fi
AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [
rb_cv_func_exported=no
RUBY_WERROR_FLAG([
for mac in '__attribute__ ((visibility("default")))' '__declspec(dllexport)'; do
AC_TRY_COMPILE([@%:@define RUBY_FUNC_EXPORTED $mac extern
RUBY_FUNC_EXPORTED void conftest_attribute_check(void);], [],
[rb_cv_func_exported="$mac"; break])
done
])])
if test "$rb_cv_func_exported" != no; then
AC_DEFINE_UNQUOTED(RUBY_FUNC_EXPORTED, [$rb_cv_func_exported extern])
fi
RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT)
dnl }

View file

@ -241,6 +241,10 @@ extern const unsigned char rb_nan[];
#endif
#ifndef RUBY_FUNC_EXPORTED
#define RUBY_FUNC_EXPORTED
#endif
#ifndef RUBY_EXTERN
#define RUBY_EXTERN extern
#endif

2
io.c
View file

@ -3535,7 +3535,7 @@ rb_io_fptr_finalize(rb_io_t *fptr)
size_t rb_econv_memsize(rb_econv_t *);
size_t
RUBY_FUNC_EXPORTED size_t
rb_io_memsize(const rb_io_t *fptr)
{
size_t size = sizeof(rb_io_t);

View file

@ -403,19 +403,11 @@ f_rational_new_bang2(VALUE klass, VALUE x, VALUE y)
#ifdef CANON
static int canonicalization = 0;
#if defined __GNUC__ && __GNUC__ >= 4
#pragma GCC visibility push(default)
#endif
void
RUBY_FUNC_EXPORTED void
nurat_canonicalization(int f)
{
canonicalization = f;
}
#if defined __GNUC__ && __GNUC__ >= 4
#pragma GCC visibility pop
#endif
#endif
inline static void

View file

@ -781,7 +781,7 @@ rb_str_free(VALUE str)
}
}
size_t
RUBY_FUNC_EXPORTED size_t
rb_str_memsize(VALUE str)
{
if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {

View file

@ -944,7 +944,7 @@ rb_free_generic_ivar(VALUE obj)
st_free_table((st_table *)tbl);
}
size_t
RUBY_FUNC_EXPORTED size_t
rb_generic_ivar_memsize(VALUE obj)
{
st_data_t tbl;