summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2017-05-03 12:41:09 -0700
committerKeith Seitz <keiths@redhat.com>2017-05-03 12:41:09 -0700
commit90cef2edd256c48d2ff9a03d4a6c1bcb575db07c (patch)
treee1a9e5a61a87f832ea75c34e53c681ce4fd6b4b2 /gdb/testsuite/gdb.cp
parentb22908217d8593185af3f76fab6f0f01457b0600 (diff)
Make sure malloc is linked into gdb.cp/oranking.cc.
On some platforms, e.g., arm-eabi-none, we need to make certain that malloc is linked into the program because the test suite uses function calls requiring malloc: (gdb) p foo101("abc") evaluation of this expression requires the program to have a function "malloc". gdb/testsuite/ChangeLog * gdb.cp/oranking.cc (dummy): New function to grab malloc. (main): Call it.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/oranking.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/oranking.cc b/gdb/testsuite/gdb.cp/oranking.cc
index bd2f51bb05..135761016c 100644
--- a/gdb/testsuite/gdb.cp/oranking.cc
+++ b/gdb/testsuite/gdb.cp/oranking.cc
@@ -1,3 +1,18 @@
+#include <cstdlib>
+
+/* Make sure `malloc' is linked into the program. If we don't, tests
+ in the accompanying expect file may fail:
+
+ evaluation of this expression requires the program to have a function
+ "malloc". */
+
+void
+dummy ()
+{
+ void *p = malloc (16);
+
+ free (p);
+}
/* 1. A standard covnersion sequence is better than a user-defined sequence
which is better than an elipses conversion sequence. */
@@ -165,6 +180,8 @@ test15 ()
}
int main() {
+ dummy ();
+
B b;
foo0(b);
foo1(b);