diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/guality | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/guality')
-rw-r--r-- | gcc/testsuite/g++.dg/guality/guality.exp | 54 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/guality/guality.h | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/guality/pr46815.C | 25 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/guality/redeclaration1.C | 27 |
4 files changed, 107 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp new file mode 100644 index 000000000..749691dab --- /dev/null +++ b/gcc/testsuite/g++.dg/guality/guality.exp @@ -0,0 +1,54 @@ +# This harness is for tests that should be run at all optimisation levels. + +load_lib g++-dg.exp +load_lib gcc-gdb-test.exp + +# Disable on darwin until radr://7264615 is resolved. +# Disable on Tru64 UNIX (PR testsuite/48251). +if { [istarget *-*-darwin*] || [istarget alpha*-dec-osf*] } { + return +} + +proc check_guality {args} { + set result [eval check_compile guality_check executable $args "-g -O0"] + set lines [lindex $result 0] + set output [lindex $result 1] + set ret 0 + if {[string match "" $lines]} { + set execout [g++_load "./$output"] + set ret [string match "*1 PASS, 0 FAIL, 0 UNRESOLVED*" $execout] + } + remote_file build delete $output + return $ret +} + +dg-init + +global GDB +if ![info exists ::env(GUALITY_GDB_NAME)] { + if [info exists GDB] { + set guality_gdb_name "$GDB" + } else { + set guality_gdb_name "[transform gdb]" + } + setenv GUALITY_GDB_NAME "$guality_gdb_name" +} + +if {[check_guality " + #include \"$srcdir/$subdir/guality.h\" + volatile long int varl = 6; + int main (int argc, char *argv\[\]) + { + GUALCHKVAL (varl); + return 0; + } +"]} { + gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] "" + gcc-dg-runtest [lsort [glob $srcdir/c-c++-common/guality/*.c]] "" +} + +if [info exists guality_gdb_name] { + unsetenv GUALITY_GDB_NAME +} + +dg-finish diff --git a/gcc/testsuite/g++.dg/guality/guality.h b/gcc/testsuite/g++.dg/guality/guality.h new file mode 100644 index 000000000..dd858d28b --- /dev/null +++ b/gcc/testsuite/g++.dg/guality/guality.h @@ -0,0 +1 @@ +#include "../../gcc.dg/guality/guality.h" diff --git a/gcc/testsuite/g++.dg/guality/pr46815.C b/gcc/testsuite/g++.dg/guality/pr46815.C new file mode 100644 index 000000000..41b921995 --- /dev/null +++ b/gcc/testsuite/g++.dg/guality/pr46815.C @@ -0,0 +1,25 @@ +// PR debug/46815 +// { dg-do run } +// { dg-options "-g" } +// { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } + +struct S +{ + int i; + S () { i = 42; } + virtual void foo (void) {} +}; + +S +bar () +{ + S s; + return s; // { dg-final { gdb-test 17 "s.i" "42" } } +} + +int +main () +{ + S s = bar (); + return s.i - 42; +} diff --git a/gcc/testsuite/g++.dg/guality/redeclaration1.C b/gcc/testsuite/g++.dg/guality/redeclaration1.C new file mode 100644 index 000000000..93b0750b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/guality/redeclaration1.C @@ -0,0 +1,27 @@ +// { dg-do run } +// { dg-options "-g" } +// { dg-skip-if "" { *-*-* } { "-flto" } { "" } } + +volatile int l; + +namespace S +{ + int i = 24; + void __attribute__((noinline)) + f() + { + int i = 42; + l = i; // { dg-final { gdb-test 14 "i" "42" } } + { + extern int i; + l = i; // { dg-final { gdb-test 17 "i" "24" } } + } + } +} + +int +main (void) +{ + S::f (); + return 0; +} |