stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Ostapenko" <alex...@moscow.vdiweb.com>
Subject [PATCH] to run configuration tests with VC7.1
Date Mon, 10 Oct 2005 13:44:18 GMT
First part of patches is for STDCXX-15 bug. Strange that they are not in 
SVN.
--------------------------------------------------------------------------------------------------------

Index: D:/stdcxx/etc/config/src/BAD_CAST_DTOR.cpp
===================================================================
--- D:/stdcxx/etc/config/src/BAD_CAST_DTOR.cpp (revision 312643)
+++ D:/stdcxx/etc/config/src/BAD_CAST_DTOR.cpp (working copy)
@@ -76,6 +76,8 @@
 int main (int argc, char *argv[])
 {
     (void)&argv;
+    if (argc < 0xFFF)
+       return 0;

     // try to prevent the compiler from optimizing the dtor call away
     std::bad_cast *ptr = argc > 1 ? new Derived : new std::bad_cast;
@@ -83,7 +85,7 @@
     delete ptr;

     // link only test
-    return 0;
+    return 1;
 }

 Derived::~Derived () { }

Index: D:/stdcxx/etc/config/src/BAD_TYPEID_DTOR.cpp
===================================================================
--- D:/stdcxx/etc/config/src/BAD_TYPEID_DTOR.cpp (revision 312643)
+++ D:/stdcxx/etc/config/src/BAD_TYPEID_DTOR.cpp (working copy)
@@ -76,14 +76,15 @@
 int main (int argc, char *argv[])
 {
     (void)&argv;
+    if (argc < 0x0FFF)
+       return 0;

     // try to prevent the compiler from optimizing the dtor call away
     std::bad_typeid *ptr = argc > 1 ? new Derived : new std::bad_typeid;
-
     delete ptr;

     // link only test
-    return 0;
+    return 1;
 }

 Derived::~Derived () { }

Index: D:/stdcxx/etc/config/src/EXCEPTION_DTOR.cpp
===================================================================
--- D:/stdcxx/etc/config/src/EXCEPTION_DTOR.cpp (revision 312643)
+++ D:/stdcxx/etc/config/src/EXCEPTION_DTOR.cpp (working copy)
@@ -81,18 +81,17 @@
 {
     (void)&argv;

-    // use dynamic allocation to prevent the compiler
-    // from optimizing the dtor call away
-    std::exception *ptr = 0;
+    // try to prevent the compiler from optimizing the dtor call away
+    std::exception *ptr;

-    if (2 < argc)
+    if (argc < 0x0FFF) //just a trick to force compiler to leave exception 
.dtor but never allow it to exceute
+    {
+       return 0;
+    }
+    //since test is executed without arguments we should never get there
         ptr = new Derived;
-    else if (1 < argc)
-        ptr = new std::exception;
-
     delete ptr;
-
-    return !(2 < argc ? 1 == dtor : 0 == dtor);
+    return 1;
 }

 Derived::~Derived () { ++dtor; }

----------------------------------------------------------------------------------------------------

Second part is to allow building of .lib.cpp files into shared libraries.

----------------------------------------------------------------------------------------------------
Index: D:/stdcxx/etc/config/src/collapse_static_locals.lib.cpp
===================================================================
--- D:/stdcxx/etc/config/src/collapse_static_locals.lib.cpp (revision 
312643)
+++ D:/stdcxx/etc/config/src/collapse_static_locals.lib.cpp (working copy)
@@ -1,6 +1,10 @@
+// also defined in COLLAPSE_STATIC_LOCALS.cpp

+// include _RWSTD_EXPORT definition
+#include <rw/_defs.h>
+
 // also defined in COLLAPSE_STATIC_LOCALS.cpp
-inline int foo ()
+_RWSTD_EXPORT inline int foo ()
 {
     // multiple instances of `i' must be collapsed
     static int i = 0;
@@ -8,7 +12,7 @@
 }

 // bar() returns foo()
-int bar ()
+_RWSTD_EXPORT int bar ()
 {
     return foo ();
 }


Index: D:/stdcxx/etc/config/src/collapse_template_locals.lib.cpp
===================================================================
--- D:/stdcxx/etc/config/src/collapse_template_locals.lib.cpp (revision 
312643)
+++ D:/stdcxx/etc/config/src/collapse_template_locals.lib.cpp (working copy)
@@ -1,7 +1,11 @@
+// also defined in COLLAPSE_TEMPLATE_STATICS.cpp

+// include _RWSTD_EXPORT definition
+#include <rw/_defs.h>
+
 // also defined in COLLAPSE_TEMPLATE_STATICS.cpp
 template <class T>
-T foo (T)
+_RWSTD_EXPORT T foo (T)
 {
     // multiple instances of `t' must be collapsed
     static T t;
@@ -10,7 +14,7 @@


 // bar() returns foo()
-int bar ()
+_RWSTD_EXPORT int bar ()
 {
     return foo (0);
 }


Index: D:/stdcxx/etc/config/src/collapse_template_statics.lib.cpp
===================================================================
--- D:/stdcxx/etc/config/src/collapse_template_statics.lib.cpp (revision 
312643)
+++ D:/stdcxx/etc/config/src/collapse_template_statics.lib.cpp (working 
copy)
@@ -1,4 +1,8 @@
+// also defined in COLLAPSE_TEMPLATE_STATICS.cpp

+// include _RWSTD_EXPORT definition
+#include <rw/_defs.h>
+
 // also defined in COLLAPSE_TEMPLATE_STATICS.cpp
 template <class T>
 struct S
@@ -11,7 +15,7 @@
 T S<T>::t;


-int bar ()
+_RWSTD_EXPORT int bar ()
 {
     // S<int>::t instantiated and modified in COLLAPSE_TEMPLATE_STATICS.cpp
     return S<int>::t++;

Index: D:/stdcxx/etc/config/src/extern_inline.lib.cpp
===================================================================
--- D:/stdcxx/etc/config/src/extern_inline.lib.cpp (revision 312643)
+++ D:/stdcxx/etc/config/src/extern_inline.lib.cpp (working copy)
@@ -1,14 +1,17 @@

-extern inline int foo (int i)
+// include _RWSTD_EXPORT definition
+#include <rw/_defs.h>
+
+_RWSTD_EXPORT extern inline int foo (int i)
 {
     return i + 1;
 }

-extern int bar (int i)
+_RWSTD_EXPORT extern int bar (int i)
 {
     return i + 1;
 }

 // take the address of the inline above to prevent
 // it from being optimized away
-extern int (*volatile pf)(int) = foo;
+_RWSTD_EXPORT extern int (*volatile pf)(int) = foo;

Index: D:/stdcxx/etc/config/src/lib_exceptions.lib.cpp
===================================================================
--- D:/stdcxx/etc/config/src/lib_exceptions.lib.cpp (revision 312643)
+++ D:/stdcxx/etc/config/src/lib_exceptions.lib.cpp (working copy)
@@ -1,7 +1,8 @@

-#include "config.h"
+// include _RWSTD_EXPORT definition
+#include <rw/_defs.h>

-int foo (int i)
+_RWSTD_EXPORT int foo (int i)
 {
     if (i)
         throw i;

---------------------------------------------------------------------------------------------------------

With best wishes,
Alex Ostapenko.


Mime
View raw message