public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix "'operator new' should not return NULL" errors in testsuite
@ 2020-05-29 21:41 gdb-buildbot
  2020-05-29 21:41 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gdb-buildbot @ 2020-05-29 21:41 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT cee00f171520eb85867230d4cbed34480c64e71e ***

commit cee00f171520eb85867230d4cbed34480c64e71e
Author:     Gary Benson <gbenson@redhat.com>
AuthorDate: Thu May 28 14:18:36 2020 +0100
Commit:     Gary Benson <gbenson@redhat.com>
CommitDate: Thu May 28 14:18:36 2020 +0100

    Fix "'operator new' should not return NULL" errors in testsuite
    
    When running the testsuite with clang, gdb.linespec/cpls-ops.cc
    fails to compile with the following errors:
      warning: 'operator new' should not return a null pointer unless
        it is declared 'throw()' or 'noexcept' [-Wnew-returns-null]
      warning: 'operator new[]' should not return a null pointer unless
        it is declared 'throw()' or 'noexcept' [-Wnew-returns-null]
    
    This prevents the gdb.linespec/cpls-ops.exp testcase from executing.
    This commit fixes.
    
    gdb/testsuite/ChangeLog:
    
            * gdb.linespec/cpls-ops.cc (dummy): New static global.
            (test_op_new::operator new): Add return statement.
            (test_op_new_array::operator new[]): Likewise.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 41224f9db2..d5554430bf 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-28  Gary Benson <gbenson@redhat.com>
+
+	* gdb.linespec/cpls-ops.cc (dummy): New static global.
+	(test_op_new::operator new): Add return statement.
+	(test_op_new_array::operator new[]): Likewise.
+
 2020-05-27  Pedro Alves  <palves@redhat.com>
 
 	* gdb.linespec/cp-completion-aliases.exp: Remove readline_is_used
diff --git a/gdb/testsuite/gdb.linespec/cpls-ops.cc b/gdb/testsuite/gdb.linespec/cpls-ops.cc
index 283e188e6c..e9dce59e15 100644
--- a/gdb/testsuite/gdb.linespec/cpls-ops.cc
+++ b/gdb/testsuite/gdb.linespec/cpls-ops.cc
@@ -91,6 +91,8 @@ test_op_array::operator[] (T *t)
 
 /* Code for operator new tests.  */
 
+static int dummy;
+
 struct test_op_new
 {
   void *operator new (size_t);
@@ -99,7 +101,7 @@ struct test_op_new
 void *
 test_op_new::operator new (size_t)
 {
-  return NULL;
+  return &dummy;
 }
 
 /* Code for operator delete tests.  */
@@ -124,7 +126,7 @@ struct test_op_new_array
 void *
 test_op_new_array::operator new[] (size_t)
 {
-  return NULL;
+  return &dummy;
 }
 
 /* Code for operator delete[] tests.  */


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-06-29  4:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 21:41 [binutils-gdb] Fix "'operator new' should not return NULL" errors in testsuite gdb-buildbot
2020-05-29 21:41 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot
2020-05-29 21:59 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2020-06-29  1:54 ` Failures on Fedora-i686, " gdb-buildbot
2020-06-29  2:27 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-06-29  2:28 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-06-29  3:01 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-06-29  3:15 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-06-29  3:44 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-06-29  3:52 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-06-29  4:22 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

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).