diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-05 04:07:25 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-05 04:07:25 +0000 |
commit | 779c18bf238aba630e40c26e10ce8aa278c45d61 (patch) | |
tree | 529c8339b0a3f0fa1d6fd9fafdca7091211353c1 /tool | |
parent | bb6c0f03a7c0875c20efc79506316da2cb4c4aed (diff) | |
download | ruby-779c18bf238aba630e40c26e10ce8aa278c45d61.tar.gz |
va_copy is a C99ism
Should provide appropriate fallback implementation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r-- | tool/m4/ruby_check_va_copy.m4 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tool/m4/ruby_check_va_copy.m4 b/tool/m4/ruby_check_va_copy.m4 new file mode 100644 index 0000000000..cc885e56de --- /dev/null +++ b/tool/m4/ruby_check_va_copy.m4 @@ -0,0 +1,32 @@ +# -*- Autoconf -*- +m4_define(RUBY_CHECK_VA_COPY, [ + if test "x$rb_cv_va_copy" = x; then + AC_TRY_RUN( +[#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(); + CONFTEST_VA_COPY(ap, ap2); + for (i = 0; i < n; i++) if ((int)va_arg(ap, int) != n - i - 1) abort(); + va_end(ap); +} +int +main() +{ + conftest(10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); + exit(0); +}], + rb_cv_va_copy=[$1], + rb_cv_va_copy="", + rb_cv_va_copy="")dnl + fi +])dnl +dnl |