]> git.saurik.com Git - wxWidgets.git/commitdiff
added tests for va_copy and va_list
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 2 Oct 2004 18:33:34 +0000 (18:33 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 2 Oct 2004 18:33:34 +0000 (18:33 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

configure.in
setup.h.in
setup.h_vms

index a3670e48e46d26aab7f78f73ccc48f2a4435d637..c5a8c386cecef915e633023764ef8a0989a2e433 100644 (file)
@@ -1713,6 +1713,65 @@ AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t,
 
 AC_DEFINE_UNQUOTED(SIZEOF_WCHAR_T, $wx_cv_sizeof_wchar_t)
 
+dnl checks needed to define wxVaCopy
+AC_CACHE_CHECK([for va_copy],
+    wx_cv_func_va_copy,
+    [
+        AC_COMPILE_IFELSE([
+            #include <stdarg.h>
+            void foo(char *f, ...)
+            {
+                va_list ap1, ap2;
+                va_start(ap1, f);
+                va_copy(ap2, ap1);
+                va_end(ap2);
+                va_end(ap1);
+            }],
+            wx_cv_func_va_copy=yes,
+            wx_cv_func_va_copy=no
+        )
+    ]
+)
+
+if test $wx_cv_func_va_copy = "yes"; then
+    AC_DEFINE(HAVE_VA_COPY)
+else
+    dnl try to understand how can we copy va_lists
+    AC_CACHE_CHECK([if va_list can be copied by value],
+        wx_cv_type_va_list_lvalue,
+        [
+            AC_RUN_IFELSE([
+                #include <stdarg.h>
+                int foo(char *f, ...)
+                {
+                    va_list ap1, ap2;
+                    va_start(ap1, f);
+                    ap2 = ap1;
+                    if ( va_arg(ap1, int) != 17 || va_arg(ap2, int) != 17 )
+                        return 1;
+                    va_end(ap2);
+                    va_end(ap1);
+                    return 0;
+                }
+                int main()
+                {
+                    return foo("hi", 17);
+                }],
+                wx_cv_type_va_list_lvalue=yes,
+                wx_cv_type_va_list_lvalue=no,
+                dnl assume most common case for cross-compiling...
+                wx_cv_type_va_list_lvalue=yes
+            )
+        ]
+    )
+
+    if test $wx_cv_type_va_list_lvalue != "yes"; then
+        dnl we suppose that the only thing which can't be copied like this
+        dnl are arrays... only experience will show whether this is really true
+        AC_DEFINE(VA_LIST_IS_ARRAY)
+    fi
+fi
+
 dnl check for large file support
 AC_SYS_LARGEFILE
 
index 2115ca9cd8bb3f578b82c1278c53b747d19bcc38..7a21a972c93243e8d3585e0b027205d84c08d94e 100644 (file)
  */
 #undef HAVE_STATIC_CAST
 
+/*
+ * Define if your compiler has C99 va_copy
+ */
+#undef HAVE_VA_COPY
+
+/*
+ * Define if va_list type is an array
+ */
+#undef VA_LIST_IS_ARRAY
+
 /*
  * Define if your compiler has std::wstring
  */
index b3e8f515671c3fae2e7ce569490144f471382c53..6a4548d9d4534e2eed554b21b001f6452d7e0d41 100644 (file)
  */
 #define HAVE_STATIC_CAST 1
 
+/*
+ * Define if your compiler has C99 va_copy
+ */
+#undef HAVE_VA_COPY
+
+/*
+ * Define if va_list type is an array
+ */
+#undef VA_LIST_IS_ARRAY
+
 /*
  * Define if your compiler has std::wstring
  */