Some systems, like Ubuntu, pass --build-id when linking. The
effect is to put a note in the output file. This is not
useful when generating an object file with the -r option, as
it eventually causes multiple build ID notes in the final
executable, all but one of which are for tiny portions of the
file and are therefore useless.
Disable that by passing an explicit --build-id=none when
linking with -r on systems that might do this.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/119460043
Instead of immediately completing pointer type mappings, add them to
a queue to allow them to be completed later. This fixes issues caused
by Type() returning arbitrary in-progress type mappings.
Fixes#8368.
Fixes#8441.
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/122850043
Instead of including <sys/types.h> to get size_t, instead include
the ISO C standard <stddef.h> header, which defines fewer additional
types at risk of colliding with the user code. In particular, this
prevents collisions between <sys/types.h>'s userspace definitions with
the kernel definitions needed by defs_linux.go.
Also, -cdefs mode uses #pragma pack, so we can keep misaligned fields.
Fixes#8477.
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/120610043
Update #6677
When a struct contains an anonymous union, use the type and
name of the first field in the union.
This should make the glibc <sys/resource.h> file work; in that
file struct rusage has fields like
__extension__ union
{
long int ru_maxrss;
__syscall_slong_t __ru_maxrss_word;
};
in which the field that matters is ru_maxrss and
__ru_maxrss_word just exists to advance to the next field on
systems where the kernel uses long long fields but userspace
expects long fields.
LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/106260044
Breaks build for FreeBSD. Probably clang related?
««« original CL description
cmd/cgo: disable inappropriate warnings when the gcc struct is empty
package main
//#cgo CFLAGS: -Wall
//void test() {}
import "C"
func main() {
C.test()
}
This code will cause gcc issuing warnings about unused variable.
This commit use offset of the second return value of
Packages.structType to detect whether the gcc struct is empty,
and if it's directly invoke the C function instead of writing an
unused code.
LGTM=dave, minux
R=golang-codereviews, iant, minux, dave
CC=golang-codereviews
https://golang.org/cl/109640045
»»»
TBR=dfc
R=dave
CC=golang-codereviews
https://golang.org/cl/114990044
package main
//#cgo CFLAGS: -Wall
//void test() {}
import "C"
func main() {
C.test()
}
This code will cause gcc issuing warnings about unused variable.
This commit use offset of the second return value of
Packages.structType to detect whether the gcc struct is empty,
and if it's directly invoke the C function instead of writing an
unused code.
LGTM=dave, minux
R=golang-codereviews, iant, minux, dave
CC=golang-codereviews
https://golang.org/cl/109640045
On amd64, the real time is reduced from 176.76s to 140.26s.
On ARM, the real time is reduced from 921.61s to 726.30s.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/101580043
We are not the right people to support editor plugins, and the profusion
of editors in this CL demonstrates the unreality of pretending to do so.
People are free to create and advertise their own repos with support.
For discussion: https://groups.google.com/forum/#!topic/golang-dev/SA7fD470FxU
LGTM=rminnich, kamil.kisiel, gri, rsc, dave, josharian, ruiu
R=golang-codereviews, rminnich, kamil.kisiel, gri, rsc, dominik.honnef, dave, josharian, ruiu, ajstarks
CC=golang-codereviews
https://golang.org/cl/105470043
Using flet to replace kill-region with delete-region was a hack,
flet is now (GNU Emacs 24.3) deprecated and at least two people
have reported an issue where using go--delete-whole-line would
permanently break their kill ring. While that issue is probably
caused by faulty third party code (possibly prelude), it's easier
to write a clean implementation than to tweak the hack.
LGTM=ruiu, adonovan
R=adonovan, ruiu
CC=adg, golang-codereviews
https://golang.org/cl/106010043
If we see a typedef to an anonymous struct more than once,
presumably in two different Go files that import "C", use the
same Go type name.
Fixes#8133.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/102080043
This program has barely been touched since it was first committed,
and in its current state it opens a code execution vector similar
to the one that was recently fixed in go.tools/playground/socket.
Rather than try to make it secure, remove it.
LGTM=minux, rsc
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/102030047
For incomplete struct S, C.T and C.struct_S were interchangeable in Go 1.2
and earlier, because all incomplete types were interchangeable
(even C.struct_S1 and C.struct_S2).
CL 76450043, which fixed issue 7409, made different incomplete types
different from Go's point of view, so that they were no longer completely
interchangeable.
However, imprecision about C.T and C.struct_S - really the same
underlying C type - is the one behavior enabled by the bug that
is most likely to be depended on by existing cgo code.
Explicitly allow it, to keep that code working.
Fixes#7786.
LGTM=iant, r
R=golang-codereviews, iant, r
CC=golang-codereviews
https://golang.org/cl/98580046
Add nacl.bash, the NaCl version of all.bash.
It's a separate script because it builds a variant of package syscall
with a large zip file embedded in it, containing all the input files
needed for tests.
Disable various tests new since the last round, mostly the ones using os/exec.
Fixes#7945.
LGTM=dave
R=golang-codereviews, remyoudompheng, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/100590044
If you write:
var x = 3
then the compiler arranges for x to be initialized in the linker
with an actual 3 from the data segment, rather than putting
x in the bss and emitting init-time "x = 3" assignment code.
If you write:
var y = x
var x = 3
then the compiler is clever and treats this the same as if
the code said 'y = 3': they both end up in the data segment
with no init-time assignments.
If you write
var y = x
var x int
then the compiler was treating this the same as if the
code said 'x = 0', making both x and y zero and avoiding
any init-time assignment.
This copying optimization to avoid init-time assignment of y
is incorrect if 'var x int' doesn't mean 'x = 0' but instead means
'x is initialized in C or assembly code'. The program ends up
with 'y = 0' instead of 'y = the value specified for x in that other code'.
Disable the propagation if there is no initializer for x.
This comes up in some uses of cgo, because cgo generates
Go globals that are initialized in accompanying C files.
Fixes#7665.
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/93200044
The vi bundled with OS X has a weird bug in that if you turn off
filetype in .vimrc when it's not turned on, even a clean exit of
vi will return 1 which breaks almost everything.
While we're at it, add hint to change $GOROOT to its actual value
in .vimrc.
Fixes#7865.
LGTM=robert.hencke, dsymonds
R=golang-codereviews, robert.hencke, gobot, dsymonds
CC=golang-codereviews
https://golang.org/cl/96800046
For the gc compiler the Go function Issue7695 is defined in
runtime.c, but there is no way to do that for gccgo, because
there is no way to get the correct pkgpath. The test is not
important for gccgo in any case.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/93870044
Cgo writes C function declarations pretending every arg is a pointer.
If the C function is deferred, it does not inhibit stack copying on split.
The stack copying code believes the C declaration, possibly misinterpreting
integers as pointers.
Probably the right fix for Go 1.3 is to make deferred C functions inhibit
stack copying.
For Go 1.4 and beyond we probably need to make cgo generate Go code
for 6g here, not C code for 6c.
Update #7695
LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/83820043
go-mode on Emacs 23 wrongly recognizes a backquote in a comment or
a string as a start of a raw string literal. Below is an example
that go-mode does not work well. This patch is to fix that issue.
// `
var x = 1
// `
LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef, adonovan
CC=golang-codereviews
https://golang.org/cl/84900043
People (like me!) will still try to run misc/benchcmp
and wonder where it went. Tell them.
LGTM=bradfitz
R=golang-codereviews, bradfitz, dave
CC=adg, golang-codereviews, r
https://golang.org/cl/82710043
Name of built-in function is not reserved word in Go, and you can
use it as variable name. "new" is often used as local variable, for
instance.
This patch is to apply font-lock-builtin-face only when built-in
function name is followed by '(', so that it doesn't highlight
non-function variable that happen to have the same name as built-in
function.
LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef, adonovan
CC=golang-codereviews
https://golang.org/cl/79260043
cgo represents all 0-sized and unsized types internally as [0]byte. This means that pointers to incomplete types would be interchangable, even if given a name by typedef.
Fixes#7409.
LGTM=iant
R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/76450043
Go-mode in Emacs 23 does not recognize a backslash followed
by a backquote as end of raw string literal, as it does not
support syntax-propertize-function which Go-mode uses to
remove special meaning from backslashes in ``.
This patch provides a fallback mechanism to do the same thing
using font-lock-syntactic-keywords, which is supported by
Emacs 23.
LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef
CC=adonovan, golang-codereviews
https://golang.org/cl/78730048
This patch includes fixes pointed out in CL 52140043, which was
originally written by john.gosset.
LGTM=minux.ma
R=golang-codereviews, minux.ma
CC=golang-codereviews
https://golang.org/cl/80320043
If someone configures a 'textwidth' in go files, vim will by default insert
newlines into long lines as you type, which breaks syntax and doesn't really
make sense for go code. This fixes the default.
LGTM=dsymonds
R=golang-codereviews, gobot, dsymonds
CC=golang-codereviews
https://golang.org/cl/76890046
"env" is a valid go command. This patch is to make bash to autocomplete it.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/74660045
This broke when we renamed the tool, and I missed this fix when I
fixed darwin last week.
LGTM=minux.ma, bradfitz
R=golang-codereviews, minux.ma, bradfitz
CC=golang-codereviews
https://golang.org/cl/70670043
We're about to commit some wide-sweeping changes to the go-tour and I
would rather not include them in Go 1.2.1, which is due in the next
week or so.
Also fix the makerelease tool; it has been broken since it was
renamed from bindist.
LGTM=campoy
R=campoy
CC=golang-codereviews
https://golang.org/cl/68780043
Fix build for 10.6 Darwin builders and OpenBSD builers.
LGTM=jsing
R=golang-codereviews, dave, jsing
CC=golang-codereviews
https://golang.org/cl/67710043
c-mode classically uses ff-find-other-file to toggle between headers
and implementation. For Go it seemingly makes sense to jump between
implementation and test.
While there's no enforced mapping of file names for tests, the mapping
in this CL seems to be very common at least throughout the standard
library, and ff-find-other-file fails gracefully when the mapping
doesn't apply.
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/65750044
Better sampling of objects that are close in size to sampling rate.
See the comment for details.
LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/43830043
In external link mode the linker explicitly adds the string
constant "runtime/cgo". It adds the string constant using the
same symbol name as the compiler, but a different format. The
compiler assumes that the string data immediately follows the
string header, but the linker puts the two in different
sections. The result is bad string data when the compiler
sees "runtime/cgo" used as a string constant.
The compiler assumption is in datastring in [568]g/gobj.c.
The linker layout is in addstrdata in ld/data.c. The compiler
assumption is valid for string literals. The linker is not
creating a string literal, so its assumption is also valid.
There are a few ways to avoid this problem. This patch fixes
it by only doing the fake import of runtime/cgo if necessary,
and by only creating the string symbol if necessary.
Fixes#7234.
LGTM=dvyukov
R=golang-codereviews, dvyukov, bradfitz
CC=golang-codereviews
https://golang.org/cl/58410043
NPTL uses SIGRTMIN (signal 32) to effect thread cancellation.
Go's runtime replaces NPTL's signal handler with its own, and
ends up aborting if a C library that ends up calling
pthread_cancel is used.
This patch prevents runtime from replacing NPTL's handler.
Fixes#6997.
R=golang-codereviews, iant, dvyukov
CC=golang-codereviews
https://golang.org/cl/47540043
Require at least one space after "type" and do not fontify closing
parenthesis of type switch as a type.
R=adonovan
CC=golang-codereviews
https://golang.org/cl/37720050
Since version 6.5, npp change the Function List syntax for User Defined Languages.
We need use userDefinedLangName syntax in association tag in Notepad++ 6.5.
Fix issue 6735.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/22770043
This step makes it possible to upload the -osx10.x binaries
separately to their construction (after signing, for example).
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/28160043
- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler
This is identical to CL 19010044 with one exception: Making sure
it doesn't break on Emacs 22.1
R=adonovan, bradfitz, shendaras
CC=golang-dev
https://golang.org/cl/20100043
Clang does not record the "size" field for pointer types,
so we must insert the size ourselves. We were already
doing this, but only for the case of pointer types.
For an array of pointer types, the setting of the size for
the nested pointer type was happening after the computation
of the size of the array type, meaning that the array type
was always computed as 0 bytes. Delay the size computation.
This bug happens on all Clang systems, not just FreeBSD.
Our test checked that cgo wrote something, not that it was correct.
FreeBSD's default clang rejects array[0] as a C struct field,
so it noticed the incorrect sizes. But the sizes were incorrect
everywhere.
Update testcdefs to check the output has the right semantics.
Fixes#6292.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/22840043
bradfitz reports:
> It breaks go-mode on GNU Emacs 22.1.1 as ships with OS X 10.8.6.
««« original CL description
misc/emacs: various cleanups
- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler
R=adonovan
CC=golang-dev
https://golang.org/cl/19010044
»»»
R=bradfitz
CC=golang-dev
https://golang.org/cl/19640043
- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler
R=adonovan
CC=golang-dev
https://golang.org/cl/19010044
The newest version of godef supports jumping to a package's source
directory if point is on an import statement.
R=adonovan
CC=golang-dev
https://golang.org/cl/18230043
Prevent linkcheck from following redirects that lead beyond the outside
the root URL.
Return a non-zero exit code when there are problems.
Some minor refactoring for clarity.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14425049
The old approach to determining whether "name" was a type, constant,
or expression was to compile the C program
name;
and scan the errors and warnings generated by the compiler.
This requires looking for specific substrings in the errors and warnings,
which ties the implementation to specific compiler versions.
As compilers change their errors or drop warnings, cgo breaks.
This happens slowly but it does happen.
Clang in particular (now required on OS X) has a significant churn rate.
The new approach compiles a slightly more complex program
that is either valid C or not valid C depending on what kind of
thing "name" is. It uses only the presence or absence of an error
message on a particular line, not the error text itself. The program is:
// error if and only if name is undeclared
void f1(void) { typeof(name) *x; }
// error if and only if name is not a type
void f2(void) { name *x; }
// error if and only if name is not an integer constant
void f3(void) { enum { x = (name)*1 }; }
I had not been planning to do this until Go 1.3, because it is a
non-trivial change, but it fixes a real Xcode 5 problem in Go 1.2,
and the new code is easier to understand than the old code.
It should be significantly more robust.
Fixes#6596.
Fixes#6612.
R=golang-dev, r, james, iant
CC=golang-dev
https://golang.org/cl/15070043
Ensure that clang always exits with a non-zero status by
giving it something that it always warns about (the statement "1;").
Fixes#6128.
R=golang-dev, iant, minux.ma
CC=golang-dev
https://golang.org/cl/14702043
Also add the action's object directory to the list of
directories we use to find SWIG shared libraries.
Fixes#6521.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/14369043
Fixes a bug in cgo on OS X using clang.
See golang.org/issue/6472 for details.
Fixes#6472.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14575043
The Go compiler emits extra information for this case:
imported and not used: "sandbox/foo_bar" as bar
R=adonovan
CC=golang-dev
https://golang.org/cl/14111043
so that we don't need worry about specifying the required
libc version (note: as cmd/go will still be dynamically
linked to libc, we still need to perform the build on OSes
with an old enough libc. But as cmd/go doesn't rely on many
libc symbols, the situation should be significantly better).
Fixes#3564.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14261043
notepadplus can only support some normal golang's hex and imaginary numbers.
it can't detect some special number, eg. 1./1.e/1.i/1+0.1i (omit "0" in ".0").
R=golang-dev, gvdschoot
CC=ajstarks, golang-dev
https://golang.org/cl/13401047
This will allow us to cut binaries with names like:
go1.2rc1.darwin-amd64-osx10.6.pkg
go1.2rc1.darwin-amd64-osx10.8.pkg
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13629045
Because we can, and because it otherwise might crash
the program if we think we're out of memory.
Fixes#6390.
R=golang-dev, iant, minux.ma
CC=golang-dev
https://golang.org/cl/13345048
This is not quite what that issue reports,
because this does not involve a DLL.
But I wanted to make sure this much was working.
Update #4339
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/13653043
Use either LWP::UserAgent or curl to make HTTP requests so it
works on Windows (most Perl distros include LWP::UserAgent),
and also on OS X (whose Perl at least sometimes doesn't
include LWP::UserAgent).
Fixes#6273
R=golang-dev, alex.brainman, cldorian
CC=golang-dev
https://golang.org/cl/13330044
Removed posix assumptions in temporary file generation
Removed curl dependence
Changed opening of svg file
These must now work including symbol resolution.
[1] go tool pprof <prog_name> http://.../debug/pprof/profile
[2] go tool pprof http://.../debug/pprof/profile
Fixes 6177.
R=golang-dev, alex.brainman, bradfitz, kamil.kisiel
CC=golang-dev
https://golang.org/cl/13085043
Some users have multiple Go development trees and invoke the
'go' tool via a wrapper that sets GOROOT and GOPATH based on
the current directory. Such users should customize go-command
to point to the wrapper script.
R=dominik.honnef
CC=golang-dev
https://golang.org/cl/13233043
If xcode-select is available, use it to determine the path to the
DVTFoundation.xcplugindata file.
Fixes#5997.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12741047
When the coverage report file is older than the file we're
showing the coverage report for, then we show a simple message
to state this fact.
R=adonovan, dominik.honnef, bradfitz
CC=golang-dev
https://golang.org/cl/12919044
When identifying structs or interfaces we really want to know
their makeup, not just their name.
R=adonovan
CC=golang-dev
https://golang.org/cl/13042043
Jumps to the same file will use the original buffer, not the
coverage buffer. Making it work for the coverage buffer isn't
worth the trouble, especially because it would break as soon as
you jump to a different file and back.
Use error instead of message so it actually terminates
R=adonovan
CC=golang-dev
https://golang.org/cl/13041043
* Add a new kind of Name, "fpvar" which stands for function pointer variable
* When walking the AST, find functions used as expressions and create a new Name object for them
* Track functions which are only used in expr contexts, and avoid generating bridge code for them
R=golang-dev, minux.ma, fullung, rsc, iant
CC=golang-dev
https://golang.org/cl/9835047
Use the same algorithm that go tool cover uses when producing HTML
output to render coverage intensity.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12712043
Renders code coverage as an overlay, replicating the look of the
HTML that go tool cover produces.
Also some cleanups.
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/12684043
The receiver name is optional. when Method's receiver name messing,
the functionList regex can't match the Method,
e.g. `func (*T) ProtoMessage() {}`.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12530044
In prep for Robert's forthcoming cmd/api rewrite which
depends on the go.tools subrepo, we'll need to be more
careful about how and when we run cmd/api.
Rather than implement this policy in both run.bash and
run.bat, this change moves the policy and mechanism into
cmd/api/run.go, which will then evolve.
The plan is in a TODO in run.go.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/12482044
Basically a partial rollback of 12053043 until I can
figure out what is really going on.
Fixes bug 6051.
R=golang-dev
CC=golang-dev
https://golang.org/cl/12496043
cmd/api is a tool to prevent the Go developers from breaking
the Go 1 API promise. It has no utility to end users and
doesn't run on arbitrary packages (it's always been full of
hacks for its bespoke type checker to work on the standard
library)
Robert's in-progress rewrite depends on the go.tools repo for
go/types, so we won't be able to ship this tool later
anyway. Just remove it from binary distributions.
A future change to run.bash can conditionally build & run
cmd/api, perhaps automatically fetching go/types if
necessary. I assume people don't want to vendor go/types into
a private gopath just for cmd/api.
I will need help with run.bat.
R=golang-dev, adg, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/12316043
Split stack checks (morestack) corrupt g->sched,
but g->sched must be preserved consistent for GC/traceback.
The change implements runtime.notetsleepg function,
which does entersyscall/exitsyscall and is carefully arranged
to not call any split functions in between.
R=rsc
CC=golang-dev
https://golang.org/cl/11575044