From 18846cf7d152cf545154d13da5fb2ca365d28ed1 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Fri, 14 Apr 2017 09:59:15 +0900 Subject: configure.in: assume stdarg.h exists It is part of C89. --- compile.c | 2 +- configure.in | 18 ------------------ dln.h | 6 ------ eval.c | 2 +- ext/win32ole/win32ole.h | 7 ------- ext/win32ole/win32ole_error.c | 2 +- include/ruby/defines.h | 18 ++++++------------ include/ruby/intern.h | 6 +----- vm_core.h | 6 ------ vm_eval.c | 4 ++-- vsnprintf.c | 20 +++----------------- win32/Makefile.sub | 1 - 12 files changed, 15 insertions(+), 77 deletions(-) diff --git a/compile.c b/compile.c index 203dce4a96..169d4895c3 100644 --- a/compile.c +++ b/compile.c @@ -1057,7 +1057,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 a74460292b..b40b816c44 100644 --- a/configure.in +++ b/configure.in @@ -1780,24 +1780,6 @@ AS_IF([test "$rb_cv_tokenpaste" = ansi], [ AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y]) ]) -AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg, - [AC_TRY_COMPILE([ -#include -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)]) -AS_IF([test "$rb_cv_stdarg" = yes], [ - AC_DEFINE(HAVE_STDARG_PROTOTYPES) -]) - 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 f1525efeb2..d3e2ad7f17 100644 --- a/dln.h +++ b/dln.h @@ -12,12 +12,6 @@ #ifndef DLN_H #define DLN_H -#ifdef __cplusplus -# ifndef HAVE_STDARG_PROTOTYPES -# define HAVE_STDARG_PROTOTYPES 1 -# endif -#endif - RUBY_SYMBOL_EXPORT_BEGIN #ifndef DLN_FIND_EXTRA_ARG diff --git a/eval.c b/eval.c index f5896f6fba..30dcf0cc04 100644 --- a/eval.c +++ b/eval.c @@ -923,7 +923,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->ec.errinfo, eclass)) { handle = TRUE; diff --git a/ext/win32ole/win32ole.h b/ext/win32ole/win32ole.h index c019930397..0c4e6c3163 100644 --- a/ext/win32ole/win32ole.h +++ b/ext/win32ole/win32ole.h @@ -26,13 +26,6 @@ #endif #include #include -#ifdef HAVE_STDARG_PROTOTYPES -#include -#define va_init_list(a,b) va_start(a,b) -#else -#include -#define va_init_list(a,b) va_start(a) -#endif #include #define DOUT fprintf(stderr,"%s(%d)\n", __FILE__, __LINE__) diff --git a/ext/win32ole/win32ole_error.c b/ext/win32ole/win32ole_error.c index 62e69b186c..17fc195038 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 250b7b7ce2..cf585f210d 100644 --- a/include/ruby/defines.h +++ b/include/ruby/defines.h @@ -144,25 +144,19 @@ extern "C" { #define RUBY -#ifdef __cplusplus -# ifndef HAVE_STDARG_PROTOTYPES -# define HAVE_STDARG_PROTOTYPES 1 -# endif -#endif - /* No longer used since 2.5; kept for backwards compatibility */ -#ifndef HAVE_PROTOTYPES +#ifndef HAVE_PROTOTYPES # define HAVE_PROTOTYPES 1 #endif #undef _ #define _(args) args -#undef __ -#ifdef HAVE_STDARG_PROTOTYPES -# define __(args) args -#else -# define __(args) () +/* No longer used since 2.5; kept for backwards compatibility */ +#ifndef HAVE_STDARG_PROTOTYPES +# define HAVE_STDARG_PROTOTYPES 1 #endif +#undef __ +#define __(args) args #ifdef __cplusplus #define ANYARGS ... diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 9b6a8d7dea..6c6a86fbe2 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 -#else -# include -#endif +#include #include "ruby/st.h" diff --git a/vm_core.h b/vm_core.h index a2ca6342cf..f06b4cfd71 100644 --- a/vm_core.h +++ b/vm_core.h @@ -96,13 +96,7 @@ #define RUBY_NSIG NSIG -#ifdef HAVE_STDARG_PROTOTYPES #include -#define va_init_list(a,b) va_start((a),(b)) -#else -#include -#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 309e553f14..de1fb4fb0f 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -781,7 +781,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); @@ -995,7 +995,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 #undef __P -#if defined(HAVE_STDARG_PROTOTYPES) -# include -# if !defined(__P) -# define __P(x) x -# endif -#else -# define __P(x) () -# if !defined(const) -# define const -# endif -# include +#if !defined(__P) +# define __P(x) x #endif #ifndef _BSD_VA_LIST_ #define _BSD_VA_LIST_ va_list diff --git a/win32/Makefile.sub b/win32/Makefile.sub index bb0a91c6e7..61f6aca8fb 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -605,7 +605,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub #define SIZE_MAX UINT_MAX !endif #define TOKEN_PASTE(x,y) x##y -#define HAVE_STDARG_PROTOTYPES 1 !if $(MSC_VER) > 1100 #define NORETURN(x) __declspec(noreturn) x !endif -- cgit v1.2.3