]> gcc.gnu.org Git - gcc.git/commitdiff
Avoid including <new> to make cross-compiler testing easy.
authorMartin Sebor <msebor@redhat.com>
Thu, 8 Jul 2021 22:02:01 +0000 (16:02 -0600)
committerMartin Sebor <msebor@redhat.com>
Thu, 8 Jul 2021 22:03:19 +0000 (16:03 -0600)
gcc/testsuite/ChangeLog:

* g++.dg/warn/Warray-bounds-11.C: Avoid including <new>.
* g++.dg/warn/Warray-bounds-13.C: Same.

gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
gcc/testsuite/g++.dg/warn/Warray-bounds-13.C

index 70b39122f78abea5e08a0d85833196dbc01970b0..9670898770fae45c5d5e1153df5840331febd191 100644 (file)
@@ -4,7 +4,24 @@
    { dg-do compile }
    { dg-options "-O2 -Wall -Warray-bounds -ftrack-macro-expansion=0" } */
 
-#include <new>
+#if 0
+// Avoid including <new> to make cross-compiler testing easy.
+// #include <new>
+#else
+namespace std {
+
+typedef __SIZE_TYPE__ size_t;
+struct nothrow_t { };
+extern const nothrow_t nothrow;
+
+}
+
+void* operator new (std::size_t, const std::nothrow_t &) throw ()
+  __attribute__  ((__alloc_size__ (1), __malloc__));
+void* operator new[] (std::size_t, const std::nothrow_t &) throw ()
+    __attribute__  ((__alloc_size__ (1), __malloc__));
+
+#endif
 
 typedef __INT32_TYPE__ int32_t;
 
index 2d3e9dcfd684f5c9eed46f927e603ab7c30c5a37..449324a315d0f91cdbeda1effea2526744d9a03c 100644 (file)
@@ -4,7 +4,24 @@
    { dg-do compile }
    { dg-options "-O2 -Wall -Warray-bounds -ftrack-macro-expansion=0" } */
 
-#include <new>
+#if 0
+// Avoid including <new> to make cross-compiler testing easy.
+// #include <new>
+#else
+namespace std {
+
+typedef __SIZE_TYPE__ size_t;
+struct nothrow_t { };
+extern const nothrow_t nothrow;
+
+}
+
+void* operator new (std::size_t, const std::nothrow_t &) throw ()
+  __attribute__  ((__alloc_size__ (1), __malloc__));
+void* operator new[] (std::size_t, const std::nothrow_t &) throw ()
+    __attribute__  ((__alloc_size__ (1), __malloc__));
+
+#endif
 
 typedef __INT32_TYPE__ int32_t;
 
This page took 0.066323 seconds and 5 git commands to generate.