aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-09-11 02:32:06 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-09-11 02:34:10 +0900
commit8fc49d2a86bb2449e526dc78243902b5649960db (patch)
tree2249abc19373cd46cd5363d74f48686e367040bc
parent3bb183188d5ee8adee9ac36f7983853dc2f1a836 (diff)
downloadruby-wip-topic/dont-check-prototype-arg-support.tar.gz
-rw-r--r--compile.c2
-rw-r--r--configure.in26
-rw-r--r--dln.h15
-rw-r--r--eval.c2
-rw-r--r--ext/win32ole/win32ole.h6
-rw-r--r--ext/win32ole/win32ole_error.c2
-rw-r--r--include/ruby/defines.h21
-rw-r--r--include/ruby/intern.h4
-rw-r--r--include/ruby/oniguruma.h8
-rw-r--r--include/ruby/util.h16
-rw-r--r--regerror.c29
-rw-r--r--vm_core.h6
-rw-r--r--vm_eval.c4
-rw-r--r--win32/Makefile.sub2
14 files changed, 10 insertions, 133 deletions
diff --git a/compile.c b/compile.c
index dac26c6..d801d96 100644
--- a/compile.c
+++ b/compile.c
@@ -1061,7 +1061,7 @@ new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type insn_id, int a
va_list argv;
if (argc > 0) {
int i;
- va_init_list(argv, argc);
+ va_start(argv, argc);
operands = (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * argc);
for (i = 0; i < argc; i++) {
VALUE v = va_arg(argv, VALUE);
diff --git a/configure.in b/configure.in
index da0fc54..8e41c9c 100644
--- a/configure.in
+++ b/configure.in
@@ -1667,14 +1667,6 @@ RUBY_REPLACE_TYPE(rlim_t, [int long "long long"], RLIM, [
RUBY_REPLACE_TYPE(off_t, [], OFFT)
RUBY_REPLACE_TYPE(clockid_t, [], CLOCKID)
-AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
- [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
- rb_cv_have_prototypes=yes,
- rb_cv_have_prototypes=no)])
-if test "$rb_cv_have_prototypes" = yes; then
- AC_DEFINE(HAVE_PROTOTYPES)
-fi
-
AC_CACHE_CHECK(token paste string, rb_cv_tokenpaste,
[AC_TRY_COMPILE([@%:@define paste(a,b) a@%:@@%:@b],
[int xy = 1; return paste(x,y);],
@@ -1721,24 +1713,6 @@ if test "$rb_cv_string_literal_concatenation" = no; then
AC_DEFINE(NO_STRING_LITERAL_CONCATENATION,1)
fi
-AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg,
- [AC_TRY_COMPILE([
-#include <stdarg.h>
-int foo(int x, ...) {
- va_list va;
- va_start(va, x);
- va_arg(va, int);
- va_arg(va, char *);
- va_arg(va, double);
- return 0;
-}
-], [return foo(10, "", 3.14);],
- rb_cv_stdarg=yes,
- rb_cv_stdarg=no)])
-if test "$rb_cv_stdarg" = yes; then
- AC_DEFINE(HAVE_STDARG_PROTOTYPES)
-fi
-
AC_CACHE_CHECK(for variable length macro, rb_cv_va_args_macro,
[AC_TRY_COMPILE([
int foo(int x, ...);
diff --git a/dln.h b/dln.h
index d98b260..e4beb27 100644
--- a/dln.h
+++ b/dln.h
@@ -12,21 +12,8 @@
#ifndef DLN_H
#define DLN_H
-#ifdef __cplusplus
-# ifndef HAVE_PROTOTYPES
-# define HAVE_PROTOTYPES 1
-# endif
-# ifndef HAVE_STDARG_PROTOTYPES
-# define HAVE_STDARG_PROTOTYPES 1
-# endif
-#endif
-
#undef _
-#ifdef HAVE_PROTOTYPES
-# define _(args) args
-#else
-# define _(args) ()
-#endif
+#define _(args) args
RUBY_SYMBOL_EXPORT_BEGIN
diff --git a/eval.c b/eval.c
index 1baf914..0a6c5e1 100644
--- a/eval.c
+++ b/eval.c
@@ -826,7 +826,7 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
int handle = FALSE;
VALUE eclass;
- va_init_list(args, data2);
+ va_start(args, data2);
while ((eclass = va_arg(args, VALUE)) != 0) {
if (rb_obj_is_kind_of(th->errinfo, eclass)) {
handle = TRUE;
diff --git a/ext/win32ole/win32ole.h b/ext/win32ole/win32ole.h
index d61f5e2..733518e 100644
--- a/ext/win32ole/win32ole.h
+++ b/ext/win32ole/win32ole.h
@@ -26,13 +26,7 @@
#endif
#include <stdlib.h>
#include <math.h>
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
#include <objidl.h>
#define DOUT fprintf(stderr,"%s(%d)\n", __FILE__, __LINE__)
diff --git a/ext/win32ole/win32ole_error.c b/ext/win32ole/win32ole_error.c
index 62e69b1..17fc195 100644
--- a/ext/win32ole/win32ole_error.c
+++ b/ext/win32ole/win32ole_error.c
@@ -48,7 +48,7 @@ ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...)
va_list args;
VALUE msg;
VALUE err_msg;
- va_init_list(args, fmt);
+ va_start(args, fmt);
msg = rb_vsprintf(fmt, args);
va_end(args);
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index 89e549e..dfc968f 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -141,28 +141,11 @@ extern "C" {
#define RUBY
-#ifdef __cplusplus
-# ifndef HAVE_PROTOTYPES
-# define HAVE_PROTOTYPES 1
-# endif
-# ifndef HAVE_STDARG_PROTOTYPES
-# define HAVE_STDARG_PROTOTYPES 1
-# endif
-#endif
-
#undef _
-#ifdef HAVE_PROTOTYPES
-# define _(args) args
-#else
-# define _(args) ()
-#endif
+#define _(args) args
#undef __
-#ifdef HAVE_STDARG_PROTOTYPES
-# define __(args) args
-#else
-# define __(args) ()
-#endif
+#define __(args) args
#ifdef __cplusplus
#define ANYARGS ...
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 48608f3..134bd86 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -26,11 +26,7 @@ extern "C" {
#include RUBY_EXTCONF_H
#endif
-#ifdef HAVE_STDARG_PROTOTYPES
# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
#include "ruby/st.h"
diff --git a/include/ruby/oniguruma.h b/include/ruby/oniguruma.h
index 1d8a019..f7c3801 100644
--- a/include/ruby/oniguruma.h
+++ b/include/ruby/oniguruma.h
@@ -65,19 +65,11 @@ extern "C" {
#endif
#ifndef P_
-#if defined(__STDC__) || defined(_WIN32)
# define P_(args) args
-#else
-# define P_(args) ()
-#endif
#endif
#ifndef PV_
-#ifdef HAVE_STDARG_PROTOTYPES
# define PV_(args) args
-#else
-# define PV_(args) ()
-#endif
#endif
#ifndef ONIG_EXTERN
diff --git a/include/ruby/util.h b/include/ruby/util.h
index 3b78e46..ef1e8fb 100644
--- a/include/ruby/util.h
+++ b/include/ruby/util.h
@@ -25,24 +25,8 @@ extern "C" {
#endif
#ifndef _
-#ifdef __cplusplus
-# ifndef HAVE_PROTOTYPES
-# define HAVE_PROTOTYPES 1
-# endif
-# ifndef HAVE_STDARG_PROTOTYPES
-# define HAVE_STDARG_PROTOTYPES 1
-# endif
-#endif
-#ifdef HAVE_PROTOTYPES
# define _(args) args
-#else
-# define _(args) ()
-#endif
-#ifdef HAVE_STDARG_PROTOTYPES
# define __(args) args
-#else
-# define __(args) ()
-#endif
#endif
RUBY_SYMBOL_EXPORT_BEGIN
diff --git a/regerror.c b/regerror.c
index 9ec3f65..8a8f14c 100644
--- a/regerror.c
+++ b/regerror.c
@@ -30,14 +30,7 @@
#include "regint.h"
#include <stdio.h> /* for vsnprintf() */
-
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start(a)
-#endif
extern UChar*
onig_error_code_to_format(OnigPosition code)
@@ -252,14 +245,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
#define MAX_ERROR_PAR_LEN 30
extern int
-#ifdef HAVE_STDARG_PROTOTYPES
onig_error_code_to_str(UChar* s, OnigPosition code, ...)
-#else
-onig_error_code_to_str(s, code, va_alist)
- UChar* s;
- OnigPosition code;
- va_dcl
-#endif
{
UChar *p, *q;
OnigErrorInfo* einfo;
@@ -268,7 +254,7 @@ onig_error_code_to_str(s, code, va_alist)
UChar parbuf[MAX_ERROR_PAR_LEN];
va_list vargs;
- va_init_list(vargs, code);
+ va_start(vargs, code);
switch (code) {
case ONIGERR_UNDEFINED_NAME_REFERENCE:
@@ -385,22 +371,11 @@ onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
}
void
-#ifdef HAVE_STDARG_PROTOTYPES
onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
UChar* pat, UChar* pat_end, const UChar *fmt, ...)
-#else
-onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
- UChar buf[];
- int bufsize;
- OnigEncoding enc;
- UChar* pat;
- UChar* pat_end;
- const UChar *fmt;
- va_dcl
-#endif
{
va_list args;
- va_init_list(args, fmt);
+ va_start(args, fmt);
onig_vsnprintf_with_pattern(buf, bufsize, enc,
pat, pat_end, fmt, args);
va_end(args);
diff --git a/vm_core.h b/vm_core.h
index ccba902..c5806bd 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -97,13 +97,7 @@
#define RUBY_NSIG NSIG
-#ifdef HAVE_STDARG_PROTOTYPES
#include <stdarg.h>
-#define va_init_list(a,b) va_start((a),(b))
-#else
-#include <varargs.h>
-#define va_init_list(a,b) va_start((a))
-#endif
#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
#define USE_SIGALTSTACK
diff --git a/vm_eval.c b/vm_eval.c
index 18cd9dd..631a080 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -822,7 +822,7 @@ rb_funcall(VALUE recv, ID mid, int n, ...)
if (n > 0) {
long i;
- va_init_list(ar, n);
+ va_start(ar, n);
argv = ALLOCA_N(VALUE, n);
@@ -1035,7 +1035,7 @@ rb_yield_values(int n, ...)
va_list args;
argv = ALLOCA_N(VALUE, n);
- va_init_list(args, n);
+ va_start(args, n);
for (i=0; i<n; i++) {
argv[i] = va_arg(args, VALUE);
}
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index e3fae91..89940b9 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -592,9 +592,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
!if $(MSC_VER) < 1400
#define SIZE_MAX UINT_MAX
!endif
-#define HAVE_PROTOTYPES 1
#define TOKEN_PASTE(x,y) x##y
-#define HAVE_STDARG_PROTOTYPES 1
!if $(MSC_VER) > 1100
#define NORETURN(x) __declspec(noreturn) x
!endif