diff options
-rw-r--r-- | configure.ac | 18 | ||||
-rw-r--r-- | internal.h | 19 | ||||
-rw-r--r-- | mjit.c | 20 | ||||
-rw-r--r-- | tool/m4/ruby_check_va_copy.m4 | 30 |
4 files changed, 7 insertions, 80 deletions
diff --git a/configure.ac b/configure.ac index 9d5bd08363..6c40134c3b 100644 --- a/configure.ac +++ b/configure.ac @@ -1256,24 +1256,6 @@ AS_IF([test "$rb_cv_va_args_macro" = yes], [ AC_DEFINE(HAVE_VA_ARGS_MACRO) ]) -AC_CACHE_CHECK([appropriate way to simulate va_copy], rb_cv_va_copy, [dnl - RUBY_CHECK_VA_COPY([va_copy], [va_copy((dst),(src))]) - RUBY_CHECK_VA_COPY([VA_COPY macro], [VA_COPY((dst),(src))]) - RUBY_CHECK_VA_COPY([__va_copy], [__va_copy((dst),(src))]) - RUBY_CHECK_VA_COPY([__builtin_va_copy], [__builtin_va_copy((dst),(src))]) - RUBY_CHECK_VA_COPY([va_copy via struct assignment], - [do (dst) = (src); while (0)]) - RUBY_CHECK_VA_COPY([va_copy via pointer assignment], - [do *(dst) = *(src); while (0)]) - RUBY_CHECK_VA_COPY([va_copy via memcpy], - [memcpy(&(dst), &(src), sizeof(va_list))]) -]) -AS_IF([test "x$rb_cv_va_copy" = x], [ - AC_ERROR([no way to simulate va_copy]) -], [ - AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$rb_cv_va_copy)) -]) - AC_CACHE_CHECK([for alignas() syntax], rb_cv_have_alignas, [ rb_cv_have_alignas=no RUBY_WERROR_FLAG([ diff --git a/internal.h b/internal.h index 3ca1352505..ff7a89a2e4 100644 --- a/internal.h +++ b/internal.h @@ -85,25 +85,6 @@ extern "C" { # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)] #endif -#if defined(HAVE_VA_COPY) -/* OK, nothing to do */ -#elif defined(HAVE_VA_COPY_MACRO) -#define va_copy(dst, src) VA_COPY((dst), (src)) -#elif defined(HAVE___VA_COPY) -#define va_copy(dst, src) __va_copy((dst), (src)) -#elif defined(HAVE___BUILTIN_VA_COPY) -#define va_copy(dst, src) __builtin_va_copy((dst), (src)) -#elif defined(HAVE_VA_COPY_VIA_STRUCT_ASSIGNMENT) -#define va_copy(dst, src) do (dst) = (src); while (0) -#elif defined(HAVE_VA_COPY_VIA_POINTER_ASSIGNMENT) -#define va_copy(dst, src) do *(dst) = *(src); while (0) -#elif defined(HAVE_VA_COPY_VIA_MEMCPY) -#include <string.h> -#define va_copy(dst, src) memcpy(&(dst), &(src), sizeof(va_list)) -#else -#error >>>> no way to simuate va_copy <<<< -#endif - #define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1) #define SIGNED_INTEGER_MAX(sint_type) \ (sint_type) \ @@ -286,27 +286,21 @@ args_len(char *const *args) static char ** form_args(int num, ...) { - va_list argp, argp2; - size_t len, disp; + va_list argp; + size_t len, n; int i; char **args, **res; va_start(argp, num); - va_copy(argp2, argp); + res = NULL; for (i = len = 0; i < num; i++) { args = va_arg(argp, char **); - len += args_len(args); + n = args_len(args); + REALLOC_N(res, char *, len + n + 1); + MEMCPY(res + len, args, char *, n + 1); + len += n; } va_end(argp); - res = xmalloc((len + 1) * sizeof(char *)); - for (i = disp = 0; i < num; i++) { - args = va_arg(argp2, char **); - len = args_len(args); - memmove(res + disp, args, len * sizeof(char *)); - disp += len; - } - res[disp] = NULL; - va_end(argp2); return res; } diff --git a/tool/m4/ruby_check_va_copy.m4 b/tool/m4/ruby_check_va_copy.m4 deleted file mode 100644 index 99d11b5fb9..0000000000 --- a/tool/m4/ruby_check_va_copy.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# -*- Autoconf -*- -AC_DEFUN([RUBY_CHECK_VA_COPY], [ - AS_IF([test "x$rb_cv_va_copy" = x], [dnl - AC_TRY_LINK( -[@%:@include <stdlib.h> -@%:@include <stdarg.h> -@%:@include <string.h> -@%:@define CONFTEST_VA_COPY(dst, src) $2 -void -conftest(int n, ...) -{ - va_list ap, ap2; - int i; - va_start(ap, n); - CONFTEST_VA_COPY(ap2, ap); - for (i = 0; i < n; i++) if ((int)va_arg(ap, int) != n - i - 1) abort(); - va_end(ap); - CONFTEST_VA_COPY(ap, ap2); - for (i = 0; i < n; i++) if ((int)va_arg(ap, int) != n - i - 1) abort(); - va_end(ap); - va_end(ap2); -}], -[ - conftest(10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); -], - [rb_cv_va_copy="$1"], - [rb_cv_va_copy=""])dnl - ])dnl -])dnl -dnl |