diff options
author | Joseph Myers <joseph@codesourcery.com> | 2009-03-30 17:31:46 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2009-03-30 17:31:46 +0000 |
commit | 821a687bb3bfa18eabfc9e717c5c9f480fd9647e (patch) | |
tree | a6e57b0336a8e766192d6b7b6f59bd62093e8234 /gcc/testsuite/g++.dg/graphite | |
parent | e0b05a75af586156d675d122abddbe0d527b0c16 (diff) |
svn merge -r144476:145289 svn+ssh://gcc.gnu.org/svn/gcc/trunkc-4_5-branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/c-4_5-branch@145306 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/graphite')
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/graphite.exp | 48 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/pr39447.C | 34 |
2 files changed, 82 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/graphite/graphite.exp b/gcc/testsuite/g++.dg/graphite/graphite.exp new file mode 100644 index 00000000000..d1993a2e805 --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/graphite.exp @@ -0,0 +1,48 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib g++-dg.exp + +if ![check_effective_target_fgraphite] { + return +} + +# The default action for a test is 'compile'. Save current default. +global dg-do-what-default +set save-dg-do-what-default ${dg-do-what-default} +set dg-do-what-default compile + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \ + "" $DEFAULT_CFLAGS + +# Clean up. +set dg-do-what-default ${save-dg-do-what-default} + +# All done. +dg-finish diff --git a/gcc/testsuite/g++.dg/graphite/pr39447.C b/gcc/testsuite/g++.dg/graphite/pr39447.C new file mode 100644 index 00000000000..a0d09ec2b93 --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/pr39447.C @@ -0,0 +1,34 @@ +/* { dg-options "-O2 -fgraphite-identity" } */ + +struct Point +{ + int line, col; + + Point( int l = -1, int c = 0 ) throw() : line( l ), col( c ) {} + bool operator==( const Point & p ) const throw() + { return ( line == p.line && col == p.col ); } + bool operator<( const Point & p ) const throw() + { return ( line < p.line || ( line == p.line && col < p.col ) ); } +}; + +class Buffer +{ +public: + int characters( const int line ) const throw(); + int pgetc( Point & p ) const throw(); + Point eof() const throw() { return Point( 0, 0 ); } + bool pisvalid( const Point & p ) const throw() + { return ( ( p.col >= 0 && p.col < characters( p.line ) ) || p == eof() ); + } + bool save( Point p1 = Point(), Point p2 = Point() ) const; +}; + +bool Buffer::save( Point p1, Point p2 ) const +{ + if( !this->pisvalid( p1 ) ) p1 = eof(); + if( !this->pisvalid( p2 ) ) p2 = eof(); + for( Point p = p1; p < p2; ) { pgetc( p ); } + return true; +} + + |