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.
This commit is contained in:
Martin Sebor 2021-07-08 16:02:01 -06:00
parent dee00bf689
commit c68cac900a
2 changed files with 36 additions and 2 deletions

View 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;

View 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;