OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-old/gcc-4.2.2/gcc/testsuite/treelang/output
    from Rev 154 to Rev 816
    Reverse comparison

Rev 154 → Rev 816

/output-1.c
0,0 → 1,43
/* Driver for treelang test pgm */
 
/*
 
Copyright (C) 2001, 2002, 2007 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, 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/>.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding!
*/
 
int add(int, int);
int subtract(int, int);
int first_nonzero(int, int);
extern int printf(char *template, ...);
 
int
main (int argc, char *argv[])
{
printf("2:%d\n", add(1,1));
printf("7:%d\n", add(3,4));
printf("-1:%d\n", subtract(3,4));
printf("1:%d\n", subtract(2,1));
printf("3:%d\n", first_nonzero(0,3));
printf("0:%d\n", first_nonzero(0,0));
printf("1:%d\n", first_nonzero(1,0));
printf("15:%d\n", double_plus_one(7));
return 0;
}
output-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: output-1.out =================================================================== --- output-1.out (nonexistent) +++ output-1.out (revision 816) @@ -0,0 +1,8 @@ +2:2 +7:7 +-1:-1 +1:1 +3:3 +0:0 +1:1 +15:15 Index: output.exp =================================================================== --- output.exp (nonexistent) +++ output.exp (revision 816) @@ -0,0 +1,58 @@ +proc test_treelang_output { testname srcfiles infile resfile args } { + set comp_output [treelang_target_compile $srcfiles $testname executable $args] + if { [treelang_check_compile $testname $args $testname $comp_output] == 0 } { + return 0; + } + + verbose "Expected output is in $resfile" + set id [open $resfile r] + set expected "" + append expected [read $id] + close $id + set output "" + set output [exec $testname $infile] + regsub -all "\r" "$output" "" output + regsub "\n*$" $expected "" expected + regsub "\n*$" $output "" output + regsub "^\n*" $expected "" expected + regsub "^\n*" $output "" output + regsub -all "\[ \t\]\[ \t\]*" $expected " " expected + regsub -all "\[ \t\]*\n\n*" $expected "\n" expected + regsub -all "\[ \t\]\[ \t\]*" $output " " output + regsub -all "\[ \t\]*\n\n*" $output "\n" output + verbose "expected is $expected" + verbose "actual is $output" + + if { $expected == $output } { + pass $testname + } else { + fail $testname + } + exec rm $testname +} +global srcdir subdir + +catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.out] } outfiles +verbose "Output files are $outfiles" + +set prefix "" +foreach x $outfiles { + regsub "\\.out$" $x "" prefix + set bname [file tail $prefix] + + if [file exists ${prefix}.inp] { + set inpfile ${prefix}.inp + } else { + set inpfile "" + } + + verbose "inpfile is $inpfile" + + set srcfiles [lsort [glob -nocomplain ${prefix}.{c,tree}]] + verbose "source files are $srcfiles" + test_treelang_output "treelang/$bname" $srcfiles $inpfile $x "" +} + +# Local Variables: +# tcl-indent-level:4 +# End: Index: output-1.tree =================================================================== --- output-1.tree (nonexistent) +++ output-1.tree (revision 816) @@ -0,0 +1,59 @@ +// -*- c -*- c mode in emacs + +// Copyright (C) 2001, 2002, 2007 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, 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 +// . +// +// In other words, you are welcome to use, share and improve this program. +// You are forbidden to forbid anyone else to use, share and improve +// what you give them. Help stamp out software-hoarding! + + +external_definition int add(int arg1, int arg2); +external_definition int subtract(int arg3, int arg4); +external_definition int first_nonzero(int arg5, int arg6); +external_definition int double_plus_one(int arg7); + +add +{ + return arg1 + arg2; +} + + +subtract +{ + return arg3 - arg4; +} + +double_plus_one +{ + automatic int aaa; + aaa=add(arg7, arg7); + aaa=add(aaa, aaa); + aaa=subtract(subtract(aaa, arg7), arg7) + 1; + return aaa; +} + +first_nonzero +{ + if (arg5) + { + return arg5; + } + else + { + } + return arg6; +} +

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.