aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2021-07-08 16:02:01 -0600
committerMartin Sebor <msebor@redhat.com>2021-07-08 16:03:19 -0600
commitc68cac900ab4ccaf6b1a31168bc9a302ebc46428 (patch)
tree7928a49d90b92a758a1a745a529d9236b9bff46d /gcc
parentdee00bf6894be0cabb8f263c993357a6f8444f8b (diff)
downloadgcc-c68cac900ab4ccaf6b1a31168bc9a302ebc46428.zip
gcc-c68cac900ab4ccaf6b1a31168bc9a302ebc46428.tar.gz
gcc-c68cac900ab4ccaf6b1a31168bc9a302ebc46428.tar.bz2
Avoid including <new> to make cross-compiler testing easy.
gcc/testsuite/ChangeLog: * g++.dg/warn/Warray-bounds-11.C: Avoid including <new>. * g++.dg/warn/Warray-bounds-13.C: Same.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-11.C19
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-13.C19
2 files changed, 36 insertions, 2 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
index 70b3912..9670898 100644
--- a/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
@@ -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;
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C
index 2d3e9dc..449324a 100644
--- a/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C
@@ -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;