You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/05/09 00:46:50 UTC

svn commit: r405208 - /incubator/stdcxx/trunk/tests/src/new.cpp

Author: sebor
Date: Mon May  8 15:46:49 2006
New Revision: 405208

URL: http://svn.apache.org/viewcvs?rev=405208&view=rev
Log:
2006-05-08  Martin Sebor  <se...@roguewave.com>

	* new.cpp (operator_new, operator_delete): Used rw_note() instead
	of rw_error() for tracing. Used the %#p rective to format pointers.

Modified:
    incubator/stdcxx/trunk/tests/src/new.cpp

Modified: incubator/stdcxx/trunk/tests/src/new.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/new.cpp?rev=405208&r1=405207&r2=405208&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/new.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/new.cpp Mon May  8 15:46:49 2006
@@ -6,16 +6,22 @@
  *
  ************************************************************************
  *
- * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License");  you may  not use this file except  in compliance with the
- * License.    You    may   obtain   a   copy   of    the   License    at
- * http://www.apache.org/licenses/LICENSE-2.0.    Unless   required    by
- * applicable law  or agreed to  in writing,  software  distributed under
- * the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR
- * CONDITIONS OF  ANY KIND, either  express or implied.  See  the License
- * for the specific language governing permissions  and limitations under
- * the License.
+ * Copyright 2005 - 2006 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Copyright 2003 - 2006 Rogue Wave Software.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  * 
  **************************************************************************/
 
@@ -133,8 +139,8 @@
             // check the lead guard
             if (hdr->self_ != hdr) {
                 rw_error (0, 0, __LINE__,
-                          "%s:%d: header guard corruption at %p: "
-                          "expected %p, got %p",
+                          "%s:%d: header guard corruption at %#p: "
+                          "expected %#p, got %#p",
                           hdr->ptr_, (const void*)hdr, hdr->self_);
                 abort ();
             }
@@ -143,7 +149,7 @@
             if (hdr->ptr_ != hdr + 1) {
                 rw_error (0, 0, __LINE__,
                           "%s:%d: block address mismatch: "
-                          "expected %p, got %p",
+                          "expected %#p, got %#p",
                           __FILE__, __LINE__,
                           (const void*)(hdr + 1), hdr->ptr_);
 
@@ -162,7 +168,7 @@
                 typedef unsigned char UChar;
 
                 rw_error (0, 0, __LINE__,
-                          "%s:%d: trailing guard corruption at %p "
+                          "%s:%d: trailing guard corruption at %#p "
                           "+ %zu of a %zu byte block: '0x%02x' != '0x%x'",
                           __FILE__, __LINE__, hdr->ptr_,
                           hdr->size_ + off + 1, hdr->size_,
@@ -201,7 +207,7 @@
 #if !defined (__DECCXX_VER) || __DECCXX_VER >= 60600000
 
         rw_error (0, 0, __LINE__,  
-                  "%s:%d: %s (%p): invalid pointer",
+                  "%s:%d: %s (%#p): invalid pointer",
                   __FILE__, __LINE__, caller, ptr);
 
         _rw_print_heap ();
@@ -215,7 +221,7 @@
         if (static_dtors) {
 
             rw_error (0, 0, __LINE__, 
-                      "%s:%d: %s (%p): invalid pointer",
+                      "%s:%d: %s (%#p): invalid pointer",
                       __FILE__, __LINE__, caller, ptr);
 
             print_heap ();
@@ -228,7 +234,7 @@
 
             if (!warned++) {
                 rw_warning (0, 0, __LINE__,
-                            "%s:%d: %s (%p): warning: invalid pointer; "
+                            "%s:%d: %s (%#p): warning: invalid pointer; "
                             "ignoring memory errors from here on out",
                             __FILE__, __LINE__, caller, ptr);
             }
@@ -256,7 +262,7 @@
         const bool array = !!(seq >> (_RWSTD_CHAR_BIT * sizeof (size_t) - 1));
 
         rw_info (0, 0, __LINE__, 
-                 "%zu: %zu bytes at %p allocated by operator new%s()",
+                 "%zu: %zu bytes at %#p allocated by operator new%s()",
                  hdr->id_, hdr->size_, hdr->ptr_, array ? "[]" : "");
     }
 
@@ -404,7 +410,7 @@
         }
 
         if (trace_sequence [0] <= seq_gen && seq_gen < trace_sequence [1])
-            rw_fprintf (rw_stderr, "%s:%d: %s (%zu) --> %p\n",
+            rw_fprintf (rw_stderr, "%s:%d: %s (%zu) --> %#p\n",
                         __FILE__, __LINE__, name [array], nbytes, ptr);
 
         return 0;
@@ -477,10 +483,10 @@
     last = hdr;
 
     if (trace_sequence [0] <= seq_gen && seq_gen < trace_sequence [1])
-        rw_error (0, 0, __LINE__,
-                  "%s:%d: %3zi. %s (%zu) --> %p", 
-                  __FILE__, __LINE__, seq_gen, 
-                  name [array], nbytes, hdr->ptr_);
+        rw_note (0, 0, __LINE__,
+                 "%s:%d: %3zi. %s (%zu) --> %#p", 
+                 __FILE__, __LINE__, seq_gen, 
+                 name [array], nbytes, hdr->ptr_);
 
     ++seq_gen;
 
@@ -538,9 +544,13 @@
         }
 
         if (trace_sequence [0] <= seq && seq < trace_sequence [1]) {
-            rw_error (0, 0, __LINE__, "%s:%d: %3zi. %s (%p); size = %zu%s",
-                      __FILE__, __LINE__, seq, name [array], ptr, nbytes,
-                      mismatch ? ": array form mismatch" : "");
+            if (mismatch)
+                rw_error (0, 0, __LINE__, "%s:%d: %3zi. %s (%#p); size = %zu"
+                          ": array form mismatch",
+                          __FILE__, __LINE__, seq, name [array], ptr, nbytes);
+            else
+                rw_note (0, 0, __LINE__, "%s:%d: %3zi. %s (%#p); size = %zu",
+                         __FILE__, __LINE__, seq, name [array], ptr, nbytes);
         }
         else if (mismatch) {
 
@@ -553,7 +563,7 @@
                       "%s:%d: deallocation mismatch: "
                       "pointer allocated %zu%s in the program "
                       "with a call to operator new%s(%zu) "
-                      "being deallocated with the wrong form of %s(%p)",
+                      "being deallocated with the wrong form of %s(%#p)",
                       __FILE__, __LINE__,
                       seq + 1, ord_sfx, array ? "" : "[]",
                       nbytes, name [array], ptr);
@@ -587,8 +597,8 @@
         ++pst->delete_0_calls_ [array];
 
         if (trace_sequence [0] <= seq_gen && seq_gen < trace_sequence [1])
-            rw_error (0, 0, __LINE__, "%s:%d: %s (0)", 
-                      __FILE__, __LINE__, name [array]);
+            rw_note (0, 0, __LINE__, "%s:%d: %s (0)", 
+                     __FILE__, __LINE__, name [array]);
     }
 }