github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/doc/gccgo_contribute.html (about) 1 <!--{ 2 "Title": "Contributing to the gccgo frontend" 3 }--> 4 5 <h2>Introduction</h2> 6 7 <p> 8 These are some notes on contributing to the gccgo frontend for GCC. 9 For information on contributing to parts of Go other than gccgo, 10 see <a href="/doc/contribute.html">Contributing to the Go project</a>. For 11 information on building gccgo for yourself, 12 see <a href="/doc/gccgo_install.html">Setting up and using gccgo</a>. 13 </p> 14 15 <h2>Legal Prerequisites</h2> 16 17 <p> 18 You must follow the <a href="/doc/contribute.html#copyright">Go copyright 19 rules</a> for all changes to the gccgo frontend and the associated 20 libgo library. Code that is part of GCC rather than gccgo must follow 21 the general <a href="http://gcc.gnu.org/contribute.html">GCC 22 contribution rules</a>. 23 </p> 24 25 <h2>Code</h2> 26 27 <p> 28 The master sources for the gccgo frontend may be found at 29 <a href="http://code.google.com/p/gofrontend">http://code.google.com/p/gofrontend</a>. 30 The master sources are not buildable by themselves, but only in 31 conjunction with GCC (in the future, other compilers may be 32 supported). Changes made to the gccgo frontend are also applied to 33 the GCC source code repository hosted at <code>gcc.gnu.org</code>. In 34 the <code>gofrontend</code> repository, the <code>go</code> directory 35 is mirrored to the <code>gcc/go/gofrontend</code> directory in the GCC 36 repository, and the <code>gofrontend</code> <code>libgo</code> 37 directory is mirrored to the GCC <code>libgo</code> directory. In 38 addition, the <code>test</code> directory 39 from <a href="http://code.google.com/p/go">the main Go repository</a> 40 is mirrored to the <code>gcc/testsuite/go.test/test</code> directory 41 in the GCC repository. 42 </p> 43 44 <p> 45 Changes to these directories always flow from the master sources to 46 the GCC repository. The files should never be changed in the GCC 47 repository except by changing them in the master sources and mirroring 48 them. 49 </p> 50 51 <p> 52 The gccgo frontend is written in C++. It follows the GNU coding 53 standards to the extent that they apply to C++. In writing code for 54 the frontend, follow the formatting of the surrounding code. Although 55 the frontend is currently tied to the rest of the GCC codebase, we 56 plan to make it more independent. Eventually all GCC-specific code 57 will migrate out of the frontend proper and into GCC proper. In the 58 GCC sources this will generally mean moving code 59 from <code>gcc/go/gofrontend</code> to <code>gcc/go</code>. 60 </p> 61 62 <p> 63 The run-time library for gccgo is mostly the same as the library 64 in <a href="http://code.google.com/p/go">the main Go repository</a>. 65 The library code in the Go repository is periodically merged into 66 the <code>libgo/go</code> directory of the <code>gofrontend</code> and 67 then the GCC repositories, using the shell 68 script <code>libgo/merge.sh</code>. Accordingly, most library changes 69 should be made in the main Go repository. The files outside 70 of <code>libgo/go</code> are gccgo-specific; that said, some of the 71 files in <code>libgo/runtime</code> are based on files 72 in <code>src/pkg/runtime</code> in the main Go repository. 73 </p> 74 75 <h2>Testing</h2> 76 77 <p> 78 All patches must be tested. A patch that introduces new failures is 79 not acceptable. 80 </p> 81 82 <p> 83 To run the gccgo test suite, run <code>make check-go</code> in your 84 build directory. This will run various tests 85 under <code>gcc/testsuite/go.*</code> and will also run 86 the <code>libgo</code> testsuite. This copy of the tests from the 87 main Go repository is run using the DejaGNU script found 88 in <code>gcc/testsuite/go.test/go-test.exp</code>. 89 </p> 90 91 <p> 92 Most new tests should be submitted to the main Go repository for later 93 mirroring into the GCC repository. If there is a need for specific 94 tests for gccgo, they should go in 95 the <code>gcc/testsuite/go.go-torture</code> 96 or <code>gcc/testsuite/go.dg</code> directories in the GCC repository. 97 </p> 98 99 <h2>Submitting Changes</h2> 100 101 <p> 102 Changes to the Go frontend should follow the same process as for the 103 main Go repository, only for the <code>gofrontend</code> project and 104 the<code>gofrontend-dev@googlegroups.com</code> mailing list 105 rather than the <code>go</code> project and the 106 <code>golang-dev@googlegroups.com</code> mailing list. Those changes 107 will then be merged into the GCC sources. 108 </p>