Commit Graph

738 Commits

Author SHA1 Message Date
Shenghou Ma
3ad9df0422 nacltest.bash, misc/nacl/README: update NaCl docs.
LGTM=rsc
R=dave, rsc
CC=golang-codereviews
https://golang.org/cl/105030043
2014-06-10 20:20:49 -04:00
Ian Lance Taylor
c22ed1290c cmd/cgo: for typedef of untagged struct, use typedef name in C code
Fixes #8148.

LGTM=cookieo9, rsc
R=rsc, cookieo9
CC=golang-codereviews
https://golang.org/cl/103080043
2014-06-05 10:42:03 -07:00
Ian Lance Taylor
4e65f18cae cmd/cgo: use same Go type for typedef to anonymous struct
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
2014-06-02 12:55:43 -07:00
Andrew Gerrand
bb824b6a0f misc/makerelease: fix secret
Not sure how this snuck in undetected.

TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/106760043
2014-06-02 16:26:08 +10:00
Andrew Gerrand
865904f6d8 misc/makerelease: report uploads to the new downloads page
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/102040047
2014-06-02 12:46:03 +10:00
Andrew Gerrand
f836082566 misc/goplay: remove program
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
2014-06-02 08:34:26 +10:00
Andrew Gerrand
0627fa84b7 misc/makerelease: upload files to Google Cloud Storage
LGTM=bradfitz
R=jasonhall, bradfitz
CC=golang-codereviews
https://golang.org/cl/91700047
2014-05-29 08:40:15 +10:00
Russ Cox
0782ee3ad5 cmd/cgo: given typedef struct S T, make C.T and C.struct_S interchangeable
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
2014-05-28 14:04:31 -04:00
Dmitriy Vyukov
0a8ce65c7a misc: properly spell Chrome in doc
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/99440046
2014-05-26 19:20:45 +04:00
Ian Lance Taylor
f85600859d cmd/ld: really import runtime/cgo for external link
Fixes #8032.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/95580043
2014-05-20 21:36:50 -07:00
Russ Cox
0c2a727477 build: make nacl pass
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
2014-05-20 12:10:19 -04:00
Andrew Gerrand
9cd759aecc misc/makerelease: handle update tour file layout
Fixes #7835.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/94670044
2014-05-20 15:52:08 +10:00
Alex Brainman
fcfc17f1b8 misc/pprof: always use go tool objdump on windows
Fixes #7406.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/97440043
2014-05-15 15:54:42 +10:00
Russ Cox
2d1a9510ed cmd/cgo: omit misaligned struct fields, like we omit bitfields
Fixes #7560.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/96300045
2014-05-12 23:48:20 -04:00
Russ Cox
e5c105033a cmd/gc: disable link-time copying of un-Go-initialized globals
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
2014-05-09 16:03:44 -04:00
Shenghou Ma
6be21b9f02 misc/vim/readme.txt: workaround weird OS X vim bug.
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
2014-04-28 14:24:14 -04:00
Ian Lance Taylor
9fc6c0598b misc/cgo/test/backdoor: add gccgo version of backdoor function
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
2014-04-26 22:31:32 -07:00
Russ Cox
dc370995a8 test: demo for issue 7695
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
2014-04-16 23:06:37 -04:00
Rui Ueyama
3d63ec240e misc/emacs: ignore backquote in comment or string
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
2014-04-09 12:28:27 -04:00
Russ Cox
f8c25b62b8 benchcmp: leave a forwarding script
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
2014-03-31 16:39:41 -04:00
Rui Ueyama
5f5e280e14 misc/emacs: do not highlight built-in function if not followed by '('
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
2014-03-27 17:35:07 -04:00
Daniel Morsing
0f82cfd3f0 cmd/cgo: enforce typing of 0-sized types
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
2014-03-27 20:23:16 +00:00
Rui Ueyama
444dd26bf4 misc/emacs: handle backslash in raw string in Emacs 23
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
2014-03-27 15:22:52 -04:00
Rui Ueyama
6119dc1b52 misc/bash, misc/zsh: fix completion rules
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
2014-03-27 00:29:55 -04:00
David Barnett
3eb591ff76 misc/vim: Disable automatic line wrapping by textwidth.
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
2014-03-26 13:51:16 +11:00
Dave Cheney
9cb4963d18 misc/nacl: add Native Client support scripts and documentation
LGTM=josharian, dan.kortschak
R=golang-codereviews, josharian, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/75080043
2014-03-24 12:34:09 +11:00
Rui Ueyama
50f1e1a6b9 misc/bash/go: remove "doc" subcommand autocompletion
"go doc" has been removed in CL 17799.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/77420045
2014-03-18 21:01:23 -07:00
Rui Ueyama
2940dd4bf4 misc/bash/go: Add a completion rule for "go env".
"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
2014-03-17 11:58:02 -07:00
Dominik Honnef
e9ba9470bc misc/emacs: correctly fontify methods when go-fontify-function-calls is nil
We were fontifying the wrong part of method declarations

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/66120043
2014-03-12 11:02:42 -04:00
Andrew Gerrand
9d1940bc74 misc/makerelease: use windows installer resources from local goroot
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
2014-03-03 12:50:29 +11:00
Andrew Gerrand
8d2465ab50 go/misc/makerelease: pin go-tour repo to a specific revision
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
2014-02-28 11:09:26 +11:00
Shenghou Ma
bcf3d55ed9 misc/cgo/testso: don't use TLS variables on Darwin and OpenBSD.
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
2014-02-23 20:37:43 -05:00
Shenghou Ma
d4a9bbef51 cmd/ld: don't emit unreachable dynimport symbols in ELF symtab.
Fix build for Dragonfly BSD.
Fixes #7318.
Fixes #7367.

LGTM=jsing, iant
R=jsing, iant, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/64340043
2014-02-23 16:20:40 -05:00
Dominik Honnef
cce25c88ce misc/emacs: add support for ff-find-other-file
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
2014-02-18 22:23:55 -05:00
Dominik Honnef
0d9b9aafd5 misc/emacs: actually use point argument that is passed to godef--call
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/62600043
2014-02-18 21:51:47 -05:00
Dmitriy Vyukov
bf0d71af29 runtime: more precise mprof sampling
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
2014-02-12 22:36:45 +04:00
Dmitriy Vyukov
fa3a2a84cc misc/pprof: support web profiles on windows
LGTM=bradfitz
R=golang-codereviews, bradfitz, alex.brainman
CC=golang-codereviews
https://golang.org/cl/61260044
2014-02-10 13:52:58 +04:00
Josh Bleecher Snyder
57bc80b5e8 cmd/go, doc/go1.3.txt: misc/benchcmp has been replaced by go tool benchcmp
Fixes #7016.

LGTM=r
R=r
CC=adg, bradfitz, dave, golang-codereviews
https://golang.org/cl/60100043
2014-02-04 11:53:13 -08:00
Ian Lance Taylor
1683dab725 cmd/ld: fix bug with "runtime/cgo" in external link mode
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
2014-01-30 09:25:47 -08:00
Russ Cox
abd556ab70 misc/cgo/testtls: make test less flaky
Now it should always fail on ARM.
(The fix is on its way too.)

R=iant, r, dave
CC=golang-codereviews
https://golang.org/cl/55140043
2014-01-21 19:44:51 -05:00
Rowan Worth
c4770b991b runtime: co-exist with NPTL's pthread_cancel.
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
2014-01-09 09:34:04 -08:00
Dominik Honnef
79653e4121 misc/emacs: fontify type switch correctly
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
2014-01-06 11:11:03 -05:00
Dominik Honnef
81cab4c3d3 misc/emacs: minor cleanups
R=adonovan
CC=golang-codereviews
https://golang.org/cl/23290044
2014-01-06 10:48:06 -05:00
Yasuhiro Matsumoto
7413e48d5b misc/vim: Fix broken quote
R=golang-codereviews, gobot, dsymonds
CC=golang-codereviews
https://golang.org/cl/44960043
2013-12-24 08:40:13 +11:00
ChaiShushan
33580e8305 misc/notepadplus: Fix Function List in Notepad++ 6.5
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
2013-12-18 10:17:38 -08:00
Shenghou Ma
e962f8f1c6 misc/vim: use shiftwidth() instead of &sw if available.
Fixes #6841.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/43010044
2013-12-16 20:05:48 -05:00
Andrew Gerrand
dba08e0615 misc/dist: rename to makerelease
The ambiguity has gone on too long.

R=golang-dev, minux.ma, r, dsymonds
CC=golang-dev
https://golang.org/cl/39920043
2013-12-11 14:47:18 +11:00
Alex Brainman
6ede93498c misc/cgo/testcdefs: rm correct file in test.bash
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/39780043
2013-12-10 12:06:24 +11:00
Alex Brainman
6795687427 cmd/cgo: use __gcc_struct__ for go exported functions
Fixes #6833

R=minux.ma, iant
CC=golang-dev
https://golang.org/cl/35790045
2013-12-10 11:30:12 +11:00
David Symonds
ee261b75e1 misc/vim: send Fmt errors to the quickfix list instead of the location list.
Output from gofmt is a list of errors, so they should appear in the error list.

R=adg
CC=golang-dev
https://golang.org/cl/33760043
2013-11-27 19:32:15 +11:00