diff --git a/configure.in b/configure.in index f52e0ba370..5fbdb93843 100644 --- a/configure.in +++ b/configure.in @@ -1506,11 +1506,16 @@ m4_ifval([$3], dnl [AS_VAR_PUSHDEF([rbcv],[$3])], dnl [AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl )dnl +m4_pushdef([attrib_code],[m4_bpatsubst([$1],["],[\\"])]) m4_ifval([$4], [rbcv_cond=["$4"]; test "$rbcv_cond" || unset rbcv_cond]) -AC_CACHE_CHECK(for [$1] function attribute, rbcv, +AC_CACHE_CHECK(for [$2] function attribute, rbcv, [rbcv=x RUBY_WERROR_FLAG([ -for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do +for mac in \ + "__attribute__ ((attrib_code)) x" \ + "x __attribute__ ((attrib_code))" \ + "__declspec(attrib_code) x" \ + x; do m4_ifval([$4],mac="$mac"${rbcv_cond+" /* only if $rbcv_cond */"}) AC_TRY_COMPILE( m4_ifval([$4],${rbcv_cond+[@%:@if ]$rbcv_cond}) @@ -1525,7 +1530,7 @@ done if test "$rbcv" != x; then RUBY_DEFINE_IF(m4_ifval([$4],[${rbcv_cond}]), attrib[(x)], $rbcv) fi -m4_ifval([$4], [unset rbcv_cond])dnl +m4_ifval([$4], [unset rbcv_cond]) dnl AS_VAR_POPDEF([attrib])dnl AS_VAR_POPDEF([rbcv])dnl ]) @@ -1538,6 +1543,7 @@ if_i386=${universal_binary+[defined __i386__]} RUBY_FUNC_ATTRIBUTE(stdcall, [], [], ${if_i386}) RUBY_FUNC_ATTRIBUTE(cdecl, [], [], ${if_i386}) RUBY_FUNC_ATTRIBUTE(fastcall, [], [], ${if_i386}) +RUBY_FUNC_ATTRIBUTE(optimize("-Os","-fomit-frame-pointer"), FUNC_MINIMIZED, rb_cv_func_minimized) if test "$GCC" = yes; then AC_CACHE_CHECK([for function alias], [rb_cv_gcc_function_alias], diff --git a/include/ruby/defines.h b/include/ruby/defines.h index 5d61bf8dd5..b84e4f5ad2 100644 --- a/include/ruby/defines.h +++ b/include/ruby/defines.h @@ -245,9 +245,12 @@ void rb_ia64_flushrs(void); #define RUBY_PLATFORM "unknown-unknown" #endif +#ifndef FUNC_MINIMIZED +#define FUNC_MINIMIZED(x) x +#endif #ifndef RUBY_ALIAS_FUNCTION_TYPE #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \ - type prot {return name args;} + FUNC_MINIMIZED(type prot) {return name args;} #endif #ifndef RUBY_ALIAS_FUNCTION_VOID #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \