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

* configure.in (RUBY_FUNC_ATTRIBUTE): check for function attribute.

[ruby-dev:26109]

* eval.c, gc.c: moved noinline to configure.in.

* rubyio.h (DEPRECATED): moved to configure.in.

* ruby.h (DEPRECATED, NOINLINE): default definition.

* win{32,ce}/Makefile.sub (config.h): deprecated and noinline for
  __declspec() are available for VC++7 or later.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-04-30 02:59:44 +00:00
parent 6d69a240b8
commit 27a9df2a6b
8 changed files with 75 additions and 32 deletions

View file

@ -1,3 +1,17 @@
Sat Apr 30 11:59:25 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_FUNC_ATTRIBUTE): check for function attribute.
[ruby-dev:26109]
* eval.c, gc.c: moved noinline to configure.in.
* rubyio.h (DEPRECATED): moved to configure.in.
* ruby.h (DEPRECATED, NOINLINE): default definition.
* win{32,ce}/Makefile.sub (config.h): deprecated and noinline for
__declspec() are available for VC++7 or later.
Sat Apr 30 06:57:39 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/cgi.rb: new methods WEBrick::CGI#[], WEBrick::CGI#logger
@ -10,7 +24,7 @@ Sat Apr 30 06:57:39 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
if SERVER_SOFTWARE environment variable is not given.
(WEBrick::CGI#start): req.path_info must be a String.
(WEBrick::CGI::Socket#request_line): treat REQUEST_METHOD, PATH_INFO
and SCRIPT_NAME to run in console.
and SCRIPT_NAME to run in console.
* lib/webrick/httputils.rb (WEBrick::HTTPUtils.escape_path): should
not use String#split("/"). it removes trailing empty path component.

View file

@ -263,16 +263,45 @@ if test "$rb_cv_stdarg" = yes; then
AC_DEFINE(HAVE_STDARG_PROTOTYPES)
fi
AC_CACHE_CHECK([for noreturn], rb_cv_noreturn,
[rb_cv_noreturn=x
for mac in "x __attribute__ ((noreturn))" "__declspec(noreturn) x" x; do
AC_DEFUN(RUBY_FUNC_ATTRIBUTE, [dnl
m4_ifval([$2], dnl
[AS_VAR_PUSHDEF([attrib],[$2])], dnl
[AS_VAR_PUSHDEF([attrib],[FUNC_]AS_TR_CPP($1))] dnl
)dnl
m4_ifval([$3], dnl
[AS_VAR_PUSHDEF([rbcv],[$3])], dnl
[AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
)dnl
AC_CACHE_CHECK(for [$1] function attribute, rbcv,
[rbcv=x
if test "${ac_c_werror_flag+set}"; then
rb_c_werror_flag="$ac_c_werror_flag"
else
unset rb_c_werror_flag
fi
ac_c_werror_flag=yes
for mac in "x __attribute__ (($1))" "__declspec($1) x" x; do
AC_TRY_COMPILE(
[#define NORETURN(x) $mac
NORETURN(void exit(int x));],
[],
[rb_cv_noreturn="$mac"; break])
done])
AC_DEFINE_UNQUOTED([NORETURN(x)], $rb_cv_noreturn)
[#define ]attrib[(x) $mac
]attrib[(void conftest_attribute_check(void));], [],
[rbcv="$mac"; break])
done
if test "${rb_c_werror_flag+set}"; then
ac_c_werror_flag="$rb_c_werror_flag"
else
unset ac_c_werror_flag
fi
])
AC_DEFINE_UNQUOTED(attrib[(x)], $rbcv)
AS_VAR_POPDEF([attrib])
AS_VAR_POPDEF([rbcv])
])
RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
RUBY_FUNC_ATTRIBUTE(deprecated, DEPRECATED)
RUBY_FUNC_ATTRIBUTE(noinline, NOINLINE)
RUBY_FUNC_ATTRIBUTE(stdcall)
RUBY_FUNC_ATTRIBUTE(cdecl)
dnl Check whether we need to define sys_nerr locally
AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default

4
eval.c
View file

@ -10255,10 +10255,8 @@ rb_thread_switch(n)
rb_thread_switch((FLUSH_REGISTER_WINDOWS, setjmp((th)->context))))
NORETURN(static void rb_thread_restore_context _((rb_thread_t,int)));
NOINLINE(static void stack_extend _((rb_thread_t, int)));
# if _MSC_VER >= 1300
__declspec(noinline) static void stack_extend(rb_thread_t, int);
# endif
static void
stack_extend(th, exit)
rb_thread_t th;

9
gc.c
View file

@ -429,11 +429,8 @@ static unsigned int STACK_LEVEL_MAX = 655300;
# define STACK_LEVEL_MAX 655300
#endif
#ifdef __GNUC__
# if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
__attribute__ ((noinline))
# endif
#endif
NOINLINE(static void set_stack_end _((VALUE **stack_end_p)));
static void
set_stack_end(VALUE **stack_end_p)
{
@ -510,7 +507,7 @@ init_mark_stack()
}
#define MARK_STACK_EMPTY (mark_stack_ptr == mark_stack)
static st_table *source_filenames;
char *

14
ruby.h
View file

@ -56,6 +56,12 @@ extern "C" {
#ifndef NORETURN
# define NORETURN(x) x
#endif
#ifndef DEPRECATED
# define DEPRECATED(x) x
#endif
#ifndef NOINLINE
# define NOINLINE(x) x
#endif
#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
@ -633,12 +639,12 @@ rb_class_of(obj)
VALUE obj;
#endif
{
if(IMMEDIATE_P(obj)){
if (IMMEDIATE_P(obj)) {
if (FIXNUM_P(obj)) return rb_cFixnum;
if (obj == Qtrue) return rb_cTrueClass;
if (SYMBOL_P(obj)) return rb_cSymbol;
}
else if(!RTEST(obj)){
else if (!RTEST(obj)) {
if (obj == Qnil) return rb_cNilClass;
if (obj == Qfalse) return rb_cFalseClass;
}
@ -653,13 +659,13 @@ rb_type(obj)
VALUE obj;
#endif
{
if(IMMEDIATE_P(obj)){
if (IMMEDIATE_P(obj)) {
if (FIXNUM_P(obj)) return T_FIXNUM;
if (obj == Qtrue) return T_TRUE;
if (SYMBOL_P(obj)) return T_SYMBOL;
if (obj == Qundef) return T_UNDEF;
}
else if(!RTEST(obj)){
else if (!RTEST(obj)) {
if (obj == Qnil) return T_NIL;
if (obj == Qfalse) return T_FALSE;
}

View file

@ -99,15 +99,6 @@ void rb_io_read_check _((OpenFile*));
int rb_io_read_pending _((OpenFile*));
void rb_read_check _((FILE*));
#ifdef __GNUC__
# if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
# define DEPRECATED(x) x __attribute__ ((deprecated))
# endif
#endif
#ifndef DEPRECATED
# define DEPRECATED(x) x
#endif
DEPRECATED(int rb_getc _((FILE*)));
DEPRECATED(long rb_io_fread _((char *, long, FILE *)));
DEPRECATED(long rb_io_fwrite _((const char *, long, FILE *)));

View file

@ -220,6 +220,10 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub
#if _MSC_VER > 1100
#define NORETURN(x) __declspec(noreturn) x
#endif
#if _MSC_VER >= 1300
#define DEPRECATED(x) __declspec(deprecated) x
#define NOINLINE(x) __declspec(noinline) x
#endif
#define HAVE_DECL_SYS_NERR 1
#define HAVE_LIMITS_H 1
#define HAVE_FCNTL_H 1

View file

@ -223,6 +223,10 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/wince/Makefile.sub
#if _MSC_VER > 1100
#define NORETURN(x) __declspec(noreturn) x
#endif
#if _MSC_VER >= 1300
#define DEPRECATED(x) __declspec(deprecated) x
#define NOINLINE(x) __declspec(noinline) x
#endif
#define HAVE_DECL_SYS_NERR 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_UTIME_H 1