git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2001-01-10 07:30:18 +00:00
Родитель ab9be24857
Коммит 6b5ad7c5b2
7 изменённых файлов: 58 добавлений и 39 удалений

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

@ -1,3 +1,17 @@
Wed Jan 10 16:15:08 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* ruby.h: NORETURN macro is changed for VC++ 6.0.
* eval.c, intern.h: ditto.
Wed Jan 10 13:54:53 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* process.c (proc_setuid): use setresuid() if available.
* process.c (proc_setgid): use setresgid() if available.
* configure.in: ditto.
Wed Jan 10 01:50:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_reverse_bang): forgot to call rb_str_modify().

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

@ -262,7 +262,8 @@ AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
isinf isnan finite)
AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd chroot\
truncate chsize times utimes fcntl lockf lstat symlink readlink\
setitimer setruid seteuid setreuid setrgid setegid setregid pause\
setitimer setruid seteuid setreuid setresuid \
setrgid setegid setregid setresgid pause\
getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\
dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod)
AC_STRUCT_TIMEZONE

6
eval.c
Просмотреть файл

@ -167,7 +167,7 @@ rb_check_safe_str(x)
}
}
static void print_undef _((VALUE, ID)) NORETURN;
NORETURN(static void print_undef _((VALUE, ID)));
static void
print_undef(klass, id)
VALUE klass;
@ -3312,7 +3312,7 @@ rb_iter_break()
JUMP_TAG(TAG_BREAK);
}
static void rb_longjmp _((int, VALUE)) NORETURN;
NORETURN(static void rb_longjmp _((int, VALUE)));
static VALUE make_backtrace _((void));
static void
@ -5635,7 +5635,7 @@ rb_f_local_variables()
}
static VALUE rb_f_catch _((VALUE,VALUE));
static VALUE rb_f_throw _((int,VALUE*)) NORETURN;
NORETURN(static VALUE rb_f_throw _((int,VALUE*)));
struct end_proc_data {
void (*func)();

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

@ -104,13 +104,13 @@ EXTERN int ruby_nerrs;
VALUE rb_exc_new _((VALUE, const char*, long));
VALUE rb_exc_new2 _((VALUE, const char*));
VALUE rb_exc_new3 _((VALUE, VALUE));
void rb_loaderror __((const char*, ...)) NORETURN;
NORETURN(void rb_loaderror __((const char*, ...)));
void rb_compile_error __((const char*, ...));
void rb_compile_error_append __((const char*, ...));
void rb_error_frozen _((char*)) NORETURN;
NORETURN(void rb_error_frozen _((char*)));
/* eval.c */
void rb_exc_raise _((VALUE)) NORETURN;
void rb_exc_fatal _((VALUE)) NORETURN;
NORETURN(void rb_exc_raise _((VALUE)));
NORETURN(void rb_exc_fatal _((VALUE)));
void rb_remove_method _((VALUE, const char*));
void rb_disable_super _((VALUE, const char*));
void rb_enable_super _((VALUE, const char*));
@ -132,7 +132,7 @@ ID rb_frame_last_func _((void));
VALUE rb_obj_instance_eval _((int, VALUE*, VALUE));
void rb_load _((VALUE, int));
void rb_load_protect _((VALUE, int, int*));
void rb_jump_tag _((int)) NORETURN;
NORETURN(void rb_jump_tag _((int)));
int rb_provided _((const char*));
void rb_provide _((const char*));
VALUE rb_f_require _((VALUE, VALUE));

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

@ -952,10 +952,11 @@ proc_setuid(obj, id)
int uid;
uid = NUM2INT(id);
#ifdef HAVE_SETREUID
#if defined HAVE_SETRESUID
setresuid(uid, -1, -1);
#elif defined HAVE_SETREUID
setreuid(uid, -1);
#else
#ifdef HAVE_SETRUID
#elif defined HAVE_SETRUID
setruid(uid);
#else
{
@ -964,7 +965,6 @@ proc_setuid(obj, id)
else
rb_notimplement();
}
#endif
#endif
return INT2FIX(uid);
}
@ -984,11 +984,12 @@ proc_setgid(obj, id)
int gid;
gid = NUM2INT(id);
#ifdef HAS_SETRGID
setrgid((GIDTYPE)gid);
#else
#ifdef HAVE_SETREGID
#if defined HAVE_SETRESGID
setresgid(gid, -1, -1);
#elif defined HAVE_SETREGID
setregid(gid, -1);
#elif defined HAS_SETRGID
setrgid((GIDTYPE)gid);
#else
{
if (getegid() == gid)
@ -996,7 +997,6 @@ proc_setgid(obj, id)
else
rb_notimplement();
}
#endif
#endif
return INT2FIX(gid);
}
@ -1013,18 +1013,18 @@ static VALUE
proc_seteuid(obj, euid)
VALUE obj, euid;
{
#ifdef HAVE_SETEUID
if (seteuid(NUM2INT(euid)) < 0) rb_sys_fail(0);
#else
#ifdef HAVE_SETREUID
#if defined HAVE_SETRESUID
if (setresuid(-1, NUM2INT(euid), -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID
if (setreuid(-1, NUM2INT(euid)) < 0) rb_sys_fail(0);
#elif defined HAVE_SETEUID
if (seteuid(NUM2INT(euid)) < 0) rb_sys_fail(0);
#else
euid = NUM2INT(euid);
if (euid == getuid())
setuid(euid);
else
rb_notimplement();
#endif
#endif
return euid;
}
@ -1042,18 +1042,18 @@ proc_setegid(obj, egid)
VALUE obj, egid;
{
rb_secure(2);
#ifdef HAVE_SETEGID
if (setegid(NUM2INT(egid)) < 0) rb_sys_fail(0);
#else
#ifdef HAVE_SETREGID
#if defined HAVE_SETRESGID
if (setresgid(-1, NUM2INT(egid), -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID
if (setregid(-1, NUM2INT(egid)) < 0) rb_sys_fail(0);
#elif defined HAVE_SETEGID
if (setegid(NUM2INT(egid)) < 0) rb_sys_fail(0);
#else
egid = NUM2INT(egid);
if (egid == getgid())
setgid(egid);
else
rb_notimplement();
#endif
#endif
return egid;
}

22
ruby.h
Просмотреть файл

@ -64,9 +64,9 @@ extern "C" {
#endif
#ifdef HAVE_ATTR_NORETURN
# define NORETURN __attribute__ ((noreturn))
#else
# define NORETURN
# define NORETURN(x) x __attribute__ ((noreturn))
#elif !defined NORETURN
# define NORETURN(x) x
#endif
#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
@ -453,13 +453,13 @@ VALUE rb_equal _((VALUE,VALUE));
EXTERN VALUE ruby_verbose, ruby_debug;
void rb_raise __((VALUE, const char*, ...)) NORETURN;
void rb_fatal __((const char*, ...)) NORETURN;
void rb_bug __((const char*, ...)) NORETURN;
void rb_sys_fail _((const char*)) NORETURN;
void rb_iter_break _((void)) NORETURN;
void rb_exit _((int)) NORETURN;
void rb_notimplement _((void)) NORETURN;
NORETURN(void rb_raise __((VALUE, const char*, ...)));
NORETURN(void rb_fatal __((const char*, ...)));
NORETURN(void rb_bug __((const char*, ...)));
NORETURN(void rb_sys_fail _((const char*)));
NORETURN(void rb_iter_break _((void)));
NORETURN(void rb_exit _((int)));
NORETURN(void rb_notimplement _((void)));
void rb_warn __((const char*, ...));
void rb_warning __((const char*, ...)); /* reports if `-w' specified */
@ -472,7 +472,7 @@ VALUE rb_rescue _((VALUE(*)(),VALUE,VALUE(*)(),VALUE));
VALUE rb_rescue2 __((VALUE(*)(),VALUE,VALUE(*)(),VALUE,...));
VALUE rb_ensure _((VALUE(*)(),VALUE,VALUE(*)(),VALUE));
VALUE rb_catch _((const char*,VALUE(*)(),VALUE));
void rb_throw _((const char*,VALUE)) NORETURN;
NORETURN(void rb_throw _((const char*,VALUE)));
VALUE rb_require _((const char*));

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

@ -16,6 +16,10 @@
#define EXTERN extern __declspec(dllexport)
#endif
#if defined _MSC_VER
#define NORETURN(x) __declspec(noreturn) x
#endif
//
// Definitions for NT port of Perl
//