| 
									
										
										
										
											2012-01-19 11:24:54 +11:00
										 |  |  | <!--{
 | 
					
						
							|  |  |  | 	"Title": "Contributing to the gccgo frontend" | 
					
						
							|  |  |  | }--> | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | <h2>Introduction</h2> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | These are some notes on contributing to the gccgo frontend for GCC. | 
					
						
							|  |  |  | For information on contributing to parts of Go other than gccgo, | 
					
						
							| 
									
										
										
										
											2012-03-05 14:31:27 +11:00
										 |  |  | see <a href="/doc/contribute.html">Contributing to the Go project</a>.  For | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | information on building gccgo for yourself, | 
					
						
							| 
									
										
										
										
											2012-03-05 14:31:27 +11:00
										 |  |  | see <a href="/doc/gccgo_install.html">Setting up and using gccgo</a>. | 
					
						
							| 
									
										
										
										
											2013-06-20 14:49:15 -07:00
										 |  |  | For more of the gritty details on the process of doing development | 
					
						
							|  |  |  | with the gccgo frontend, | 
					
						
							| 
									
										
										
										
											2016-09-01 02:49:27 -07:00
										 |  |  | see <a href="https://go.googlesource.com/gofrontend/+/master/HACKING">the | 
					
						
							| 
									
										
										
										
											2013-06-20 14:49:15 -07:00
										 |  |  | file HACKING</a> in the gofrontend repository. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <h2>Legal Prerequisites</h2> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-03-05 14:31:27 +11:00
										 |  |  | You must follow the <a href="/doc/contribute.html#copyright">Go copyright | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | rules</a> for all changes to the gccgo frontend and the associated | 
					
						
							|  |  |  | libgo library.  Code that is part of GCC rather than gccgo must follow | 
					
						
							|  |  |  | the general <a href="http://gcc.gnu.org/contribute.html">GCC | 
					
						
							|  |  |  | contribution rules</a>. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <h2>Code</h2> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | The master sources for the gccgo frontend may be found at | 
					
						
							| 
									
										
										
										
											2015-06-15 11:13:57 -07:00
										 |  |  | <a href="http://go.googlesource.com/gofrontend">http://go.googlesource.com/gofrontend</a>. | 
					
						
							|  |  |  | They are mirrored | 
					
						
							|  |  |  | at <a href="http://github.com/golang/gofrontend">http://github.com/golang/gofrontend</a>. | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | The master sources are not buildable by themselves, but only in | 
					
						
							|  |  |  | conjunction with GCC (in the future, other compilers may be | 
					
						
							|  |  |  | supported).  Changes made to the gccgo frontend are also applied to | 
					
						
							|  |  |  | the GCC source code repository hosted at <code>gcc.gnu.org</code>.  In | 
					
						
							|  |  |  | the <code>gofrontend</code> repository, the <code>go</code> directory | 
					
						
							|  |  |  | is mirrored to the <code>gcc/go/gofrontend</code> directory in the GCC | 
					
						
							|  |  |  | repository, and the <code>gofrontend</code> <code>libgo</code> | 
					
						
							|  |  |  | directory is mirrored to the GCC <code>libgo</code> directory.  In | 
					
						
							|  |  |  | addition, the <code>test</code> directory | 
					
						
							| 
									
										
										
										
											2015-02-06 21:44:39 +09:00
										 |  |  | from <a href="//go.googlesource.com/go">the main Go repository</a> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | is mirrored to the <code>gcc/testsuite/go.test/test</code> directory | 
					
						
							|  |  |  | in the GCC repository. | 
					
						
							|  |  |  | </p> | 
					
						
							| 
									
										
										
										
											2010-01-29 16:37:20 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | Changes to these directories always flow from the master sources to | 
					
						
							|  |  |  | the GCC repository.  The files should never be changed in the GCC | 
					
						
							|  |  |  | repository except by changing them in the master sources and mirroring | 
					
						
							|  |  |  | them. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2015-06-15 11:13:57 -07:00
										 |  |  | The gccgo frontend is written in C++. | 
					
						
							|  |  |  | It follows the GNU and GCC coding standards for C++. | 
					
						
							|  |  |  | In writing code for the frontend, follow the formatting of the | 
					
						
							|  |  |  | surrounding code. | 
					
						
							|  |  |  | Almost all GCC-specific code is not in the frontend proper and is | 
					
						
							|  |  |  | instead in the GCC sources in the <code>gcc/go</code> directory. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | The run-time library for gccgo is mostly the same as the library | 
					
						
							| 
									
										
										
										
											2015-02-06 21:44:39 +09:00
										 |  |  | in <a href="//go.googlesource.com/go">the main Go repository</a>. | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | The library code in the Go repository is periodically merged into | 
					
						
							|  |  |  | the <code>libgo/go</code> directory of the <code>gofrontend</code> and | 
					
						
							|  |  |  | then the GCC repositories, using the shell | 
					
						
							|  |  |  | script <code>libgo/merge.sh</code>.  Accordingly, most library changes | 
					
						
							|  |  |  | should be made in the main Go repository.  The files outside | 
					
						
							|  |  |  | of <code>libgo/go</code> are gccgo-specific; that said, some of the | 
					
						
							|  |  |  | files in <code>libgo/runtime</code> are based on files | 
					
						
							| 
									
										
										
										
											2014-09-08 00:06:45 -04:00
										 |  |  | in <code>src/runtime</code> in the main Go repository. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | <h2>Testing</h2> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | All patches must be tested.  A patch that introduces new failures is | 
					
						
							|  |  |  | not acceptable. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | To run the gccgo test suite, run <code>make check-go</code> in your | 
					
						
							|  |  |  | build directory.  This will run various tests | 
					
						
							|  |  |  | under <code>gcc/testsuite/go.*</code> and will also run | 
					
						
							|  |  |  | the <code>libgo</code> testsuite.  This copy of the tests from the | 
					
						
							| 
									
										
										
										
											2013-04-16 14:20:06 -07:00
										 |  |  | main Go repository is run using the DejaGNU script found | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | in <code>gcc/testsuite/go.test/go-test.exp</code>. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | Most new tests should be submitted to the main Go repository for later | 
					
						
							|  |  |  | mirroring into the GCC repository.  If there is a need for specific | 
					
						
							|  |  |  | tests for gccgo, they should go in | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | the <code>gcc/testsuite/go.go-torture</code> | 
					
						
							| 
									
										
										
										
											2012-02-18 11:15:52 -08:00
										 |  |  | or <code>gcc/testsuite/go.dg</code> directories in the GCC repository. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <h2>Submitting Changes</h2> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2010-01-29 16:37:20 -08:00
										 |  |  | Changes to the Go frontend should follow the same process as for the | 
					
						
							| 
									
										
										
										
											2013-02-19 19:20:44 +08:00
										 |  |  | main Go repository, only for the <code>gofrontend</code> project and | 
					
						
							| 
									
										
										
										
											2014-12-19 08:37:52 +01:00
										 |  |  | the <code>gofrontend-dev@googlegroups.com</code> mailing list  | 
					
						
							| 
									
										
										
										
											2013-02-19 19:20:44 +08:00
										 |  |  | rather than the <code>go</code> project and the | 
					
						
							|  |  |  | <code>golang-dev@googlegroups.com</code> mailing list.  Those changes | 
					
						
							|  |  |  | will then be merged into the GCC sources. | 
					
						
							| 
									
										
										
										
											2009-11-06 14:15:41 -08:00
										 |  |  | </p> |