[dia] [unit test] Check for matherr() with g_warning (currently MSVC only)



commit 7e3de36ae166722f82ad1c8e59931cd862a6a48e
Author: Hans Breuer <hans breuer org>
Date:   Mon Oct 15 12:30:34 2012 +0200

    [unit test] Check for matherr() with g_warning (currently MSVC only)
    
    The same would work with GCC/libc but it's deprecated there and would
    require #define _SVID_SOURCE - see 'man matherr'.

 tests/test-objects.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-objects.c b/tests/test-objects.c
index 76220a6..dd25b8d 100644
--- a/tests/test-objects.c
+++ b/tests/test-objects.c
@@ -594,3 +594,23 @@ main (int argc, char** argv)
 
   return ret;
 }
+
+#ifdef _MSC_VER
+int _matherr( struct _exception *except )
+{
+  const char *type;
+
+#define CASE(x) case _ ##x : type=#x; break
+  switch (except->type) {
+  CASE(DOMAIN); 
+  CASE(SING);
+  CASE(UNDERFLOW);
+  CASE(OVERFLOW);
+  CASE(TLOSS);
+  CASE(PLOSS);
+  }
+#undef CASE
+  g_warning ("%s %s(%f, %f)", type, except->name, except->arg1, except->arg2);
+  return 0;
+}
+#endif
\ No newline at end of file



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]