Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 1 | <!-- Contributing to the gccgo frontend --> |
| 2 | |
| 3 | <h2>Introduction</h2> |
| 4 | |
| 5 | <p> |
| 6 | These are some notes on contributing to the <code>gccgo</code> |
| 7 | frontend for GCC. For information on contributing to parts of Go other |
| 8 | than <code>gccgo</code>, see <a href="contribute.html">Contributing to |
| 9 | the Go project</a>. For information on building <code>gccgo</code> |
Ian Lance Taylor | 5b387fb | 2009-11-06 14:36:34 -0800 | [diff] [blame] | 10 | for yourself, see <a href="gccgo_install.html">Setting up and using |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 11 | gccgo</a>. |
| 12 | </p> |
| 13 | |
| 14 | <h2>Legal Prerequisites</h2> |
| 15 | |
| 16 | <p> |
Ian Lance Taylor | 9bebe74 | 2009-11-07 23:42:58 -0800 | [diff] [blame] | 17 | You must follow the <a href="contribute.html#copyright">Go copyright |
| 18 | rules.</a> |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 19 | </p> |
| 20 | |
| 21 | <h2>Code</h2> |
| 22 | |
| 23 | <p> |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame^] | 24 | The source code for the <code>gccgo</code> frontend may be found at |
| 25 | <a href="http://code.google.com/p/gofrontend">http://code.google.com/p/gofrontend</a>. |
| 26 | Changes made to that project are routinely merged into the source code |
| 27 | hosted at <code>gcc.gnu.org</code>. The <code>gofrontend</code> |
| 28 | project includes only the Go frontend proper. These are the files |
| 29 | which in the <code>gcc</code> sources may be found in the |
| 30 | directories <code>gcc/go</code> and <code>libgo</code>. |
| 31 | The <code>gcc</code> sources also include a copy of |
| 32 | the <code>test</code> directory |
| 33 | from <a href="http://code.google.com/p/go">the main Go repository</a>. |
| 34 | |
| 35 | <p> |
| 36 | The frontend is written in C++ and as such the GNU coding standards do |
| 37 | not entirely apply; in writing code for the frontend, follow the |
| 38 | formatting of the surrounding code. Although the frontend is |
| 39 | currently closely tied to the rest of the <code>gcc</code> codebase, |
| 40 | we plan to make it more independent. Any new code that uses other |
| 41 | parts of <code>gcc</code> should be placed in an appropriate file, |
| 42 | such as <code>gogo-tree.cc</code>. Eventually |
| 43 | all <code>gcc</code>-specific code should migrate to |
| 44 | a <code>gcc-interface</code> subdirectory. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 45 | </p> |
| 46 | |
| 47 | <p> |
| 48 | The runtime library for <code>gccgo</code> is mostly the same as the |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame^] | 49 | library in <a href="http://code.google.com/p/go">the main Go |
| 50 | repository</a>. The library code in the Go repository is periodically |
| 51 | copied into the <code>gofrontend</code> and the <code>gcc</code> |
| 52 | repositories. Accordingly, most library changes should be made in the |
| 53 | main Go repository. Changes to the few <code>gccgo</code>-specific |
| 54 | parts of the library should follow the process described here. |
| 55 | The <code>gccgo</code>-specific parts of the library are everything in |
| 56 | the <code>libgo</code> directory except for the <code>libgo/go</code> |
| 57 | subdirectory. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 58 | </p> |
| 59 | |
| 60 | <h2>Testing</h2> |
| 61 | |
| 62 | <p> |
| 63 | All patches must be tested. There are two test suites. A patch that |
| 64 | introduces new failures is not acceptable. |
| 65 | </p> |
| 66 | |
| 67 | <p> |
| 68 | To run the compiler test suite, run <code>make check-go</code> in the |
| 69 | <code>gcc</code> subdirectory of your build directory. This will run |
| 70 | various tests underneath <code>gcc/testsuite/go.*</code>. This |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame^] | 71 | includes a copy of the tests in the main Go repository, which are run |
| 72 | using the DejaGNU script found in |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 73 | in <code>gcc/testsuite/go.test/go-test.exp</code>. Many of the |
| 74 | compiler tests may be run without the Go library, but some do require |
| 75 | the library to built first. |
| 76 | </p> |
| 77 | |
| 78 | <p> |
| 79 | To run the library test suite, run <code>make |
| 80 | check-target-libgo</code> in the top level of your build directory. |
| 81 | </p> |
| 82 | |
| 83 | <p> |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame^] | 84 | Most new tests should be submitted to the main Go repository for |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 85 | copying into the <code>gccgo</code> repository. If there is a need |
| 86 | for specific tests for <code>gccgo</code>, they should go in |
| 87 | the <code>gcc/testsuite/go.go-torture</code> |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame^] | 88 | or <code>gcc/testsuite/go.dg</code> directories in |
| 89 | the <code>gcc.gnu.org</code> repository. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 90 | </p> |
| 91 | |
| 92 | <h2>Submitting Changes</h2> |
| 93 | |
| 94 | <p> |
Ian Lance Taylor | 8653acb | 2010-01-29 16:37:20 -0800 | [diff] [blame^] | 95 | Changes to the Go frontend should follow the same process as for the |
| 96 | main Go repository, only for the <code>gofrontend</code> project |
| 97 | rather than the <code>go</code> project. Those changes will then be |
| 98 | merged into the <code>gcc</code> sources. |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 99 | </p> |