mirror of
https://github.com/golang/go
synced 2024-11-13 18:20:32 -07:00
ffde4970d0
R=golang-dev, r CC=golang-dev https://golang.org/cl/10401046
113 lines
4.3 KiB
HTML
113 lines
4.3 KiB
HTML
<!--{
|
|
"Title": "Contributing to the gccgo frontend"
|
|
}-->
|
|
|
|
<h2>Introduction</h2>
|
|
|
|
<p>
|
|
These are some notes on contributing to the gccgo frontend for GCC.
|
|
For information on contributing to parts of Go other than gccgo,
|
|
see <a href="/doc/contribute.html">Contributing to the Go project</a>. For
|
|
information on building gccgo for yourself,
|
|
see <a href="/doc/gccgo_install.html">Setting up and using gccgo</a>.
|
|
For more of the gritty details on the process of doing development
|
|
with the gccgo frontend,
|
|
see <a href="https://code.google.com/p/gofrontend/source/browse/HACKING">the
|
|
file HACKING</a> in the gofrontend repository.
|
|
</p>
|
|
|
|
<h2>Legal Prerequisites</h2>
|
|
|
|
<p>
|
|
You must follow the <a href="/doc/contribute.html#copyright">Go copyright
|
|
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>.
|
|
</p>
|
|
|
|
<h2>Code</h2>
|
|
|
|
<p>
|
|
The master sources for the gccgo frontend may be found at
|
|
<a href="http://code.google.com/p/gofrontend">http://code.google.com/p/gofrontend</a>.
|
|
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
|
|
from <a href="http://code.google.com/p/go">the main Go repository</a>
|
|
is mirrored to the <code>gcc/testsuite/go.test/test</code> directory
|
|
in the GCC repository.
|
|
</p>
|
|
|
|
<p>
|
|
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.
|
|
</p>
|
|
|
|
<p>
|
|
The gccgo frontend is written in C++. It follows the GNU coding
|
|
standards to the extent that they apply to C++. In writing code for
|
|
the frontend, follow the formatting of the surrounding code. Although
|
|
the frontend is currently tied to the rest of the GCC codebase, we
|
|
plan to make it more independent. Eventually all GCC-specific code
|
|
will migrate out of the frontend proper and into GCC proper. In the
|
|
GCC sources this will generally mean moving code
|
|
from <code>gcc/go/gofrontend</code> to <code>gcc/go</code>.
|
|
</p>
|
|
|
|
<p>
|
|
The run-time library for gccgo is mostly the same as the library
|
|
in <a href="http://code.google.com/p/go">the main Go repository</a>.
|
|
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
|
|
in <code>src/pkg/runtime</code> in the main Go repository.
|
|
</p>
|
|
|
|
<h2>Testing</h2>
|
|
|
|
<p>
|
|
All patches must be tested. A patch that introduces new failures is
|
|
not acceptable.
|
|
</p>
|
|
|
|
<p>
|
|
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
|
|
main Go repository is run using the DejaGNU script found
|
|
in <code>gcc/testsuite/go.test/go-test.exp</code>.
|
|
</p>
|
|
|
|
<p>
|
|
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
|
|
the <code>gcc/testsuite/go.go-torture</code>
|
|
or <code>gcc/testsuite/go.dg</code> directories in the GCC repository.
|
|
</p>
|
|
|
|
<h2>Submitting Changes</h2>
|
|
|
|
<p>
|
|
Changes to the Go frontend should follow the same process as for the
|
|
main Go repository, only for the <code>gofrontend</code> project and
|
|
the<code>gofrontend-dev@googlegroups.com</code> mailing list
|
|
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.
|
|
</p>
|