public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2175] Avoid including <new> to make cross-compiler testing easy.
@ 2021-07-08 22:03 Martin Sebor
  0 siblings, 0 replies; only message in thread
From: Martin Sebor @ 2021-07-08 22:03 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c68cac900ab4ccaf6b1a31168bc9a302ebc46428

commit r12-2175-gc68cac900ab4ccaf6b1a31168bc9a302ebc46428
Author: Martin Sebor <msebor@redhat.com>
Date:   Thu Jul 8 16:02:01 2021 -0600

    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.

Diff:
---
 gcc/testsuite/g++.dg/warn/Warray-bounds-11.C | 19 ++++++++++++++++++-
 gcc/testsuite/g++.dg/warn/Warray-bounds-13.C | 19 ++++++++++++++++++-
 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 70b39122f78..9670898770f 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 2d3e9dcfd68..449324a315d 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-08 22:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 22:03 [gcc r12-2175] Avoid including <new> to make cross-compiler testing easy Martin Sebor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).