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