stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r345520 - /incubator/stdcxx/trunk/etc/config/src/
Date Fri, 18 Nov 2005 16:50:40 GMT
Author: sebor
Date: Fri Nov 18 08:50:17 2005
New Revision: 345520

URL: http://svn.apache.org/viewcvs?rev=345520&view=rev
Log:
2005-11-18  Martin Sebor  <sebor@roguewave.com>

	* BAD_ALLOC_ASSIGNMENT.cpp: Factored code duplicated in all
	the other tests into this one and simply #included this file.
	* BAD_ALLOC_COPY_CTOR.cpp: Moved all code from this file to
	BAD_ALLOC_ASSIGNMENT.cpp and #included the latter after
	#defining the necessary macros.
	* BAD_ALLOC_DEFAULT_CTOR.cpp: Same.
	* BAD_ALLOC_DTOR.cpp: Same.
	* BAD_ALLOC_WHAT.cpp: Same.
	* BAD_CAST_ASSIGNMENT.cpp: Same.
	* BAD_CAST_COPY_CTOR.cpp: Same.
	* BAD_CAST_DEFAULT_CTOR.cpp: Same.
	* BAD_CAST_DTOR.cpp: Same.
	* BAD_CAST_WHAT.cpp: Same.
	* BAD_EXCEPTION_ASSIGNMENT.cpp: Same.
	* BAD_EXCEPTION_COPY_CTOR.cpp: Same.
	* BAD_EXCEPTION_DEFAULT_CTOR.cpp: Same.
	* BAD_EXCEPTION_DTOR.cpp: Same.
	* BAD_EXCEPTION_WHAT.cpp: Same.
	* BAD_TYPEID_ASSIGNMENT.cpp: Same.
	* BAD_TYPEID_COPY_CTOR.cpp: Same.
	* BAD_TYPEID_DEFAULT_CTOR.cpp: Same.
	* BAD_TYPEID_DTOR.cpp: Same.
	* BAD_TYPEID_WHAT.cpp: Same.
	* EXCEPTION_ASSIGNMENT.cpp: Same.
	* EXCEPTION_COPY_CTOR.cpp: Same.
	* EXCEPTION_DEFAULT_CTOR.cpp: Same.
	* EXCEPTION_DTOR.cpp: Same.
	* EXCEPTION_WHAT.cpp: Same.

Modified:
    incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_COPY_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DEFAULT_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_WHAT.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_CAST_ASSIGNMENT.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_CAST_COPY_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DEFAULT_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_CAST_WHAT.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_ASSIGNMENT.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_COPY_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DEFAULT_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_WHAT.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_ASSIGNMENT.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_COPY_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DEFAULT_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_WHAT.cpp
    incubator/stdcxx/trunk/etc/config/src/EXCEPTION_ASSIGNMENT.cpp
    incubator/stdcxx/trunk/etc/config/src/EXCEPTION_COPY_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DEFAULT_CTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp
    incubator/stdcxx/trunk/etc/config/src/EXCEPTION_WHAT.cpp

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp Fri Nov 18 08:50:17 2005
@@ -1,5 +1,34 @@
 // checking for bad_alloc assignment operator
 
+// NOTE: this file is #included from the following tests,
+//       each of which #defines bad_alloc to the name of
+//       the corresponding exception class, and exercises
+//       the respective class members
+//
+//   BAD_ALLOC_COPY_CTOR.cpp
+//   BAD_ALLOC_DEFAULT_CTOR.cpp
+//   BAD_ALLOC_DTOR.cpp
+
+//   BAD_CAST_ASSIGNMENT.cpp
+//   BAD_CAST_COPY_CTOR.cpp
+//   BAD_CAST_DEFAULT_CTOR.cpp
+//   BAD_CAST_DTOR.cpp
+
+//   BAD_EXCEPTION_ASSIGNMENT.cpp
+//   BAD_EXCEPTION_COPY_CTOR.cpp
+//   BAD_EXCEPTION_DEFAULT_CTOR.cpp
+//   BAD_EXCEPTION_DTOR.cpp
+
+//   BAD_TYPEID_ASSIGNMENT.cpp
+//   BAD_TYPEID_COPY_CTOR.cpp
+//   BAD_TYPEID_DEFAULT_CTOR.cpp
+//   BAD_TYPEID_DTOR.cpp
+
+//   EXCEPTION_ASSIGNMENT.cpp
+//   EXCEPTION_COPY_CTOR.cpp
+//   EXCEPTION_DEFAULT_CTOR.cpp
+//   EXCEPTION_DTOR.cpp
+
 #if defined (_RWSTD_USE_CONFIG)
 #  include "config.h"
 #endif
@@ -14,31 +43,36 @@
 {
     static int *ip;
 
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
+terminate_loop:
+
+    if ((ip [0] = ip [1])) {  // force a SIGSEGV
+        ++ip;
+        terminate ();         // recurse infinitely
+    }
+
+    // prevent gcc warnings for a function
+    // that's not supposed to return
+    goto terminate_loop;
 }
 
-}   // namespace std
+}
 
 #  endif   // _RWSTD_NO_STD_TERMINATE
 #endif   // _RWSTD_NO_HONOR_STD
 
 
-#ifndef _RWSTD_NO_STD_BAD_ALLOC
-#  define NAMESPACE(name)   namespace name
+#ifndef _RWSTD_NO_RUNTIME_IN_STD
+#  define NAMESPACE(name)     namespace name
 #else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_ALLOC
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_ALLOC
-#endif   // _RWSTD_NO_STD_BAD_ALLOC
+#  define NAMESPACE(ignore)   extern "C++"
+#  define std                 /* empty */
+#endif   // _RWSTD_NO_RUNTIME_IN_STD
+
+
+int ndefault_ctors;
+int ncopy_ctors;
+int ndtors;
+int nassignments;
 
 
 NAMESPACE (std) {
@@ -46,54 +80,350 @@
 class bad_alloc
 {
 public:
+    const void *what_;
 
-#ifndef _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
+#if defined (TEST_DEFAULT_CTOR)
 
     bad_alloc ();
 
-#else
-
-    bad_alloc () { }
+#else   // if !defined (TEST_DEFAULT_CTOR)
 
-#endif   // _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
+    // provide a default ctor but with a different signature
+    // than the one above to prevent multiply defined symbol
+    // linker errors in case that one is defined in the
+    // runtime library
+    bad_alloc (int = 0) { }
 
-#ifndef _RWSTD_NO_BAD_ALLOC_DTOR
+#  if defined (TEST_DTOR)
 
     virtual ~bad_alloc ();
 
-#else
+#  else   // if !defined (TEST_DTOR) 
+
+    ~bad_alloc () { }
 
-    virtual ~bad_alloc () { }
+#    if defined (TEST_COPY_CTOR)
 
-#endif   // _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
+    bad_alloc (const bad_alloc&);
+
+#    elif defined (TEST_WHAT)
+
+    virtual const char* what () const;
+
+#    else   // test assignment
+
+#      if !defined (TEST_ASSIGNMENT)
+#        define TEST_ASSIGNMENT
+#      endif
+
+      bad_alloc& operator= (const bad_alloc&);
+
+      bad_alloc& assign (const bad_alloc &rhs) {
+          ++nassignments;
+          return *this = rhs;
+      }
+
+#    endif   // TEXT_...
+#  endif   // !TEST_DTOR
+#endif   // !TEST_DEFAULT_COR
 
-    bad_alloc& operator= (const bad_alloc&);
 };
 
 
 }   // namespace std
 
 
-void foo ()
+// use virtual inheritance here to prevent aggressive optimizers
+// (like VisualAge C++) from optimizing the base class dtor away
+struct Base0: virtual std::bad_alloc
+{
+    typedef std::bad_alloc Base;
+
+    Base0 ();
+
+    virtual ~Base0 ();
+
+    Base0& operator= (const Base0&);
+
+    virtual const char* what () const;
+};
+
+
+struct Base1: virtual std::bad_alloc
+{
+    typedef std::bad_alloc Base;
+
+    Base1 ();
+
+    virtual ~Base1 ();
+
+    Base1& operator= (const Base1&);
+
+    virtual const char* what () const;
+};
+
+
+int which_what;
+
+struct Derived: Base0, Base1
+{
+    typedef std::bad_alloc Base;
+
+    Derived ();
+
+    virtual ~Derived ();
+
+    Derived& operator= (const Derived&);
+
+    virtual const char* what () const;
+};
+
+
+#if defined (TEST_COPY_CTOR)
+
+int test_member (int argc, void *ptr)
+{
+    // the code below must not be executed
+
+#  ifndef _RWSTD_NO_EXCEPTIONS
+
+    try {
+        try {
+            if (argc > 1) {
+                std::bad_alloc *pe = (std::bad_alloc*)ptr;
+                std::bad_alloc *pf = pe + argc;
+
+                throw argc < 6 ? *pe : *pf;
+            }
+        }
+        catch (std::bad_alloc e) {
+
+            std::bad_alloc copy (e);
+
+            if (argc < 5)
+                throw copy;
+
+            if (argc < 4)
+                throw e;
+
+            if (argc < 3)
+                throw;
+        }
+    }
+    catch (std::bad_alloc e) {
+        return 0 != e.what_;
+    }
+    catch (...) {
+        return 2;
+    }
+
+    return 3;
+
+#  else   // if defined (_RWSTD_NO_EXCEPTIONS)
+
+    std::bad_alloc *pe = (std::bad_alloc*)ptr;
+    std::bad_alloc *pf = new std::bad_alloc (*pe);
+
+    return !(1 == ndefault_ctors && 1 == ncopy_ctors && pe->what_ == pf->what_);
+
+#  endif   // _RWSTD_NO_EXCEPTIONS
+
+}
+
+#elif defined (TEST_DEFAULT_CTOR)
+
+int test_member (int, void*)
+{
+    // the code below must not be executed
+
+    std::bad_alloc *pe1 = new std::bad_alloc;
+    std::bad_alloc *pe2 = new Derived;
+
+    return pe1 < pe2;
+}
+
+#elif defined (TEST_DTOR)
+
+int test_member (int argc, void *ptr)
+{
+    // the code below must not be executed
+
+    std::bad_alloc *pe;
+
+    if (1 < argc)
+        pe = (Derived*)ptr;
+    else
+        pe = (std::bad_alloc*)ptr;
+
+    delete pe;
+
+    return !(1 < argc ? 1 == ndtors : 0 == ndtors);
+}
+
+#elif defined (TEST_WHAT)
+
+int test_member (int argc, void *ptr)
+{
+    // the code below must not be executed
+
+    std::bad_alloc *pe = (std::bad_alloc*)ptr;
+    Derived        *pd = (Derived*)ptr + 1;
+
+    which_what = argc;
+
+    return pe [0].what () == pd [argc].what ();
+}
+
+#else   // test assignment
+
+int test_member (int argc, void *ptr)
 {
-    std::bad_alloc e;
-    std::bad_alloc f;
+    // the code below must not be executed
+
+    std::bad_alloc *pe = (Derived*)ptr;
+
+    std::bad_alloc& (std::bad_alloc::*pf)(const std::bad_alloc&) =
+        argc < 3 ? &std::bad_alloc::operator= : &std::bad_alloc::assign;
 
-    e = f;
+    which_what = argc;
+
+    pe [argc] = pe [argc + 1];
+    (pe [argc + 1].*pf)(pe [argc + 2]);
+
+    return pe [0].what_ == pe [1].what_ || 2 < nassignments;
 }
 
 
+#endif   // TEST_...
+
+
 int main (int argc, char *argv[])
 {
+    (void)&argv;
+    (void)&nassignments;
+    (void)&ncopy_ctors;
+    (void)&ndefault_ctors;
+
     // avoid executing the body of main unless explicitly requested
     // by specifying at least one command line argument (this foils
     // aggressive optimizers from eliminating the code)
-    (void)&argv;
     if (argc < 2)
         return 0;
 
-    foo ();
+    return test_member (argc, argv);
+}
+
+
+Base0::Base0 ()
+    : Base ()
+{
+    ++ndefault_ctors;
+}
+
+
+Base0::~Base0 ()
+{
+    ++ndtors;
+}
+
+
+Base0& Base0::operator=(const Base0 &rhs)
+{
+    ++nassignments;
+
+#if defined (TEST_ASSIGNMENT)
+
+    Base::operator= (rhs);
+
+#endif   // TEST_ASSIGNMENT
+
+    return *this;
+}
+
+
+const char* Base0::what () const
+{
+#if defined (TEST_WHAT)
+
+    if (1 < which_what++)
+        return Base::what ();
+
+#endif   // TEST_WHAT
+
+    return "Base0";
+
+
+}
+
+
+Base1::Base1 ()
+    : Base ()
+{
+    ++ndefault_ctors;
+}
+
+
+Base1::~Base1 ()
+{
+    ++ndtors;
+}
+
+
+const char* Base1::what () const
+{
+#if defined (TEST_WHAT)
+
+    if (2 < which_what++)
+        return Base::what ();
+
+#endif   // TEST_WHAT
+
+    return "Base1";
+}
+
+
+Base1& Base1::operator=(const Base1 &rhs)
+{
+    ++nassignments;
+
+#if defined (TEST_ASSIGNMENT)
+
+    Base::operator= (rhs);
+
+#endif   // TEST_ASSIGNMENT
+
+    return *this;
+}
+
+
+Derived::Derived ()
+    : Base (), Base0 (), Base1 ()
+{
+    ++ndefault_ctors;
+}
+
+
+Derived::~Derived ()
+{
+    ++ndtors;
+}
+
+
+Derived& Derived::operator=(const Derived &rhs)
+{
+    ++nassignments;
+
+    Base0::operator= (rhs);
+    Base1::operator= (rhs);
+
+    return *this;
+}
+
+
+const char* Derived::what () const
+{
+    if (3 < which_what++)
+        return Base1::what ();
 
-    // link only test
-    return 0;
+    return Base0::what ();
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_COPY_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_COPY_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_COPY_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_COPY_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,127 +4,12 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-loop:
-
-    while ((ip [0] = ip [1])) {  // force a SIGSEGV
-        ++ip;
-        terminate ();            // recurse infinitely
-    }
-
-    goto loop;
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_ALLOC
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_ALLOC
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_ALLOC
-#endif   // _RWSTD_NO_STD_BAD_ALLOC
-
-
-NAMESPACE (std) {
-
-class bad_alloc
-{
-public:
-
-    bad_alloc ();
-
-    virtual ~bad_alloc ();
-
-    bad_alloc (const bad_alloc&);
-};
-
-#ifdef _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
-
-bad_alloc::bad_alloc () { }
-
-#endif   // _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
-
-#ifdef _RWSTD_NO_BAD_ALLOC_DTOR
-
-virtual bad_alloc::~bad_alloc () { }
-
-#endif   // _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
-
-}   // namespace std
-
+#define TEST_COPY_CTOR
+#define main      test_bad_alloc_copy_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-#ifndef _RWSTD_NO_EXCEPTIONS
-
-    try {
-        try {
-            if (argc > 1) {
-                std::bad_alloc e;
-
-                throw e;
-            }
-        }
-        catch (std::bad_alloc e) {
-
-            std::bad_alloc copy (e);
-
-            if (argc > 4)
-                throw copy;
-
-            if (argc > 3)
-                throw e;
-
-            if (argc > 2)
-                throw;
-        }
-    }
-    catch (std::bad_alloc e) {
-
-        (void)&e;
-        return 1;
-    }
-    catch (...) {
-        return 2;
-    }
-
-#else   // if defined (_RWSTD_NO_EXCEPTIONS)
-
-    std::bad_alloc a;
-    std::bad_alloc b (a);
-    (void)&b;
-
-#endif   // _RWSTD_NO_EXCEPTIONS
-
-    // link only test
-    return 0;
+    return test_bad_alloc_copy_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DEFAULT_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DEFAULT_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DEFAULT_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DEFAULT_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,74 +4,12 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_ALLOC
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_ALLOC
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_ALLOC
-#endif   // _RWSTD_NO_STD_BAD_ALLOC
-
-
-NAMESPACE (std) {
-
-class bad_alloc
-{
-public:
-    bad_alloc ();
-};
-
-}   // namespace std
-
+#define TEST_DEFAULT_CTOR
+#define main test_bad_alloc_default_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-#ifndef _RWSTD_NO_EXCEPTIONS
-
-    throw std::bad_alloc ();
-
-    // link only test
-    return 0;
-
-#else   // if defined (_RWSTD_NO_EXCEPTIONS)
-
-    return argv [0] == new std::bad_alloc ();
-
-#endif   // _RWSTD_NO_EXCEPTIONS
-
+    return test_bad_alloc_default_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DTOR.cpp Fri Nov 18 08:50:17 2005
@@ -1,124 +1,15 @@
 // checking for bad_alloc dtor
 
-// NOTE: this file is #included from the following tests,
-//       each of which #defines bad_alloc to the name of
-//       the corresponding exception class:
-//   BAD_CAST_DTOR.cpp
-//   BAD_EXCEPTION_DTOR.cpp
-//   BAD_TYPEID_DTOR.cpp
-//   EXCEPTION_DTOR.cpp
-
 #if defined (_RWSTD_USE_CONFIG)
 #  include "config.h"
 #endif
 
+#define TEST_DTOR
+#define main test_bad_alloc_dtor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    if ((ip [0] = ip [1])) {  // force a SIGSEGV
-        ++ip;
-        terminate ();         // recurse infinitely
-    }
-}
-
-}
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_EXCEPTION
-#endif   // _RWSTD_NO_STD_EXCEPTION
-
-
-#if !defined (bad_alloc)
-#  ifdef _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
-#    define NO_DEFAULT_CTOR
-#  endif   // _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
-#endif
-
-
-NAMESPACE (std) {
-
-class bad_alloc
-{
-public:
-
-#  if !defined (NO_DEFAULT_CTOR)
-
-    // defined in the language support library
-    bad_alloc ();
-
-#  else   // if defined (NO_DEFAULT_CTOR)
-
-    bad_alloc () { }
-
-#  endif   // NO_DEFAULT_CTOR
-
-    virtual ~bad_alloc ();   // not defined here
-};
-
-
-}   // namespace std
-
-
-// use virtual inheritance here to prevent aggressive optimizers
-// (like VisualAge C++) from optimizing the base class dtor away
-struct B0: virtual std::bad_alloc { };
-struct B1: virtual std::bad_alloc { };
-
-struct Derived: B0, B1
-{
-    virtual ~Derived ();
-};
-
-
-int dtor;
-
-// other tests that #include this file #define main to a function
-// with a different name (such as test_bad_cast_dtor) and call it
-// from their main()
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    // try to prevent the compiler from optimizing the dtor call away
-    std::bad_alloc *ptr;
-
-    if (1 < argc)
-        ptr = new Derived;
-    else
-        ptr = new std::bad_alloc;
-
-    delete ptr;
-
-    return !(1 < argc ? 1 == dtor : 0 == dtor);
+    return test_bad_alloc_dtor (argc, argv);
 }
-
-
-Derived::~Derived () { ++dtor; }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_WHAT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_WHAT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_WHAT.cpp Fri Nov 18 08:50:17 2005
@@ -4,82 +4,12 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_ALLOC
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_ALLOC
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_ALLOC
-#endif   // _RWSTD_NO_STD_BAD_ALLOC
-
-
-NAMESPACE (std) {
-
-class bad_alloc
-{
-public:
-
-    bad_alloc ();
-
-    virtual ~bad_alloc ();
-
-    virtual const char* what () const;
-};
-
-#ifdef _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
-
-bad_alloc::bad_alloc () { }
-
-#endif   // _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
-
-#ifdef _RWSTD_NO_BAD_ALLOC_DTOR
-
-bad_alloc::~bad_alloc () { }
-
-#endif   // _RWSTD_NO_BAD_ALLOC_DEFAULT_CTOR
-
-}   // namespace std
-
+#define TEST_WHAT
+#define main test_bad_alloc_what
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    std::bad_alloc e;
-
-    // link only test
-    return !e.what ();
+    return test_bad_alloc_what (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_CAST_ASSIGNMENT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_CAST_ASSIGNMENT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_CAST_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_CAST_ASSIGNMENT.cpp Fri Nov 18 08:50:17 2005
@@ -4,99 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_CAST
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_CAST
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_CAST
-#endif   // _RWSTD_NO_STD_BAD_CAST
-
-
-NAMESPACE (std) {
-
-class bad_cast
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-    bad_cast ();
-
-#else
-
-    bad_cast () { }
-
-#endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_CAST_DTOR
-
-    virtual ~bad_cast ();
-
-#else
-
-    virtual ~bad_cast () { }
-
-#endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-    bad_cast& operator= (const bad_cast&);
-};
-
-
-}   // namespace std
-
-
-void foo ()
-{
-    std::bad_cast e;
-    std::bad_cast f;
-
-    e = f;
-
-    (void)&e;
-    (void)&f;    
-}
-
+#define TEST_ASSIGNMENT
+#define bad_alloc bad_cast
+#define main      test_bad_cast_assignment
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    foo ();
-
-    // link only test
-    return 0;
+    return test_bad_cast_assignment (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_CAST_COPY_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_CAST_COPY_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_CAST_COPY_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_CAST_COPY_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,92 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    if ((ip [0] = ip [1])) {   // force a SIGSEGV
-        ++ip;
-        terminate ();          // recurse infinitely
-    }
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_CAST
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_CAST
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_CAST
-#endif   // _RWSTD_NO_STD_BAD_CAST
-
-
-NAMESPACE (std) {
-
-class bad_cast
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-    bad_cast ();
-
-#else
-
-    bad_cast () { }
-
-#endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_CAST_DTOR
-
-    virtual ~bad_cast ();
-
-#else
-
-    virtual ~bad_cast () { }
-
-#endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-    bad_cast (const bad_cast&);
-};
-
-}   // namespace std
-
+#define TEST_COPY_CTOR
+#define bad_alloc bad_cast
+#define main      test_bad_cast_copy_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    std::bad_cast a;
-    std::bad_cast b (a);
-
-    (void)&a;
-    (void)&b;
-
-    // link only test
-    return 0;
+    return test_bad_cast_copy_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DEFAULT_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DEFAULT_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DEFAULT_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DEFAULT_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,71 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_CAST
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_CAST
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_CAST
-#endif   // _RWSTD_NO_STD_BAD_CAST
-
-
-NAMESPACE (std) {
-
-class bad_cast
-{
-public:
-    bad_cast ();
-};
-
-}   // namespace std
-
-
-void* foo ()
-{
-    // construct but do not destroy or copy
-    // to avoid calling the dtor or copy ctor
-    return new std::bad_cast ();
-}
-
+#define TEST_DEFAULT_CTOR
+#define bad_alloc bad_cast
+#define main      test_bad_cast_default_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    // link only test
-    return argv [0] == foo ();
+    return test_bad_cast_default_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,13 +4,10 @@
 #  include "config.h"
 #endif
 
-#ifdef _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-#  define NO_DEFAULT_CTOR
-#endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
+#define TEST_DTOR
 #define bad_alloc bad_cast
 #define main      test_bad_cast_dtor
-#include "BAD_ALLOC_DTOR.cpp"
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
 #undef main
 
 int main (int argc, char *argv[])

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_CAST_WHAT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_CAST_WHAT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_CAST_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_CAST_WHAT.cpp Fri Nov 18 08:50:17 2005
@@ -4,86 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_CAST
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_CAST
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_CAST
-#endif   // _RWSTD_NO_STD_BAD_CAST
-
-
-NAMESPACE (std) {
-
-class bad_cast
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-    bad_cast ();
-
-#else
-
-    bad_cast () { }
-
-#endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_CAST_DTOR
-
-    virtual ~bad_cast ();
-
-#else
-
-    virtual ~bad_cast () { }
-
-#endif   // _RWSTD_NO_BAD_CAST_DEFAULT_CTOR
-
-    virtual const char* what () const;
-};
-
-}   // namespace std
-
+#define TEST_WHAT
+#define bad_alloc bad_cast
+#define main      test_bad_cast_what
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    std::bad_cast bc;
-
-    // link only test
-    return !bc.what ();
+    return test_bad_cast_what (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_ASSIGNMENT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_ASSIGNMENT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_ASSIGNMENT.cpp Fri Nov 18 08:50:17 2005
@@ -4,99 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_EXCEPTION
-#endif   // _RWSTD_NO_STD_BAD_EXCEPTION
-
-
-NAMESPACE (std) {
-
-class bad_exception
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-    bad_exception ();
-
-#else
-
-    bad_exception () { }
-
-#endif   // _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_EXCEPTION_DTOR
-
-    virtual ~bad_exception ();
-
-#else
-
-    virtual ~bad_exception () { }
-
-#endif   // _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-    bad_exception& operator= (const bad_exception&);
-};
-
-
-}   // namespace std
-
-
-void foo ()
-{
-    std::bad_exception e;
-    std::bad_exception f;
-
-    e = f;
-
-    (void)&e;
-    (void)&f;    
-}
-
+#define TEST_ASSIGNMENT
+#define bad_alloc bad_exception
+#define main      test_bad_exception_assignment
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    foo ();
-
-    // link only test
-    return 0;
+    return test_bad_exception_assignment (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_COPY_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_COPY_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_COPY_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_COPY_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,92 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    if ((ip [0] = ip [1])) {   // force a SIGSEGV
-        ++ip;
-        terminate ();          // recurse infinitely
-    }
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_EXCEPTION
-#endif   // _RWSTD_NO_STD_BAD_EXCEPTION
-
-
-NAMESPACE (std) {
-
-class bad_exception
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-    bad_exception ();
-
-#else
-
-    bad_exception () { }
-
-#endif   // _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_EXCEPTION_DTOR
-
-    virtual ~bad_exception ();
-
-#else
-
-    virtual ~bad_exception () { }
-
-#endif   // _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-    bad_exception (const bad_exception&);
-};
-
-}   // namespace std
-
+#define TEST_COPY_CTOR
+#define bad_alloc bad_exception
+#define main      test_bad_exception_copy_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    std::bad_exception a;
-    std::bad_exception b (a);
-
-    (void)&a;
-    (void)&b;
-
-    // link only test
-    return 0;
+    return test_bad_exception_copy_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DEFAULT_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DEFAULT_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DEFAULT_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DEFAULT_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,71 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_EXCEPTION
-#endif   // _RWSTD_NO_STD_BAD_EXCEPTION
-
-
-NAMESPACE (std) {
-
-class bad_exception
-{
-public:
-    bad_exception ();
-};
-
-}   // namespace std
-
-
-void* foo ()
-{
-    // construct but do not destroy or copy
-    // to avoid calling the dtor or copy ctor
-    return new std::bad_exception ();
-}
-
+#define TEST_DEFAULT_CTOR
+#define bad_alloc bad_exception
+#define main      test_bad_exception_default_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    // link only test
-    return argv [0] == foo ();
+    return test_bad_exception_default_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,13 +4,10 @@
 #  include "config.h"
 #endif
 
-#ifdef _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-#  define NO_DEFAULT_CTOR
-#endif   // _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
+#define TEST_DTOR
 #define bad_alloc bad_exception
 #define main      test_bad_exception_dtor
-#include "BAD_ALLOC_DTOR.cpp"
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
 #undef main
 
 int main (int argc, char *argv[])

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_WHAT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_WHAT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_WHAT.cpp Fri Nov 18 08:50:17 2005
@@ -4,86 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_EXCEPTION
-#endif   // _RWSTD_NO_STD_BAD_EXCEPTION
-
-
-NAMESPACE (std) {
-
-class bad_exception
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-    bad_exception ();
-
-#else
-
-    bad_exception () { }
-
-#endif   // _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_EXCEPTION_DTOR
-
-    virtual ~bad_exception ();
-
-#else
-
-    virtual ~bad_exception () { }
-
-#endif   // _RWSTD_NO_BAD_EXCEPTION_DEFAULT_CTOR
-
-    virtual const char* what () const;
-};
-
-}   // namespace std
-
+#define TEST_WHAT
+#define bad_alloc bad_exception
+#define main      test_bad_exception_what
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // prevent foo from actually being called but do it so that
-    // the optimizer can't actually figure it out and eliminate
-    // the function
-    if (argc > 256) {
-	std::bad_exception be;
-
-	return !be.what ();
-    }
-
-    // link only test
-    return 0;
+    return test_bad_exception_what (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_ASSIGNMENT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_ASSIGNMENT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_ASSIGNMENT.cpp Fri Nov 18 08:50:17 2005
@@ -4,99 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_TYPEID
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_TYPEID
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_TYPEID
-#endif   // _RWSTD_NO_STD_BAD_TYPEID
-
-
-NAMESPACE (std) {
-
-class bad_typeid
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-    bad_typeid ();
-
-#else
-
-    bad_typeid () { }
-
-#endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_TYPEID_DTOR
-
-    virtual ~bad_typeid ();
-
-#else
-
-    virtual ~bad_typeid () { }
-
-#endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-    bad_typeid& operator= (const bad_typeid&);
-};
-
-
-}   // namespace std
-
-
-void foo ()
-{
-    std::bad_typeid e;
-    std::bad_typeid f;
-
-    e = f;
-
-    (void)&e;
-    (void)&f;    
-}
-
+#define TEST_ASSIGNMENT
+#define bad_alloc bad_typeid
+#define main      test_bad_typeid_assignment
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    foo ();
-
-    // link only test
-    return 0;
+    return test_bad_typeid_assignment (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_COPY_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_COPY_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_COPY_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_COPY_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,92 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    if ((ip [0] = ip [1])) {   // force a SIGSEGV
-        ++ip;
-        terminate ();          // recurse infinitely
-    }
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_TYPEID
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_TYPEID
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_TYPEID
-#endif   // _RWSTD_NO_STD_BAD_TYPEID
-
-
-NAMESPACE (std) {
-
-class bad_typeid
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-    bad_typeid ();
-
-#else
-
-    bad_typeid () { }
-
-#endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_TYPEID_DTOR
-
-    virtual ~bad_typeid ();
-
-#else
-
-    virtual ~bad_typeid () { }
-
-#endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-    bad_typeid (const bad_typeid&);
-};
-
-}   // namespace std
-
+#define TEST_COPY_CTOR
+#define bad_alloc bad_typeid
+#define main      test_bad_typeid_copy_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    std::bad_typeid a;
-    std::bad_typeid b (a);
-
-    (void)&a;
-    (void)&b;
-
-    // link only test
-    return 0;
+    return test_bad_typeid_copy_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DEFAULT_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DEFAULT_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DEFAULT_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DEFAULT_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,70 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_TYPEID
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_TYPEID
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_TYPEID
-#endif   // _RWSTD_NO_STD_BAD_TYPEID
-
-
-NAMESPACE (std) {
-
-class bad_typeid
-{
-public:
-
-    bad_typeid ();
-};
-
-}   // namespace std
-
-
-void* foo ()
-{
-    return new std::bad_typeid ();
-}
-
+#define TEST_DEFAULT_CTOR
+#define bad_alloc bad_typeid
+#define main      test_bad_typeid_default_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    // link only test
-    return argv [0] == foo ();
+    return test_bad_typeid_default_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_DTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,13 +4,10 @@
 #  include "config.h"
 #endif
 
-#ifdef _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-#  define NO_DEFAULT_CTOR
-#endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
+#define TEST_DTOR
 #define bad_alloc bad_typeid
 #define main      test_bad_typeid_dtor
-#include "BAD_ALLOC_DTOR.cpp"
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
 #undef main
 
 int main (int argc, char *argv[])

Modified: incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_WHAT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_WHAT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_WHAT.cpp Fri Nov 18 08:50:17 2005
@@ -4,86 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_BAD_TYPEID
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_BAD_TYPEID
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_BAD_TYPEID
-#endif   // _RWSTD_NO_STD_BAD_TYPEID
-
-
-NAMESPACE (std) {
-
-class bad_typeid
-{
-public:
-
-#ifndef _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-    bad_typeid ();
-
-#else
-
-    bad_typeid () { }
-
-#endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_BAD_TYPEID_DTOR
-
-    virtual ~bad_typeid ();
-
-#else
-
-    virtual ~bad_typeid () { }
-
-#endif   // _RWSTD_NO_BAD_TYPEID_DEFAULT_CTOR
-
-    virtual const char* what () const;
-};
-
-}   // namespace std
-
+#define TEST_WHAT
+#define bad_alloc bad_typeid
+#define main      test_bad_typeid_what
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    std::bad_typeid e;
-
-    // link only test
-    return !e.what ();
+    return test_bad_typeid_what (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/EXCEPTION_ASSIGNMENT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/EXCEPTION_ASSIGNMENT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_ASSIGNMENT.cpp Fri Nov 18 08:50:17 2005
@@ -4,96 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_EXCEPTION
-#endif   // _RWSTD_NO_STD_EXCEPTION
-
-
-NAMESPACE (std) {
-
-class exception
-{
-public:
-
-#ifndef _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-    exception ();
-
-#else
-
-    exception () { }
-
-#endif   // _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_EXCEPTION_DTOR
-
-    virtual ~exception ();
-
-#else
-
-    virtual ~exception () { }
-
-#endif   // _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-    exception& operator= (const exception&);
-};
-
-
-}   // namespace std
-
-
-void foo ()
-{
-    std::exception e;
-    std::exception f;
-
-    e = f;
-}
-
+#define TEST_ASSIGNMENT
+#define bad_alloc exception
+#define main      test_exception_assignment
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    foo ();
-
-    // link only test
-    return 0;
+    return test_exception_assignment (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/EXCEPTION_COPY_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/EXCEPTION_COPY_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_COPY_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_COPY_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,121 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    if ((ip [0] = ip [1])) {   // force a SIGSEGV
-        ++ip;
-        terminate ();          // recurse infinitely
-    }
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_EXCEPTION
-#endif   // _RWSTD_NO_STD_EXCEPTION
-
-
-NAMESPACE (std) {
-
-class exception
-{
-public:
-
-#ifndef _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-    exception ();
-
-#else
-
-    exception () { }
-
-#endif   // _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_EXCEPTION_DTOR
-
-    virtual ~exception ();
-
-#else
-
-    virtual ~exception () { }
-
-#endif   // _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-    exception (const exception&);
-};
-
-}   // namespace std
-
-
-int copy;
-
-struct Derived: std::exception
-{
-    typedef std::exception Base;
-
-    Derived (): Base () { }
-
-    Derived (const Derived &e): Base (e) { ++copy; }
-};
+#define TEST_COPY_CTOR
+#define bad_alloc exception
+#define main      test_exception_copy_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    Derived d0;
-    Derived d1 (d0);
-    std::exception e (d0);
-
-#ifndef _RWSTD_NO_EXCEPTIONS
-
-    try {
-        // prevent aggressive optimizers such as Intel C++
-        // from optimizing away the call to the copy ctor
-        if (argc > 4)
-            throw d1;
-        if (argc > 3)
-            throw d0;
-        if (argc > 2)
-            throw e;
-    }
-    catch (Derived d) {
-        return !(2 == copy);
-    }
-    catch (std::exception e) {
-        return !(1 == copy);
-    }
-#endif
-
-    // link only test
-    return !(1 == copy);
+    return test_exception_copy_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DEFAULT_CTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DEFAULT_CTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DEFAULT_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DEFAULT_CTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,78 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}   // namespace std
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_EXCEPTION
-#endif   // _RWSTD_NO_STD_EXCEPTION
-
-
-NAMESPACE (std) {
-
-class exception
-{
-public:
-    exception ();
-};
-
-}   // namespace std
-
-int result;
-
-struct Derived: std::exception
-{
-    int dflt_;
-
-    typedef std::exception Base;
-
-    Derived (): Base (), dflt_ (++result) { }
-};
-
+#define TEST_DEFAULT_CTOR
+#define bad_alloc exception
+#define main      test_exception_default_ctor
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    Derived *p = new Derived ();
-
-    result = result != p->dflt_;
-
-    // link only test
-    return result;
+    return test_exception_default_ctor (argc, argv);
 }

Modified: incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp Fri Nov 18 08:50:17 2005
@@ -4,13 +4,10 @@
 #  include "config.h"
 #endif
 
-#ifdef _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-#  define NO_DEFAULT_CTOR
-#endif
-
+#define TEST_DTOR
 #define bad_alloc exception
 #define main      test_exception_dtor
-#include "BAD_ALLOC_DTOR.cpp"
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
 #undef main
 
 int main (int argc, char *argv[])

Modified: incubator/stdcxx/trunk/etc/config/src/EXCEPTION_WHAT.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/EXCEPTION_WHAT.cpp?rev=345520&r1=345519&r2=345520&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_WHAT.cpp Fri Nov 18 08:50:17 2005
@@ -4,86 +4,13 @@
 #  include "config.h"
 #endif
 
-
-#ifndef _RWSTD_NO_HONOR_STD
-#  ifdef _RWSTD_NO_STD_TERMINATE
-
-namespace std {
-
-void terminate ()
-{
-    static int *ip;
-
-    *ip++ = 0;      // force a SIGSEGV
-    terminate ();   // recurse infinitely
-}
-
-}
-
-#  endif   // _RWSTD_NO_STD_TERMINATE
-#endif   // _RWSTD_NO_HONOR_STD
-
-
-#ifndef _RWSTD_NO_STD_EXCEPTION
-#  define NAMESPACE(name)   namespace name
-#else
-#  ifndef _RWSTD_NO_GLOBAL_EXCEPTION
-#    define NAMESPACE(ignore)   extern "C++"
-#    define std                 /* empty */
-#  else
-#    ifndef _RWSTD_NO_RUNTIME_IN_STD
-#      define NAMESPACE(name)   namespace name
-#    else
-#      define NAMESPACE(ignore)   extern "C++"
-#      define std                 /* empty */
-#    endif   // _RWSTD_NO_RUNTIME_IN_STD
-#  endif   // _RWSTD_NO_GLOBAL_EXCEPTION
-#endif   // _RWSTD_NO_STD_EXCEPTION
-
-
-NAMESPACE (std) {
-
-class exception
-{
-public:
-
-#ifndef _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-    exception ();
-
-#else
-
-    exception () { }
-
-#endif   // _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-#ifndef _RWSTD_NO_EXCEPTION_DTOR
-
-    virtual ~exception ();
-
-#else
-
-    virtual ~exception () { }
-
-#endif   // _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
-
-    virtual const char* what () const;
-};
-
-}   // namespace std
-
+#define TEST_WHAT
+#define bad_alloc exception
+#define main      test_exception_what
+#include "BAD_ALLOC_ASSIGNMENT.cpp"
+#undef main
 
 int main (int argc, char *argv[])
 {
-    // avoid executing the body of main unless explicitly requested
-    // by specifying at least one command line argument (this foils
-    // aggressive optimizers from eliminating the code)
-    (void)&argv;
-    if (argc < 2)
-        return 0;
-
-    std::exception e;
-
-    // link only test
-    return !e.what ();
+    return test_exception_what (argc, argv);
 }



Mime
View raw message