stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r328180 - /incubator/stdcxx/trunk/etc/config/src/
Date Mon, 24 Oct 2005 22:42:35 GMT
Author: sebor
Date: Mon Oct 24 15:42:11 2005
New Revision: 328180

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

	STDCXX-15
	* BAD_ALLOC_ASSIGNMENT.cpp: Consistently and in a uniform way avoided
	executing the body of main unless explicitly requested by specifying
	at least one command line argument. Done to foil aggressive optimizers
	and to prevent them from eliminating the code.
	* BAD_ALLOC_COPY_CTOR: Same.
	* BAD_ALLOC_DEFAULT_CTOR: Same.
	* BAD_ALLOC_DTOR: Same.
	* BAD_ALLOC_WHAT: Same.
	* BAD_CAST_ASSIGNMENT: Same.
	* BAD_CAST_COPY_CTOR: Same.
	* BAD_CAST_DEFAULT_CTOR: Same.
	* BAD_CAST_DTOR: Same.
	* BAD_CAST_WHAT: Same.
	* BAD_EXCEPTION_ASSIGNMENT: Same.
	* BAD_EXCEPTION_COPY_CTOR: Same.
	* BAD_EXCEPTION_DEFAULT_CTOR: Same.
	* BAD_EXCEPTION_DTOR: Same.
	* BAD_TYPEID_ASSIGNMENT: Same.
	* BAD_TYPEID_COPY_CTOR: Same.
	* BAD_TYPEID_DEFAULT_CTOR: Same.
	* BAD_TYPEID_DTOR: Same.
	* BAD_TYPEID_WHAT: Same.
	* EXCEPTION_ASSIGNMENT: Same.
	* EXCEPTION_COPY_CTOR: Same.
	* EXCEPTION_DEFAULT_CTOR: Same.
	* EXCEPTION_DTOR: Same.
	* EXCEPTION_WHAT: Same.
	* TYPE_INFO_DTOR: 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_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_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
    incubator/stdcxx/trunk/etc/config/src/TYPE_INFO_DTOR.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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_ASSIGNMENT.cpp Mon Oct 24 15:42:11 2005
@@ -85,11 +85,14 @@
 
 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)
-        foo ();
+    // 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;

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=328180&r1=328179&r2=328180&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 Mon Oct 24 15:42:11 2005
@@ -77,7 +77,12 @@
 
 int main (int argc, char *argv[])
 {
-    (void)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
 
@@ -114,16 +119,9 @@
 
 #else   // if defined (_RWSTD_NO_EXCEPTIONS)
 
-    // prevent the code 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_alloc a;
-        std::bad_alloc b (a);
-
-        (void)&a;
-        (void)&b;
-    }
+    std::bad_alloc a;
+    std::bad_alloc b (a);
+    (void)&b;
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 

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=328180&r1=328179&r2=328180&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 Mon Oct 24 15:42:11 2005
@@ -54,21 +54,24 @@
 
 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
 
-    if (argc > 1)
-        throw std::bad_alloc ();
+    throw std::bad_alloc ();
+
+    // link only test
+    return 0;
 
 #else   // if defined (_RWSTD_NO_EXCEPTIONS)
 
-    // 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 > 1)
-        return argv [0] == new std::bad_alloc ();
+    return argv [0] == new std::bad_alloc ();
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 
-    // link only test
-    return 0;
 }

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_DTOR.cpp Mon Oct 24 15:42:11 2005
@@ -79,10 +79,15 @@
 
 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 = argc > 1 ? new Derived : new std::bad_alloc;
+    std::bad_alloc *ptr = argc > 2 ? new Derived : new std::bad_alloc;
 
     delete ptr;
 

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_ALLOC_WHAT.cpp Mon Oct 24 15:42:11 2005
@@ -71,17 +71,15 @@
 
 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;
 
-    // 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_alloc e;
-
-        return !e.what ();
-    }
+    std::bad_alloc e;
 
     // link only test
-    return 0;
+    return !e.what ();
 }

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_CAST_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_CAST_ASSIGNMENT.cpp Mon Oct 24 15:42:11 2005
@@ -88,11 +88,14 @@
 
 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)
-        foo ();
+    // 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;

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=328180&r1=328179&r2=328180&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 Mon Oct 24 15:42:11 2005
@@ -77,16 +77,18 @@
 
 int main (int argc, char *argv[])
 {
-    // prevent the code from actually being executed but do it so
-    // that the optimizer can't actually figure it out and eliminate
-    // the function
-    if (argc > 256) {
-        std::bad_cast a;
-        std::bad_cast b (a);
+    // 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;
 
-        (void)&a;
-        (void)&b;
-    }
+    std::bad_cast a;
+    std::bad_cast b (a);
+
+    (void)&a;
+    (void)&b;
 
     // link only test
     return 0;

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=328180&r1=328179&r2=328180&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 Mon Oct 24 15:42:11 2005
@@ -62,12 +62,13 @@
 
 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)
-        return argv [0] == foo ();
+    // 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 0;
+    return argv [0] == foo ();
 }

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_CAST_DTOR.cpp Mon Oct 24 15:42:11 2005
@@ -75,10 +75,15 @@
 
 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_cast *ptr = argc > 1 ? new Derived : new std::bad_cast;
+    std::bad_cast *ptr = argc > 2 ? new Derived : new std::bad_cast;
 
     delete ptr;
 

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_CAST_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_CAST_WHAT.cpp Mon Oct 24 15:42:11 2005
@@ -75,15 +75,15 @@
 
 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_cast bc;
+    // 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;
 
-	return !bc.what ();
-    }
+    std::bad_cast bc;
 
     // link only test
-    return 0;
+    return !bc.what ();
 }

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_ASSIGNMENT.cpp Mon Oct 24 15:42:11
2005
@@ -88,11 +88,14 @@
 
 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)
-        foo ();
+    // 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;

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=328180&r1=328179&r2=328180&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 Mon Oct 24 15:42:11
2005
@@ -77,16 +77,18 @@
 
 int main (int argc, char *argv[])
 {
-    // prevent the code from actually being executed but do it so
-    // that the optimizer can't actually figure it out and eliminate
-    // the function
-    if (argc > 256) {
-        std::bad_exception a;
-        std::bad_exception b (a);
+    // 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;
 
-        (void)&a;
-        (void)&b;
-    }
+    std::bad_exception a;
+    std::bad_exception b (a);
+
+    (void)&a;
+    (void)&b;
 
     // link only test
     return 0;

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=328180&r1=328179&r2=328180&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 Mon Oct 24 15:42:11
2005
@@ -62,12 +62,13 @@
 
 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)
-        return argv [0] == foo ();
+    // 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 0;
+    return argv [0] == foo ();
 }

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_EXCEPTION_DTOR.cpp Mon Oct 24 15:42:11 2005
@@ -75,10 +75,15 @@
 
 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_exception *ptr = argc > 1 ? new Derived : new std::bad_exception;
+    std::bad_exception *ptr = argc > 2 ? new Derived : new std::bad_exception;
 
     delete ptr;
 

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_ASSIGNMENT.cpp Mon Oct 24 15:42:11 2005
@@ -88,11 +88,14 @@
 
 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)
-        foo ();
+    // 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;

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=328180&r1=328179&r2=328180&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 Mon Oct 24 15:42:11 2005
@@ -77,16 +77,18 @@
 
 int main (int argc, char *argv[])
 {
-    // prevent the code from actually being executed but do it so
-    // that the optimizer can't actually figure it out and eliminate
-    // the function
-    if (argc > 256) {
-        std::bad_typeid a;
-        std::bad_typeid b (a);
+    // 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;
 
-        (void)&a;
-        (void)&b;
-    }
+    std::bad_typeid a;
+    std::bad_typeid b (a);
+
+    (void)&a;
+    (void)&b;
 
     // link only test
     return 0;

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=328180&r1=328179&r2=328180&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 Mon Oct 24 15:42:11
2005
@@ -61,12 +61,13 @@
 
 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)
-        return argv [0] == foo ();
+    // 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 0;
+    return argv [0] == foo ();
 }

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/BAD_TYPEID_WHAT.cpp Mon Oct 24 15:42:11 2005
@@ -75,15 +75,15 @@
 
 int main (int argc, char *argv[])
 {
-    // prevent the code from actually being executed but do it so
-    // that the optimizer can't actually figure it out and eliminate
-    // the function
-    if (argc > 256) {
-        std::bad_typeid e;
+    // 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;
 
-        return !e.what ();
-    }
+    std::bad_typeid e;
 
     // link only test
-    return 0;
+    return !e.what ();
 }

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_ASSIGNMENT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_ASSIGNMENT.cpp Mon Oct 24 15:42:11 2005
@@ -85,11 +85,14 @@
 
 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)
-        foo ();
+    // 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;

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_COPY_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_COPY_CTOR.cpp Mon Oct 24 15:42:11 2005
@@ -88,39 +88,36 @@
 
 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;
 
-    // prevent the code from actually being called but do it so
-    // that the optimizer can't actually figure it out and eliminate
-    // the function
-    if (argc > 1) {
-        Derived d0;
-        Derived d1 (d0);
-        std::exception e (d0);
+    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
-
+    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);
     }
-    else
-	copy = 1;
+    catch (std::exception e) {
+        return !(1 == copy);
+    }
+#endif
 
     // link only test
     return !(1 == copy);

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DEFAULT_CTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DEFAULT_CTOR.cpp Mon Oct 24 15:42:11 2005
@@ -65,14 +65,16 @@
 
 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 > 1) {
-        Derived *p = new Derived ();
+    // 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;
 
-	result = result != p->dflt_;
-    }
+    Derived *p = new Derived ();
+
+    result = result != p->dflt_;
 
     // link only test
     return result;

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp Mon Oct 24 15:42:11 2005
@@ -60,8 +60,6 @@
 
 #endif   // _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
 
-    // check to see if the class dtor is defined
-    // in the compiler's language support library
     virtual ~exception ();   // not defined here
 };
 
@@ -79,20 +77,24 @@
 
 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;
 
-    // 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 (1 < argc)
         ptr = new Derived;
-    else if (1 < argc)
+    else
         ptr = new std::exception;
 
     delete ptr;
 
-    return !(2 < argc ? 1 == dtor : 0 == dtor);
+    return !(1 < argc ? 1 == dtor : 0 == dtor);
 }
 
 Derived::~Derived () { ++dtor; }

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=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_WHAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_WHAT.cpp Mon Oct 24 15:42:11 2005
@@ -75,15 +75,15 @@
 
 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::exception e;
+    // 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;
 
-        return !e.what ();
-    }
+    std::exception e;
 
     // link only test
-    return 0;
+    return !e.what ();
 }

Modified: incubator/stdcxx/trunk/etc/config/src/TYPE_INFO_DTOR.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/TYPE_INFO_DTOR.cpp?rev=328180&r1=328179&r2=328180&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/TYPE_INFO_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/TYPE_INFO_DTOR.cpp Mon Oct 24 15:42:11 2005
@@ -69,11 +69,14 @@
 
 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)
-        foo (argv [argc]);
+    // 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 (argv [argc]);
 
     // link only test 
     return 0;



Mime
View raw message