summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--configure.in47
-rw-r--r--eval.c4
-rw-r--r--gc.c9
-rw-r--r--ruby.h14
-rw-r--r--rubyio.h9
-rw-r--r--win32/Makefile.sub4
-rw-r--r--wince/Makefile.sub4
8 files changed, 75 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index c571ad4fc0..5edbaf5a08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/configure.in b/configure.in
index 2abe9454e3..21de29f29b 100644
--- a/configure.in
+++ b/configure.in
@@ -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
diff --git a/eval.c b/eval.c
index 6f6e3d1197..39d184e1c0 100644
--- a/eval.c
+++ b/eval.c
@@ -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;
diff --git a/gc.c b/gc.c
index ab8a5956d4..391412f806 100644
--- a/gc.c
+++ b/gc.c
@@ -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 *
diff --git a/ruby.h b/ruby.h
index a5ae0636f9..a9a3897f63 100644
--- a/ruby.h
+++ b/ruby.h
@@ -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;
}
diff --git a/rubyio.h b/rubyio.h
index f52db7f21c..a041d90ebc 100644
--- a/rubyio.h
+++ b/rubyio.h
@@ -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 *)));
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index abe454a2c9..3254f92141 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -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
diff --git a/wince/Makefile.sub b/wince/Makefile.sub
index e1d7de68f7..d4a5d18155 100644
--- a/wince/Makefile.sub
+++ b/wince/Makefile.sub
@@ -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