aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2014-09-23 11:06:57 +0000
committerMark Wielaard <mark@gcc.gnu.org>2014-09-23 11:06:57 +0000
commit0043a6c9b9b7ad956c5db232e46b2b760ada0cec (patch)
tree68e2de7310100b3e2764d6485db8fb53e26ec603
parent6c979aa1bf4cb88c7934cea3453802d5281f7dff (diff)
downloadgcc-0043a6c9b9b7ad956c5db232e46b2b760ada0cec.zip
gcc-0043a6c9b9b7ad956c5db232e46b2b760ada0cec.tar.gz
gcc-0043a6c9b9b7ad956c5db232e46b2b760ada0cec.tar.bz2
gcc-gdb-test.exp: Handle old GDB "short int" and "long int" types.
Old GDB might show short and long as short int and long int. This made gcc.dg/guality/const-volatile.c ans restrict.c fail on older GDBs. According to the patch that changed this in newer versions of GDB this was a bug: https://sourceware.org/ml/gdb-patches/2012-09/msg00455.html The patch transforms the types "short int" and "long int" coming from GDB to plain "short" and "long". And a variant has been added to the const-volatile.c testcase to make sure short and long long are handled correctly now with older GDB. gcc/testsuite/ChangeLog * lib/gcc-gdb-test.exp (gdb-test): Transform gdb types "short int" and "long int" to plain "short" and "long". * gcc.dg/guality/const-volatile.c (struct bar): New struct containing short and long long fields. (bar): New variable to test the type. From-SVN: r215501
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/guality/const-volatile.c11
-rw-r--r--gcc/testsuite/lib/gcc-gdb-test.exp4
3 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ff5c506..e80c48a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2014-09-20 Mark Wielaard <mjw@redhat.com>
+
+ * lib/gcc-gdb-test.exp (gdb-test): Transform gdb types "short int"
+ and "long int" to plain "short" and "long".
+ * gcc.dg/guality/const-volatile.c (struct bar): New struct
+ containing short and long long fields.
+ (bar): New variable to test the type.
+
2014-09-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/62155
diff --git a/gcc/testsuite/gcc.dg/guality/const-volatile.c b/gcc/testsuite/gcc.dg/guality/const-volatile.c
index 86460e4..eb45ae5 100644
--- a/gcc/testsuite/gcc.dg/guality/const-volatile.c
+++ b/gcc/testsuite/gcc.dg/guality/const-volatile.c
@@ -28,6 +28,16 @@ struct foo
const signed char csc;
};
+struct bar
+{
+ short s;
+ const short cs;
+ volatile short vs;
+ const volatile short cvs;
+ volatile long long vll;
+};
+
+struct bar bar __attribute__((used));
struct foo foo;
const struct foo cfoo;
volatile struct foo vfoo;
@@ -72,6 +82,7 @@ main (int argc, char **argv)
/* { dg-final { gdb-test 50 "type:cvip" "int * const volatile" } } */
+/* { dg-final { gdb-test 50 "type:bar" "struct bar { short s; const short cs; volatile short vs; const volatile short cvs; volatile long long vll; }" } } */
/* { dg-final { gdb-test 50 "type:foo" "struct foo { const long cli; const signed char csc; }" } } */
/* { dg-final { gdb-test 50 "type:cfoo" "const struct foo { const long cli; const signed char csc; }" } } */
/* { dg-final { gdb-test 50 "type:vfoo" "volatile struct foo { const long cli; const signed char csc; }" } } */
diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp
index c729793..cc37bf0 100644
--- a/gcc/testsuite/lib/gcc-gdb-test.exp
+++ b/gcc/testsuite/lib/gcc-gdb-test.exp
@@ -111,6 +111,10 @@ proc gdb-test { args } {
# Squash all extra whitespace/newlines that gdb might use for
# "pretty printing" into one so result is just one line.
regsub -all {[\n\r\t ]+} $type " " type
+ # Old gdb might output "long int" instead of just "long"
+ # and "short int" instead of just "short". Canonicalize.
+ regsub -all {\mlong int\M} $type "long" type
+ regsub -all {\mshort int\M} $type "short" type
set expected [lindex $args 2]
if { $type == $expected } {
pass "$testname"