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> |
| 24 | The source code for the <code>gccgo</code> frontend may be found in |
| 25 | the directory <code>gcc/go</code>. The frontend is written in C++ and |
| 26 | as such the GNU coding standards do not entirely apply; in writing |
| 27 | code for the frontend, follow the formatting of the surrounding code. |
| 28 | Although the frontend is currently closely tied to the rest of the gcc |
| 29 | codebase, we plan to make it more independent. Any new code which |
| 30 | uses other parts of gcc should be segregated in an appropriate file, |
| 31 | such as <code>gogo-tree.cc</code>. |
| 32 | </p> |
| 33 | |
| 34 | <p> |
| 35 | The runtime library for <code>gccgo</code> is mostly the same as the |
| 36 | library in the main Mercurial repository. The library code in the |
| 37 | Mercurial repository is periodically copied into |
| 38 | the <code>gccgo</code> repository. Accordingly, most library changes |
| 39 | should be made in Mercurial. Changes to the few <code>gccgo</code> |
| 40 | specific parts of the library should follow the process described |
| 41 | here. The <code>gccgo</code> specific parts of the library are |
| 42 | everything in the <code>libgo</code> directory except for |
| 43 | the <code>libgo/go</code> subdirectory. |
| 44 | </p> |
| 45 | |
| 46 | <h2>Testing</h2> |
| 47 | |
| 48 | <p> |
| 49 | All patches must be tested. There are two test suites. A patch that |
| 50 | introduces new failures is not acceptable. |
| 51 | </p> |
| 52 | |
| 53 | <p> |
| 54 | To run the compiler test suite, run <code>make check-go</code> in the |
| 55 | <code>gcc</code> subdirectory of your build directory. This will run |
| 56 | various tests underneath <code>gcc/testsuite/go.*</code>. This |
| 57 | includes a copy of the tests in the Mercurial repository, which are |
| 58 | run using the DejaGNU script found in |
| 59 | in <code>gcc/testsuite/go.test/go-test.exp</code>. Many of the |
| 60 | compiler tests may be run without the Go library, but some do require |
| 61 | the library to built first. |
| 62 | </p> |
| 63 | |
| 64 | <p> |
| 65 | To run the library test suite, run <code>make |
| 66 | check-target-libgo</code> in the top level of your build directory. |
| 67 | </p> |
| 68 | |
| 69 | <p> |
| 70 | Most new tests should be submitted to the Mercurial repository for |
| 71 | copying into the <code>gccgo</code> repository. If there is a need |
| 72 | for specific tests for <code>gccgo</code>, they should go in |
| 73 | the <code>gcc/testsuite/go.go-torture</code> |
| 74 | or <code>gcc/testsuite/go.dg</code> directories. |
| 75 | </p> |
| 76 | |
| 77 | <h2>Submitting Changes</h2> |
| 78 | |
| 79 | <p> |
| 80 | Proposing a patch should follow the standard GCC rules. That is, the |
| 81 | patch should be sent to the mailing |
| 82 | list <code>gcc-patches@gcc.gnu.org</code> as a diff—the output |
| 83 | of the <code>diff</code> program with the <code>-c</code> |
| 84 | or <code>-u</code> option. In the future we are likely to set up a |
| 85 | separate gccgo-specific mailing list, which should also be CC'ed; we |
| 86 | will update this document at that time. Patch emails should include a |
| 87 | ChangeLog entry, though the ChangeLog entry should not be in the diff |
| 88 | itself. ChangeLog files are a standard part of GNU programs; see |
| 89 | <a href="http://www.gnu.org/prep/standards/html_node/Change-Logs.html">the |
| 90 | GNU coding standards</a>. |
| 91 | </p> |