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