This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

treelang patch part 1 of 6


This is about to be applied to the default branch (gcc3.2 experimental).

Tim Josling

diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/testsuite/lib/treelang.exp
cvscopy/gcc/gcc/testsuite/lib/treelang.exp
*** cvs/gcc/gcc/testsuite/lib/treelang.exp      Thu Jan  1 10:00:00 1970

--- cvscopy/gcc/gcc/testsuite/lib/treelang.exp  Mon Apr 29 20:30:08 2002

***************
*** 0 ****
--- 1,20 ----
+ # Copyright (C) 1988, 90, 91, 92, 95, 96, 1997, 1999, 2000, 2001, 2002
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 2 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 this program; if not, write to the Free Software
+ # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

+
+ # Having this file here magically tells dejagnu that the treelang
+ # directory is worthy of testing
+
+
diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/testsuite/treelang/ChangeLog
cvscopy/gcc/gcc/testsuite/treelang/ChangeLog
*** cvs/gcc/gcc/testsuite/treelang/ChangeLog    Thu Jan  1 10:00:00 1970

--- cvscopy/gcc/gcc/testsuite/treelang/ChangeLog        Mon Apr 29
20:30:08 2002
***************
*** 0 ****
--- 1,40 ----
+ 2002-04-13  Tim Josling  <tej@melbpc.org.au>
+       * treetree.c (tree_code_create_function_initial)
+       Remove duplicate call to layout_decl
+
+ 2001-12-02  Tim Josling  <tej@melbpc.org.au>
+       * Make-lang.in
+       Ensure directory is built during install (installdirs
dependency)
+
+       * lex.l
+       Work around poisoned malloc (undef IN_GCC)
+       Remove fake definition of tree.
+
+       * parse.y
+       Work around poisoned malloc (undef IN_GCC)
+
+       * tree1.c
+       New front end interface.
+       (top level) New structure lang_hooks.
+       (tree_post_options) Remove.
+       errorcount now a macro so do not define it.
+       current_nesting_level => work_nesting_level due to clash.
+
+       * treelang.h
+       errorcount now a macro so do not reference it.
+
+       * treetree.c
+       Replace NULL_PTR by NULL.
+       (tree_code_get_expression) Mark op3 unused.
+       Do not init builtins.
+
+ 2001-06-11  Tim Josling  <tej@melbpc.org.au>
+
+       * treelang.exp (global) remove COBOL specific code.
+
+ 2001-05-24  Tim Josling  <tej@melbpc.org.au>
+
+         Created this directory and its tests. All derived from the
cobol
+       test swamp which was also all written by me.
+
+
diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/testsuite/treelang/Makefile.in
cvscopy/gcc/gcc/testsuite/treelang/Makefile.in
*** cvs/gcc/gcc/testsuite/treelang/Makefile.in  Thu Jan  1 10:00:00 1970

--- cvscopy/gcc/gcc/testsuite/treelang/Makefile.in      Mon Apr 29
20:30:08 2002
***************
*** 0 ****
--- 1,9 ----
+ # Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+
+ all:
+
+ clean:
+       -rm -f *.o *.diff *~ *.bad core *.x
+
+ distclean:    clean
+       -rm -f Makefile config.status
diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/testsuite/treelang/a01gcci01.c
cvscopy/gcc/gcc/testsuite/treelang/a01gcci01.c
*** cvs/gcc/gcc/testsuite/treelang/a01gcci01.c  Thu Jan  1 10:00:00 1970

--- cvscopy/gcc/gcc/testsuite/treelang/a01gcci01.c      Mon Apr 29
20:30:08 2002
***************
*** 0 ****
--- 1,19 ----
+ /* Driver for treelang test pgm */
+
+ int add(int, int);
+ int subtract(int, int);
+ int first_nonzero(int, int);
+
+ 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;
+ }
diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/testsuite/treelang/a01gcci01.tree
cvscopy/gcc/gcc/testsuite/treelang/a01gcci01.tree
*** cvs/gcc/gcc/testsuite/treelang/a01gcci01.tree       Thu Jan  1
10:00:00 1970
--- cvscopy/gcc/gcc/testsuite/treelang/a01gcci01.tree   Mon Apr 29
20:30:08 2002
***************
*** 0 ****
--- 1,39 ----
+ // -*- c -*- c mode in emacs
+
+ 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;
+ }
+
diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/testsuite/treelang/a01gcco01runpgm
cvscopy/gcc/gcc/testsuite/treelang/a01gcco01runpgm
*** cvs/gcc/gcc/testsuite/treelang/a01gcco01runpgm      Thu Jan  1
10:00:00 1970
--- cvscopy/gcc/gcc/testsuite/treelang/a01gcco01runpgm  Mon Apr 29
20:30:08 2002
***************
*** 0 ****
--- 1,8 ----
+ 2:2
+ 7:7
+ -1:-1
+ 1:1
+ 3:3
+ 0:0
+ 1:1
+ 15:15
diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/testsuite/treelang/treetests.exp
cvscopy/gcc/gcc/testsuite/treelang/treetests.exp
*** cvs/gcc/gcc/testsuite/treelang/treetests.exp        Thu Jan  1
10:00:00 1970
--- cvscopy/gcc/gcc/testsuite/treelang/treetests.exp    Mon Apr 29
20:30:08 2002
***************
*** 0 ****
--- 1,289 ----
+
+ # Tests for treelang; run from gcc/treelang/Make-lang.in =>
gcc/Makefile
+
+ # Copyright (C) 1999, 2000, 2001, 2002 by The Free Software Foundation

+
+ # find ttt for the actual tests
+
+ # Check the pgm is even there and set up the basics
+ proc init_utility {pgm} {
+     global transform
+     global pgm_actual
+     global pgm_base
+     global fix_progname
+     global path
+ # maybe add "X" to front of fail to say it is an expected failure
+     global X
+
+     set pgm_base ${pgm}
+     set pgm_actual ${pgm}
+
+     if { ${transform} != "s,x,x,"} {
+         verbose "1. program name was ${pgm}" 2
+         set sed_rc [catch {eval exec sed -e "${transform}" <<${pgm} }
catch_res]
+         if { ${sed_rc} != "0" } {
+             verbose "2. Program name transform failed rc=${sed_rc}
stat=${catch_res}" 1
+             ${X}fail "${pgm} sed"
+             return 0
+         }
+         set pgm_actual ${catch_res}
+         verbose "3. program name after transformation is
${pgm_actual}" 2
+     }
+
+     set which_rc [catch {exec which ${pgm_actual}} stat]
+     if { ${which_rc} != "0" } {
+         verbose "4. ${pgm_base} cannot be found rc=${which_rc}
stat=${stat}" 1
+         ${X}fail "${pgm} = ${pgm_actual} not found in path (${path})"
+         return 0
+     }
+     set fix_progname "s,${pgm_actual},${pgm_base},"
+     verbose "5. fix program name value = ${fix_progname}" 4
+     return 1
+ }
+
+ #run pgm, option to remove file names from outputs
+ proc run3 {srcdd testdd parms group_nbr item_nbr nonzero_RC_expected
check_file sanitize_output tree1 pipe} {
+
+     global transform
+     global pgm_actual
+     global pgm_base
+     global fix_progname
+     global X
+     global extras
+
+     set error_msg 0
+     set basefile "a${group_nbr}${pgm_base}.out${item_nbr}"
+     set infile  ""
+     set outfile  ""
+     set suffix ""
+     set temp_extras "-O3 "
+     set real_pgm_actual ${pgm_actual}
+
+     if  {${tree1} > 0} {
+         if {"${pgm_actual}" == "gcc"} {
+             set real_pgm_actual "xgcc"
+             set temp_extras "${extras}"
+         }
+         set infile
"${srcdd}/a${group_nbr}${pgm_base}i${item_nbr}.tree"
+         set mainfile "${srcdd}/a${group_nbr}${pgm_base}i${item_nbr}.c"

+         set outfile "-o
${testdd}/a${group_nbr}${pgm_base}o${item_nbr}${suffix}"
+     }
+
+     verbose "6. exec ${real_pgm_actual} ${temp_extras} ${parms}
${mainfile} ${infile} ${outfile} >${testdd}/${basefile}
2>${testdd}/${basefile}err" 2
+     set run_rc [catch {eval exec ${real_pgm_actual} ${temp_extras}
${parms} ${mainfile} ${infile} ${outfile} >${testdd}/${basefile}
2>${testdd}/${basefile}err} catch_res]
+     if {${run_rc} == 1} {
+         if {${nonzero_RC_expected} == 0} {
+             verbose "7. ${real_pgm_actual} ${group_nbr} ${item_nbr}
failed due to rc=${run_rc} status=${catch_res}" 1
+             ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} rc!=0"
+             return
+         }
+     } else {
+         if {${nonzero_RC_expected} == 1} {
+             verbose "8. ${pgm_actual} ${group_nbr} ${item_nbr} failed
- did not produce nonzero return code as expected rc=${run_rc}
status=${catch_res}" 1
+             ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} rc=0"
+             return
+         }
+     }
+
+ # change the filenames to (file) in output if needed to allow testing
+     set checkfile1 "${srcdd}/${basefile}"
+     set checkfile2 "${testdd}/${basefile}"
+     if {${sanitize_output} != 0} {
+         set oldcheckfile1 "${checkfile1}"
+         set oldcheckfile2 "${checkfile2}"
+         set checkfile1 "${testdd}/${basefile}.test.nofilename"
+         set checkfile2 "${testdd}/${basefile}.run.nofilename"
+         set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed
<${oldcheckfile1} >${checkfile1}} catch_res]
+         if {${run_rc} == 1} {
+             verbose "9. sed to cleanup filenames (std 1) in pgm output
failed due to rc=${run_rc} status=${catch_res}" 1
+             if  {${error_msg} == 0} {
+                 set error_msg "9. sed to cleanup filenames (std 1) in
pgm output failed due to rc=${run_rc} status=${catch_res}"
+             }
+         }
+         set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed
<${oldcheckfile2} | sed -e  "${fix_progname}"  >${checkfile2}}
catch_res]
+         if {${run_rc} == 1} {
+             verbose "10. sed to cleanup filenames (std 2) in pgm
output failed due to rc=${run_rc} status=${catch_res}" 1
+             if  {${error_msg} == 0} {
+                 set error_msg "10. sed to cleanup filenames (std 2) in
pgm output failed due to rc=${run_rc} status=${catch_res}"
+             }
+         }
+     }
+     set diff [diff ${checkfile1} ${checkfile2}]
+     if {${diff} != 1} {
+         verbose "11. ${pgm_actual} ${group_nbr} ${item_nbr} diff
stdout failed rc=${diff}" 1
+         if  {${error_msg} == 0} {
+             set error_msg "11. ${pgm_actual} ${group_nbr} ${item_nbr}
diff stdout failed rc=${diff}"
+         }
+     }
+
+     set checkfile1 "${srcdd}/${basefile}err"
+     set checkfile2 "${testdd}/${basefile}err"
+     if {${sanitize_output} != 0} {
+         set oldcheckfile1 "${checkfile1}"
+         set oldcheckfile2 "${checkfile2}"
+         set checkfile1 "${testdd}/${basefile}err.test.nofilename"
+         set checkfile2 "${testdd}/${basefile}err.run.nofilename"
+         set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed
<${oldcheckfile1} >${checkfile1}} catch_res]
+         if {${run_rc} == 1} {
+             verbose "12. sed to cleanup filenames (err 1) in pgm
output failed due to rc=${run_rc} status=${catch_res}" 1
+             if  {${error_msg} == 0} {
+                 set error_msg "12. sed to cleanup filenames (err 1) in
pgm output failed due to rc=${run_rc} status=${catch_res}"
+             }
+         }
+         set run_rc [catch {eval exec sed -f ${srcdd}/filefix.sed
<${oldcheckfile2} | sed -e  "${fix_progname}"  >${checkfile2}}
catch_res]
+         if {${run_rc} == 1} {
+             verbose "13. sed to cleanup filenames (err 2) in pgm
output failed due to rc=${run_rc} status=${catch_res}" 1
+             if  {${error_msg} == 0} {
+                 set error_msg "13. sed to cleanup filenames (err 2) in
pgm output failed due to rc=${run_rc} status=${catch_res}"
+             }
+         }
+     }
+     set diff [diff ${checkfile1} ${checkfile2}]
+     if {${diff} != 1} {
+         verbose "14. ${pgm_actual} ${group_nbr} ${item_nbr} diff
stderr failed rc=${diff}" 1
+         if  {${error_msg} == 0} {
+             set error_msg "14. ${pgm_actual} ${group_nbr} ${item_nbr}
diff stderr failed rc=${diff}"
+         }
+     }
+
+     if {${check_file} >0} {
+         if  {${tree1} == 0} {
+             set checkfile1 "${srcdd}/${basefile}file"
+             set checkfile2 "${testdd}/${basefile}file"
+             if {${sanitize_output} != 0} {
+                 set oldcheckfile1 "${checkfile1}"
+                 set oldcheckfile2 "${checkfile2}"
+                 set checkfile1
"${testdd}/${basefile}file.test.nofilename"
+                 set checkfile2
"${testdd}/${basefile}file.run.nofilename"
+                 set run_rc [catch {eval exec sed -f
${srcdd}/filefix.sed <${oldcheckfile1} >${checkfile1}} catch_res]
+                 if {${run_rc} == 1} {
+                     verbose "15. sed to cleanup filenames (err 1) in
pgm stdout failed due to rc=${run_rc} status=${catch_res}" 1
+                     if  {${error_msg} == 0} {
+                         set error_msg "15. sed to cleanup filenames
(err 1) in pgm stdout failed due to rc=${run_rc} status=${catch_res}"
+                     }
+                 }
+                 set run_rc [catch {eval exec sed -f
${srcdd}/filefix.sed <${oldcheckfile2} | sed -e  "${fix_progname}"
>${checkfile2}} catch_res]
+                 if {${run_rc} == 1} {
+                     verbose "16. sed to cleanup filenames (err 2) in
pgm stdout failed due to rc=${run_rc} status=${catch_res}" 1
+                     if  {${error_msg} == 0} {
+                         set error_msg "16. sed to cleanup filenames
(err 2) in pgm stdout failed due to rc=${run_rc} status=${catch_res}"
+                     }
+                 }
+             }
+             set diff [diff ${checkfile1} ${checkfile2}]
+             if {${diff} != 1} {
+                 verbose "17. ${pgm_actual} ${group_nbr} ${item_nbr}
diff stdout file failed rc=${diff}" 1
+                 if  {${error_msg} == 0} {
+                     set error_msg "17. ${pgm_actual} ${group_nbr}
${item_nbr} diff stdout file failed rc=${diff}"
+                 }
+             }
+         }
+     }
+
+     if {${check_file} >1} {
+         if  {${tree1} == 0} {
+             set checkfile1 "${srcdd}/${outfile}"
+             set checkfile2 "${testdd}/${outfile}"
+             if {${sanitize_output} != 0} {
+                 set oldcheckfile1 "${checkfile1}"
+                 set oldcheckfile2 "${checkfile2}"
+                 set checkfile1
"${testdd}/${basefile}out.test.nofilename"
+                 set checkfile2
"${testdd}/${basefile}out.run.nofilename"
+                 set run_rc [catch {eval exec sed -f
${srcdd}/filefix.sed <${oldcheckfile1} >${checkfile1}} catch_res]
+                 if {${run_rc} == 1} {
+                     verbose "18. sed to cleanup filenames (err 1) in
pgm output failed due to rc=${run_rc} status=${catch_res}" 1
+                     if  {${error_msg} == 0} {
+                         set error_msg "18. sed to cleanup filenames
(err 1) in pgm output failed due to rc=${run_rc} status=${catch_res}"
+                     }
+                 }
+                 set run_rc [catch {eval exec sed -f
${srcdd}/filefix.sed <${oldcheckfile2} | sed -e  "${fix_progname}"
>${checkfile2}} catch_res]
+                 if {${run_rc} == 1} {
+                     verbose "19. sed to cleanup filenames (err 2) in
pgm output failed due to rc=${run_rc} status=${catch_res}" 1
+                     if  {${error_msg} == 0} {
+                         set error_msg "19. sed to cleanup filenames
(err 2) in pgm output failed due to rc=${run_rc} status=${catch_res}"
+                     }
+                 }
+             }
+             set diff [diff ${checkfile1} ${checkfile2}]
+             if {${diff} != 1} {
+                 verbose "20. ${pgm_actual} ${group_nbr} ${item_nbr}
diff output file failed rc=${diff}" 1
+                 if  {${error_msg} == 0} {
+                     set error_msg "20. ${pgm_actual} ${group_nbr}
${item_nbr} diff output file failed rc=${diff}"
+                 }
+             }
+         }
+     }
+
+     if {${check_file} >2} {
+         set outfile "a${group_nbr}${pgm_base}o${item_nbr}${suffix}"
+         set pgmrun
"${testdd}/a${group_nbr}${pgm_base}o${item_nbr}${suffix}"
+         set checkfile1 "${srcdd}/${outfile}runpgm"
+         set checkfile2 "${testdd}/${outfile}runpgm"
+         verbose "21. exec ${pgmrun} >${checkfile2} 2>${checkfile2}err"
2
+         set run_rc [catch {eval exec ${pgmrun} >${checkfile2}
2>${checkfile2}err} catch_res]
+         if {${run_rc} == 1} {
+             if {${nonzero_RC_expected} == 0} {
+                 verbose "22. ${pgm_actual} ${group_nbr} ${item_nbr}
failed due to rc=${run_rc} status=${catch_res}" 1
+                 ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} run"
+                 return
+             }
+         } else {
+             if {${nonzero_RC_expected} == 1} {
+                 verbose "23. ${pgm_actual} ${group_nbr} ${item_nbr}
failed - did not produce nonzero return code as expected rc=${run_rc}
status=${catch_res}" 1
+                 ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} run"
+                 return
+             }
+         }
+         set diff [diff ${checkfile1} ${checkfile2}]
+         if {${diff} != 1} {
+             verbose "24. ${pgm_actual} ${group_nbr} ${item_nbr} diff
run output file failed rc=${diff}" 1
+             if  {${error_msg} == 0} {
+                 set error_msg "24. ${pgm_actual} ${group_nbr}
${item_nbr} diff run output file failed rc=${diff}"
+             }
+         }
+         set diff [diff ${checkfile1}err ${checkfile2}err]
+         if {${diff} != 1} {
+             verbose "25. ${pgm_actual} ${group_nbr} ${item_nbr} diff
run stderr file failed rc=${diff}" 1
+             if  {${error_msg} == 0} {
+                 set error_msg "25. ${pgm_actual} ${group_nbr}
${item_nbr} diff run stderr file failed rc=${diff}"
+             }
+         }
+     }
+
+     if {${error_msg}>0} {
+         ${X}fail "${pgm_base} ${group_nbr} ${item_nbr} fail
code=${error_msg}"
+     } else {
+         pass "${pgm_base} ${group_nbr} ${item_nbr}"
+     }
+     return
+ }
+
+ set extras "$env(gcc_extras)"
+ set path $env(PATH)
+ set transform $env(TRANSFORM)
+ set srcdir $env(srcdir)
+ verbose "source directory ${srcdir}\n" 2
+ verbose "transform ${transform}\n" 2
+ set sourcedir "${srcdir}/testsuite/treelang"
+ set testdir "treelang"
+
+ set pgm_actual ""
+
+ # srcdd testdd parms group_nbr item_nbr nonzero_RC_expected check_file
sanitize_output tree1
+
+ # ttt
+
+ #GCC - main C compiler tests via GCC
+
+ set X ""
+
+ set check_rc [init_utility "gcc"]
+
+ if {${check_rc} == 1} {
+ #
+ #set X "x"
+ set X ""
+     run3 "${sourcedir}" "${testdir}" " -g -O3 " 01 01 0 3 0 1 0
+ set X ""
+ }
+
diff -c -r -p -N -X treelang.diff.excl cvs/gcc/gcc/treelang/ChangeLog
cvscopy/gcc/gcc/treelang/ChangeLog
*** cvs/gcc/gcc/treelang/ChangeLog      Thu Jan  1 10:00:00 1970
--- cvscopy/gcc/gcc/treelang/ChangeLog  Sun May  5 10:20:20 2002
***************
*** 0 ****
--- 1,24 ----
+ 2002-05-05  Tim Josling  <tej@melbpc.org.au>
+
+       * Updated for gcc3.2 experimental. Major changes throughout.
+
+ 2002-03-31  Tim Josling  <tej@melbpc.org.au>
+
+       * Make-lang.in: Changes so build and check work more reliably
+
+ 2001-07-30  Tim Josling  <tej@melbpc.org.au>
+
+       * root.texi: remove
+       * treelang.texi: updates based on feedback
+
+ 2001-06-11  Tim Josling  <tej@melbpc.org.au>
+
+       * all (all) Revamp code to conform to GCC coding standards, fix
+       typos in texi files.
+
+ 2001-05-11  Tim Josling  <tej@melbpc.org.au>
+
+         Create the new language.
+
+
+
diff -c -r -p -N -X treelang.diff.excl cvs/gcc/gcc/treelang/Make-lang.in
cvscopy/gcc/gcc/treelang/Make-lang.in
*** cvs/gcc/gcc/treelang/Make-lang.in   Thu Jan  1 10:00:00 1970
--- cvscopy/gcc/gcc/treelang/Make-lang.in       Sat May  4 16:26:39 2002

***************
*** 0 ****
--- 1,297 ----
+ # Top level makefile fragment for TREELANG For GCC. -*- makefile -*-
+
+ #   Copyright (C) 1994, 1995, 1997, 1998, 1999 2000, 2001, 2002 Free
+ #   Software Foundation, Inc.
+
+ #This file is part of GCC.
+
+ #GCC 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 2, or (at your option)
+ #any later version.
+
+ #GCC 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 COPYING.  If not, write to
+ #the Free Software Foundation, 59 Temple Place - Suite 330,
+ #Boston, MA 02111-1307, USA.
+
+ # This file provides the language dependent support in the main
Makefile.
+ # Each language makefile fragment must provide the following targets:
+ #
+ # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
+ # foo.info, foo.dvi,
+ # foo.install-normal, foo.install-common, foo.install-info,
foo.install-man,
+ # foo.uninstall, foo.distdir,
+ # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
+ # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4

+ #
+ # where `foo' is the name of the language.
+ #
+ # It should also provide rules for:
+ #
+ # - making any compiler driver (eg: GCC)
+ # - the compiler proper (eg: treelang)
+ # - define the names for selecting the language in LANGUAGES.
+ #
+
+ ## note program-prefix and program-suffix options are not supported
+ ## just program_transform_name which is a sed script to transform the
+ ## names
+
+ TREELANGSED = sed
+ TREELANGSEDFLAGS = -n
+
+ # back end compiler libraries etc
+ TREE_BE_LIBS = $(BACKEND) $(LIBIBERTY) $(INTLLIBS) $(LIBS) $(LIBDEPS)
+ GCC_EXTRAS = -B./ -B$(build_tooldir)/bin/ -isystem
$(build_tooldir)/include
+
+ # ./xgcc is the just built compiler. See GCC_FOR_TARGET in the GCC
Makefile.in.
+ # If this can't be found, you probably have not done a bootstrap of
GCC,
+ # which you need to do.
+
+ # GCC_FOR_TREELANG = ./xgcc $(GCC_EXTRAS)
+
+ TREE_GENERATED = $(srcdir)/treelang/lex.c $(srcdir)/treelang/parse.c\
+       $(srcdir)/treelang/parse.h $(srcdir)/treelang/parse.output
$(srcdir)/treelang/TAGS
+
+ TREE_SOURCE = ${srcdir}/treelang/parse.y ${srcdir}/treelang/lex.l
${srcdir}/treelang/tree1.c ${srcdir}/treelang/treelang.h
${srcdir}/treelang/treetree.c $(srcdir)/treelang/treetree.h
+
+ TREE_EXES = tree1$(exeext)
+
+ #no -Wtraditional warnings, allow long long
+ treelang-warn = $(LOOSE_WARN) -pedantic -Wno-long-long
-Wmissing-prototypes -Wmissing-declarations
+
+ #
+ # Define the names for selecting treelang in LANGUAGES.
+
+ .phony: treelang TREELANG
+
+ treelang TREELANG:treelang.done
+
+ treelang.done: tree1$(exeext)
+       $(STAMP) treelang.done
+
+ # no preprocessor
+
+ # core compiler
+ tree1$(exeext): treelang/tree1.o treelang/treetree.o treelang/lex.o
treelang/parse.o\
+       $(TREE_BE_LIBS) c-convert.o c-typeck.o c-common.o c-decl.o
attribs.o
+       $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
+       treelang/tree1.o treelang/treetree.o treelang/lex.o
treelang/parse.o c-convert.o\
+       c-typeck.o c-common.o c-decl.o attribs.o $(TREE_BE_LIBS)
+
+ #
+ # Compiling object files from source files.
+
+ # object file makes
+
+ treelang/tree1.o: $(srcdir)/treelang/tree1.c
$(srcdir)/treelang/treelang.h $(srcdir)/treelang/parse.h
+       $(CC) -o $@ -c $(ALL_CFLAGS) $(INCLUDES) $<
+
+ treelang/treetree.o: $(srcdir)/treelang/treetree.c
$(srcdir)/treelang/treetree.h
+       $(CC) -o $@ -c $(ALL_CFLAGS) $(INCLUDES) $<
+
+ treelang/parse.o: $(srcdir)/treelang/parse.c
$(srcdir)/treelang/treelang.h $(srcdir)/treelang/treetree.h
+       $(CC) -o $@ -c $(ALL_CFLAGS) $(INCLUDES) $<
+
+ treelang/lex.o: $(srcdir)/treelang/lex.c $(srcdir)/treelang/parse.h
$(srcdir)/treelang/treelang.h
+       $(CC) -o $@ -c $(ALL_CFLAGS) $(INCLUDES) $<
+
+ # generated files the files from lex and yacc are put into the source
+ # directory in case someone wants to build but does not have
+ # lex/yacc
+
+ $(srcdir)/treelang/lex.c: $(srcdir)/treelang/lex.l
+       $(LEX) $(LEXFLAGS) -o$(srcdir)/treelang/lex.c
$(srcdir)/treelang/lex.l
+
+ $(srcdir)/treelang/parse.c $(srcdir)/treelang/parse.h:
$(srcdir)/treelang/parse.y
+       $(BISON) $(BISONFLAGS) -v $(srcdir)/treelang/parse.y\
+       --output=$(srcdir)/treelang/parse.c --defines
+ # -v
+
+ #
+ # Build hooks:
+
+ treelang.all.build: treelang
+ treelang.all.cross:
+       _error_not_here_yet - havent even thought about it - it may even
work
+
+ treelang.start.encap:
+ treelang.rest.encap:
+
+ .phony:treelang.info
+ treelang.info: $(srcdir)/treelang/treelang.info
+
+ $(srcdir)/treelang/treelang.info: $(srcdir)/treelang/treelang.texi
+       cd $(srcdir)/treelang && $(MAKEINFO) $(MAKEINFOFLAGS)
-I../doc/include \
+       -o $(srcdir)/treelang/treelang.info
$(srcdir)/treelang/treelang.texi
+
+ treelang.dvi: $(srcdir)/treelang/treelang.texi
+       TEXINPUTS=$(srcdir)/treelang:$(srcdir):$$TEXINPUTS $(TEXI2DVI)
$(srcdir)/treelang/treelang.texi; \
+         texindex treelang.??; \
+         TEXINPUTS=$(srcdir)/treelang:$(srcdir):$$TEXINPUTS $(TEXI2DVI)
$(srcdir)/treelang/treelang.texi; \
+         mv treelang.dvi treelang;
+
+ #
+ # Install hooks:
+
+ # Nothing to do here.
+ treelang.install-normal: treelang.install.common
+
+ # Install
+ .phony:treelang.install.common
+ .phony:treelang.install
+
+ treelang.install treelang.install.common treelang.install-common:
treelang.install.common.done
+
+ treelang.install.common.done:  installdirs treelang.done
+       for name in $(TREE_EXES); \
+       do \
+          if [ -f $$name ] ; then \
+           name2="`echo \`basename $$name\` | sed -e
'$(program_transform_name)' `"; \
+           rm -f $(bindir)/$$name2$(exeext); \
+           $(INSTALL_PROGRAM) $$name$(exeext)
$(bindir)/$$name2$(exeext); \
+           chmod a+x $(bindir)/$$name2$(exeext); \
+         fi ; \
+       done
+       $(STAMP) treelang.install.common.done
+
+ treelang.install-info: $(srcdir)/treelang/treelang.info
+       for name in $(srcdir)/treelang/treelang.info; \
+       do \
+          if [ -f $$name ] ; then \
+           name2="`echo \`basename $$name\` | sed -e
'$(program_transform_name)' `"; \
+           rm -f $(libsubdir)/$$name2$(exeext); \
+           $(INSTALL_PROGRAM) $$name$(exeext)
$(libsubdir)/$$name2$(exeext); \
+           chmod a+x $(libsubdir)/$$name2$(exeext); \
+         fi ; \
+       done
+
+ treelang.install-man:
+
+ treelang.uninstall:
+       for name in $(TREE_EXES); \
+       do \
+         echo $$name; \
+         name2="`echo $$name | sed -e '$(program_transform_name)' `"; \

+         echo becomes $$name2; \
+         echo -rm -rf $(bindir)/$$name2$(exeext); \
+         rm -rf $(bindir)/$$name2$(exeext); \
+       done
+       -rm treelang.install.common.done
+
+ #
+ # Clean hooks:
+ # A lot of the ancillary files are deleted by the main makefile.
+ # We just have to delete files specific to us.
+
+ treelang.mostlyclean:
+       for name in $(TREE_EXES); \
+       do \
+         echo deleting $$name; \
+         if [ -f treelang/$$name$(exeext) ] ; then \
+           rm -f treelang/$$name$(exeext); \
+         fi ; \
+       done
+       -rm -f treelang/*.o
+       -rm treelang.done
+
+
+ treelang.clean: treelang.mostlyclean
+
+ treelang.distclean: treelang.clean
+       -rm -f treelang/config.status
+       -rm -f treelang/*.output
+
+ treelang.extraclean: treelang.distclean
+
+ treelang.maintainer-clean: treelang.extraclean
+       for name in $(TREE_GENERATED); \
+       do \
+         if [ -f $(srcdir)/treelang/$$name ] ; then \
+              echo deleting $(srcdir)/treelang/$$name; \
+            rm -f $(srcdir)/treelang/$$name; \
+         fi ; \
+       done
+       -rm -R $(srcdir)/treelang/*~
+
+
+ #
+ # Stage hooks:
+ # The main makefile has already created stage?/treelang.
+
+ treelang.stage1: stage1-start
+       -mv treelang/*$(objext) stage1/treelang
+ treelang.stage2: stage2-start
+       -mv treelang/*$(objext) stage2/treelang
+ treelang.stage3: stage3-start
+       -mv treelang/*$(objext) stage3/treelang
+ treelang.stage4: stage4-start
+       -mv treelang/*$(objext) stage4/treelang
+ #
+ # Maintenance hooks:
+
+ # This target creates the files that can be rebuilt, but go in the
+ # distribution anyway.  It then copies the files to the distdir
directory.
+ treelang.distdir:
+ #     not here yet sorry not sure if this is needed or not???
+
+ # test hook
+ # the other languages are hard coded in the main makefile.in - that
seems to be wrong
+
+ check: treelang.check
+
+ TESTSUITEDIR = testsuite
+
+ treelang.check: $(TESTSUITEDIR)/site.exp
+       -mkdir testsuite/treelang
+
+ # these three files are empty and it seems diff has trouble generating

+ # patch files for new empty files as required for cvs.
+ # STAMP does not cut it here as I need an empty file.
+       touch
$(srcdir)/testsuite/treelang/{a01gcco01runpgmerr,a01gcc.out01,a01gcc.out01err}

+       -rootme=`pwd`; export rootme; \
+       srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
+       cd testsuite; \
+       EXPECT=${EXPECT} ; export EXPECT ; \
+       TRANSFORM=$(program_transform_name); export TRANSFORM; \
+       if [ -f $${rootme}/../expect/expect ] ; then  \
+          TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \
+          export TCL_LIBRARY ; fi ; \
+       PATH=`cd ..;pwd`:$$PATH; export PATH; \
+       gcc_extras="-B`cd ..;pwd` -B`cd ..;pwd`/treelang"; export
gcc_extras; \
+       $(RUNTEST) --tool treelang $(RUNTESTFLAGS)
+       rm
$(srcdir)/testsuite/treelang/{a01gcco01runpgmerr,a01gcc.out01,a01gcc.out01err}

+ #     GCC_EXTRAS="$(GCC_EXTRAS)"; export GCC_EXTRAS; \
+
+ # copy the output files from the current test to source ie say the new
results are OK
+ treelang.check.fix: force
+       srcdir=`cd ${srcdir}; pwd` ; export srcdir ;
+       -cp testsuite/treelang/*.out* t
+       -cp testsuite/treelang/*runpgm* t
+       -rm -f t/*nofilename
+
+ treelang.wc: force
+       wc  ${TREE_SOURCE}
+
+ #
+
+ # Update the tags table for emacs find label (alt-.) function
+ TAGS: treelang.tags
+
+ .PHONY: treelang.tags
+
+ treelang.tags:
+       cd $(srcdir)/treelang;
\
+       etags -l c ${TREE_SOURCE}
+
+ .PHONY: treelang.html
+
+ treelang.html:
+       cd $(srcdir)/treelang && texi2html -I ../doc/include -verbose
-menu -split_chapter -number treelang.texi
+ #     mv treelang*.html $(srcdir)/treelang
diff -c -r -p -N -X treelang.diff.excl cvs/gcc/gcc/treelang/README
cvscopy/gcc/gcc/treelang/README
*** cvs/gcc/gcc/treelang/README Thu Jan  1 10:00:00 1970
--- cvscopy/gcc/gcc/treelang/README     Sun May  5 10:27:31 2002
***************
*** 0 ****
--- 1,16 ----
+ This is a sample language front end for GCC.
+
+ This is a replacement for 'toy' which had potential copyright issues,
+ but more importantly it did not exercise very much of GCC. The intent
+ of this language is that it should provide a cookbook of language
+ elements that you can use in any language front end.
+
+ To this end, treelang is essentially an implementation of a subset of
+ the GCC back end 'tree' interface in syntax.
+
+ Thanks to Richard Kenner, Joachim Nadler and many others for helping
+ me to understand enough of GCC to do this.
+
+ Tim Josling
+ May 2001
+
diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/treelang/config-lang.in
cvscopy/gcc/gcc/treelang/config-lang.in
*** cvs/gcc/gcc/treelang/config-lang.in Thu Jan  1 10:00:00 1970
--- cvscopy/gcc/gcc/treelang/config-lang.in     Mon Apr 29 20:30:08 2002

***************
*** 0 ****
--- 1,37 ----
+ # Top level configure fragment for GNU C++.
+ # Copyright (C) 1994, 1995, 1997, 1998, 2000, 2001, 2002 Free Software
Foundation, Inc.
+
+ #This file is part of GCC.
+
+ #GCC 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 2, or (at your option)
+ #any later version.
+
+ #GCC 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 COPYING.  If not, write to
+ #the Free Software Foundation, 59 Temple Place - Suite 330,
+ #Boston, MA 02111-1307, USA.
+
+ # Configure looks for the existence of this file to auto-config each
language.
+ # We define several parameters used by configure:
+ #
+ # language    - name of language as it would appear in $(LANGUAGES)
+ # compilers   - value to add to $(COMPILERS)
+ # stagestuff  - files to add to $(STAGESTUFF)
+ # diff_excludes       - files to ignore when building diffs between
two versions.
+
+ language="treelang"
+
+ compilers="tree1\$(exeext)"
+
+ stagestuff=
+
+ diff_excludes="-x lex.c -x parse.c -x parse.h"
+ headers=
+ build_by_default="no"
diff -c -r -p -N -X treelang.diff.excl
cvs/gcc/gcc/treelang/lang-options.h
cvscopy/gcc/gcc/treelang/lang-options.h
*** cvs/gcc/gcc/treelang/lang-options.h Thu Jan  1 10:00:00 1970
--- cvscopy/gcc/gcc/treelang/lang-options.h     Mon Apr 29 20:30:08 2002

***************
*** 0 ****
--- 1,29 ----
+ /* Definitions for switches for TREELANG.
+
+    Copyright (C) 1995, 96-98, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC 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 2, or (at your option)
+ any later version.
+
+ GCC 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 this program; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+
+ DEFINE_LANG_NAME ("treelang")
+
+ /* This is the contribution to the `lang_options' array in gcc.c for
+    treelang.  */
+  {"-fparser-trace", N_("(debug) trace parsing process")},
+  {"-flexer-trace", N_("(debug) trace lexical analysis")},
+
+
diff -c -r -p -N -X treelang.diff.excl cvs/gcc/gcc/treelang/lang-specs.h
cvscopy/gcc/gcc/treelang/lang-specs.h
*** cvs/gcc/gcc/treelang/lang-specs.h   Thu Jan  1 10:00:00 1970
--- cvscopy/gcc/gcc/treelang/lang-specs.h       Mon Apr 29 20:30:08 2002

***************
*** 0 ****
--- 1,63 ----
+ /* Definitions for specs for TREELANG
+
+    The format of the specs file is documented in gcc.c
+
+    Copyright (C) 1995, 96-98, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC 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 2, or (at your option)
+ any later version.
+
+ GCC 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 this program; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+
+ /*
+    This is the contribution to the `default_compilers' array in GCC.c
for
+    treelang.
+
+    This file must compile with 'traditional', so no ANSI string
concatenations
+
+ */
+
+ {".tree", "@treelang", NULL},
+ {".TREE", "@treelang", NULL},
+ {".tre", "@treelang", NULL},
+ {".TRE", "@treelang", NULL},
+ {"@treelang",
+     "tree1\
+        %{!Q:-quiet}\
+        %{d*}\
+        %{m*}\
+        %{a}\
+        %{g*}\
+        %{O*}\
+        %{W*}\
+        %{w}\
+        %{ansi}\
+        %{v}\
+        %{--help:--help}\
+        %{pg:-p}\
+        %{p}\
+        %{f*}\
+        %{pg|p:%{fomit-frame-pointer:%e-pg or -p and
-fomit-frame-pointer are incompatible}}\
+        %{S:%W{o*}%{!o*:-o %b.s}}\
+        %{!S:-o %g.s}\
+        %i\n\
+        %{!S:as %a\
+        %Y\
+        %{c:%W{o*}%{!o*:-o %w%b%O}}\
+        %{!c:-o %d%w%u%O}\
+        %g.s\
+        %A\n}\
+        ", NULL
+ },
diff -c -r -p -N -X treelang.diff.excl cvs/gcc/gcc/treelang/lex.l
cvscopy/gcc/gcc/treelang/lex.l
*** cvs/gcc/gcc/treelang/lex.l  Thu Jan  1 10:00:00 1970
--- cvscopy/gcc/gcc/treelang/lex.l      Sat May  4 19:53:02 2002
***************
*** 0 ****
--- 1,294 ----
+ %{ /* -*- c -*- = mode for emacs editor
+ /*
+
+    TREELANG lexical analysis
+
+
---------------------------------------------------------------------
+
+    Copyright (C) 1986, 87, 89, 92-96, 1997, 1999, 2000, 2001, 2002
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 2, 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 this program; if not, write to the Free Software
+    Foundation, 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+
+    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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]