configure.in: FUNC_UNOPTIMIZED

* configure.in: check if optimize pragma is supported.

* include/ruby/defines.h (FUNC_UNOPTIMIZED): fallback definition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-12-01 01:05:48 +00:00
Родитель 586c174922
Коммит ff113d52f7
3 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -1757,6 +1757,7 @@ if_i386=${universal_binary+[defined __i386__]}
RUBY_FUNC_ATTRIBUTE(stdcall, [], [], ${if_i386}) RUBY_FUNC_ATTRIBUTE(stdcall, [], [], ${if_i386})
RUBY_FUNC_ATTRIBUTE(cdecl, [], [], ${if_i386}) RUBY_FUNC_ATTRIBUTE(cdecl, [], [], ${if_i386})
RUBY_FUNC_ATTRIBUTE(fastcall, [], [], ${if_i386}) RUBY_FUNC_ATTRIBUTE(fastcall, [], [], ${if_i386})
RUBY_FUNC_ATTRIBUTE(optimize("O0"), FUNC_UNOPTIMIZED, rb_cv_func_unoptimized)
RUBY_FUNC_ATTRIBUTE(optimize("-Os","-fomit-frame-pointer"), FUNC_MINIMIZED, rb_cv_func_minimized) RUBY_FUNC_ATTRIBUTE(optimize("-Os","-fomit-frame-pointer"), FUNC_MINIMIZED, rb_cv_func_minimized)
if test "$GCC" = yes; then if test "$GCC" = yes; then

Просмотреть файл

@ -244,6 +244,9 @@ void rb_ia64_flushrs(void);
#ifndef FUNC_MINIMIZED #ifndef FUNC_MINIMIZED
#define FUNC_MINIMIZED(x) x #define FUNC_MINIMIZED(x) x
#endif #endif
#ifndef FUNC_UNOPTIMIZED
#define FUNC_UNOPTIMIZED(x) x
#endif
#ifndef RUBY_ALIAS_FUNCTION_TYPE #ifndef RUBY_ALIAS_FUNCTION_TYPE
#define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \ #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \
FUNC_MINIMIZED(type prot) {return (type)name args;} FUNC_MINIMIZED(type prot) {return (type)name args;}

Просмотреть файл

@ -12,13 +12,15 @@
* http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1381.pdf * http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1381.pdf
*/ */
#ifdef __GNUC__ #ifndef FUNC_UNOPTIMIZED
#pragma GCC optimize ("O0") # define FUNC_UNOPTIMIZED(x) x
#endif #endif
#ifndef HAVE_EXPLICIT_BZERO #ifndef HAVE_EXPLICIT_BZERO
/* Similar to bzero(), but have a guarantee not to be eliminated from compiler /* Similar to bzero(), but have a guarantee not to be eliminated from compiler
optimization. */ optimization. */
FUNC_UNOPTIMIZED(void explicit_bzero(void *b, size_t len));
void void
explicit_bzero(void *b, size_t len) explicit_bzero(void *b, size_t len)
{ {