1
0
mirror of https://github.com/golang/go synced 2024-10-03 09:31:23 -06:00
Commit Graph

3877 Commits

Author SHA1 Message Date
Russ Cox
6d888f1e1b build: clang support
This works with at least one version of clang
that existed at one moment in time.
No guarantees about clangs past or future.

To try:
        CC=clang all.bash

It does not work with the Xcode clang,
because that clang fails at printing a useful answer
to:
        clang -print-libgcc-file-name
The clang that works prints a full path name for
that command, not just "libgcc.a".

Fixes #4713.

R=iant, minux.ma
CC=golang-dev
https://golang.org/cl/7323068
2013-02-15 13:37:43 -08:00
Russ Cox
2d4164596f cmd/go: reject case-insensitive file name, import collisions
To make sure that Go code will work when moved to a
system with a case-insensitive file system, like OS X or Windows,
reject any package built from files with names differing
only in case, and also any package built from imported
dependencies with names differing only in case.

Fixes #4773.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7314104
2013-02-15 14:39:39 -05:00
Anthony Martin
f2c3122307 cmd/ld: fix -s flag for ELF executables
This fixes a regression introduced in changeset 98034d036d03
which added support for producing host object files.

R=rsc, minux.ma
CC=dave, golang-dev
https://golang.org/cl/7307107
2013-02-14 18:43:54 -08:00
Carl Shapiro
817a3f39fd src/cmd/gc: fix some typos in the escape analysis comments
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7342044
2013-02-14 15:38:57 -08:00
Robert Griesemer
5b1885c241 go/parser: cleanups following CL 7307085
- use the new AllErrors flag where appropriate
- unless AllErrors is set, eliminate spurious
  errors before they are added to the errors list
  (it turns out that reporting spurious errors always
  leads to too many uninformative errors after all)

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7323065
2013-02-14 13:36:40 -08:00
Daniel Morsing
38244018ce cmd/gc: remove node printing in redeclare errors
I suspect this is some debugging which got through the submission process.

Fixes #4789.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7310079
2013-02-14 21:11:47 +01:00
Russ Cox
11884db3d7 cmd/go: fix vet
The IgnoredGoFiles are already listed in allgofiles,
so they were being run twice. Worse, the ones in
IgnoredGoFiles are not fully qualified paths, so they
weren't being found when executed outside the
package directory.

Fixes #4764.

R=golang-dev, minux.ma, franciscossouza
CC=golang-dev
https://golang.org/cl/7308049
2013-02-14 15:00:51 -05:00
Russ Cox
31072e41f4 cmd/gc: replace x*8 by x<<3 etc
Fixes #4199.

R=ken2
CC=golang-dev
https://golang.org/cl/7322081
2013-02-14 14:54:00 -05:00
Russ Cox
ac1015e7f3 cmd/8g: fix sse2 compare code gen
Fixes #4785.

R=ken2
CC=golang-dev
https://golang.org/cl/7300109
2013-02-14 14:49:04 -05:00
Russ Cox
357a18a2c6 cmd/go: set $PWD when running commands
This makes os.Getwd inside those commands much faster.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7324055
2013-02-14 14:21:44 -05:00
Russ Cox
7f284f85f9 cmd/vet: drop column information from error
The column information can be misleading.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/7300100
2013-02-13 22:34:37 -05:00
Russ Cox
594360cb1b cmd/8c: disable use of prefetch with GO386=387
Fixes #4798.

R=ken2
CC=golang-dev
https://golang.org/cl/7323061
2013-02-13 21:13:07 -05:00
Lucio De Re
a3855013a2 cmd/5l: fix print format
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7304065
2013-02-13 16:47:33 -05:00
Rob Pike
d282532901 vet: improve flag handling
Simplify the internal logic for flags controlling what to vet,
by introducing a map of flags that gathers them all together.
This change should simplify the process of adding further flags.

Add a test for untagged struct literals.
Delete a redundant test that was also in the wrong file.
Clean up some ERROR patterns that weren't working.

"make test" passes again.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7305075
2013-02-11 13:33:11 -08:00
Lucio De Re
fece09e58a cmd/8l/asm.c: Unused function arguments, suppress warnings.
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/7304069
2013-02-11 10:15:56 +11:00
Robert Daniel Kortschak
482f3e8481 cmd/go: indicate that flags unrecognized by 'go test' must follow package specification
R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7300063
2013-02-08 16:00:59 -05:00
Rémy Oudompheng
f42fa807a6 cmd/5g: add missing splitclean.
See issue 887 for the 8g analogue.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7306069
2013-02-08 08:19:47 +01:00
David Symonds
3c1dfb2b9a cmd/godoc: fix format strings.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7309061
2013-02-08 12:00:35 +11:00
Russ Cox
7594440ef1 cmd/8g: add a few missing splitclean
Fixes #887.

R=ken2
CC=golang-dev
https://golang.org/cl/7303061
2013-02-07 17:55:25 -05:00
Shenghou Ma
255fb521da cmd/dist: add -Wstrict-prototypes to CFLAGS and fix all the compiler errors
Plan 9 compilers insist this but as we don't have Plan 9
builders, we'd better let gcc check the prototypes.

Inspired by CL 7289050.

R=golang-dev, seed, dave, rsc, lucio.dere
CC=akumar, golang-dev
https://golang.org/cl/7288056
2013-02-05 21:43:04 +08:00
Russ Cox
fd178d6a7e cmd/gc: add way to specify 'noescape' for extern funcs
A new comment directive //go:noescape instructs the compiler
that the following external (no body) func declaration should be
treated as if none of its arguments escape to the heap.

Fixes #4099.

R=golang-dev, dave, minux.ma, daniel.morsing, remyoudompheng, adg, agl, iant
CC=golang-dev
https://golang.org/cl/7289048
2013-02-05 07:00:38 -05:00
Russ Cox
572d984eaa cmd/gc: fix escape analysis
If the analysis reached a node twice, then the analysis was cut off.
However, if the second arrival is at a lower depth (closer to escaping)
then it is important to repeat the traversal.

The repeating must be cut off at some point to avoid the occasional
infinite recursion. This CL cuts it off as soon as possible while still
passing all tests.

Fixes #4751.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/7303043
2013-02-04 22:48:31 -05:00
Shenghou Ma
49fe632c7d cmd/go: update doc.go
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7279047
2013-02-05 05:45:35 +08:00
Russ Cox
399dcc75a8 cmd/gc: fix &^ code generation bug
Was not re-walking the new AND node, so that its ullman
count was wrong, so that the code generator attempted to
store values in registers across the call.

Fixes #4752.

R=ken2
CC=golang-dev
https://golang.org/cl/7288054
2013-02-04 00:21:44 -05:00
Russ Cox
89a2a8c8df cmd/go, testing: revise docs for test flags
In cmd/go's 'go help testflag':
* Rewrite list of flags to drop test. prefix on every name.
* Sort list of flags.
* Add example of using -bench to match all benchmarks.

In testing:
* Remove mention of undefined 'CPU group' concept.

Fixes #4488.
Fixes #4508.

R=adg
CC=golang-dev
https://golang.org/cl/7288053
2013-02-03 23:47:03 -05:00
Russ Cox
2c09d6992f cmd/gc: slightly better code generation
* Avoid treating CALL fn(SB) as justification for introducing
and tracking a registerized variable for fn(SB).

* Remove USED(n) after declaration and zeroing of n.
It was left over from when the compiler emitted more
aggressive set and not used errors, and it was keeping
the optimizer from removing a redundant zeroing of n
when n was a pointer or integer variable.

Update #597.

R=ken2
CC=golang-dev
https://golang.org/cl/7277048
2013-02-03 14:51:21 -05:00
Russ Cox
f02067a99a cmd/gc: implement latest rules for checking make sizes
Fixes #4085.

R=ken2
CC=golang-dev
https://golang.org/cl/7277047
2013-02-03 14:28:44 -05:00
Russ Cox
46d6f3c62f cmd/go: update 'go get' help message
It accepts all the build flags.
Say that instead of making a copy that will go stale.

Fixes #4742.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7229081
2013-02-03 13:08:23 -05:00
Shenghou Ma
2ebfaa36b5 cmd/5l, cmd/ld: support generating ELF binaries for NetBSD/ARM
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7261043
2013-02-04 00:40:11 +08:00
Russ Cox
09a17ca1f1 cmd/gc: make inlined labels distinct
Fixes #4748.

R=ken2
CC=golang-dev
https://golang.org/cl/7261044
2013-02-03 11:19:22 -05:00
Russ Cox
d82dcadb57 cmd/gc: clean up string index errors
Unify with array/slice errors, which were already good.

Fixes #4232.

R=ken2
CC=golang-dev
https://golang.org/cl/7271046
2013-02-03 02:01:05 -05:00
Russ Cox
4ad505d102 cmd/gc: update ideal bool rules to match latest spec
Fixes #3915.
Fixes #3923.

R=ken2
CC=golang-dev
https://golang.org/cl/7281044
2013-02-03 01:44:03 -05:00
Russ Cox
b2e0c34cf3 cmd/gc: remove reference to ? and @ symbols in error message
Those symbols are only allowed during imports;
the parser may expect them but saying that doesn't help users.

Fixes #3434.

R=ken2
CC=golang-dev
https://golang.org/cl/7277045
2013-02-03 01:25:47 -05:00
Russ Cox
2eafbb8878 cmd/gc: elide self-assignment during return
More efficient, less racy code.

Fixes #4014.

R=ken2, ken
CC=golang-dev
https://golang.org/cl/7275047
2013-02-03 01:18:28 -05:00
Russ Cox
ffc742b658 cmd/gc: allow new conversion syntax
For consistency with conversions that look like function calls,
conversions that don't look like function calls now allow an
optional trailing comma.

That is, int(x,) has always been syntactically valid.
Now []int(x,) is valid too.

Fixes #4162.

R=ken2
CC=golang-dev
https://golang.org/cl/7288045
2013-02-03 00:03:10 -05:00
Russ Cox
2af3cbe308 cmd/gc: treat &T{} like new(T): allocate on stack if possible
Fixes #4618.

R=ken2
CC=golang-dev
https://golang.org/cl/7278048
2013-02-02 23:54:21 -05:00
Russ Cox
a72f9f46a2 cmd/gc: avoid duplicate allocation during inlining
Fixes #4667.

R=ken2
CC=golang-dev
https://golang.org/cl/7275046
2013-02-02 23:17:25 -05:00
Russ Cox
fc6b530f0f cmd/gc: remove spurious newline from node dump
R=ken2
CC=golang-dev
https://golang.org/cl/7276048
2013-02-02 23:09:49 -05:00
Russ Cox
18178fd138 cmd/go: run examples in source order, not name order
Add Order field to doc.Example and write doc comments there.

Fixes #4662.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7229071
2013-02-02 16:26:12 -05:00
Daniel Morsing
5ea52a4d91 cmg/gc: Fix evaluation order of map indexing during multiple assignments
Fixes #4620.

R=rsc
CC=golang-dev
https://golang.org/cl/7241051
2013-02-02 12:39:04 +01:00
Russ Cox
8931306389 cmd/gc: reject non-Go constants
Expressions involving nil, even if they can be evaluated
at compile time, do not count as Go constants and cannot
be used in const initializers.

Fixes #4673.
Fixes #4680.

R=ken2
CC=golang-dev
https://golang.org/cl/7278043
2013-02-01 23:10:02 -05:00
Russ Cox
f607c479ea cmd/gc: silence redundant error prints for misuse of [...]int
Fixes #4452.

R=ken2
CC=golang-dev
https://golang.org/cl/7241065
2013-02-01 21:21:27 -05:00
Russ Cox
e2711cb202 cmd/gc: put 'not used' message on correct line
Fixes #4663.

R=ken2
CC=golang-dev
https://golang.org/cl/7235081
2013-02-01 21:13:41 -05:00
Russ Cox
79a16a3b70 cmd/gc: clearer error for defer/go of conversion or invalid function call
Fixes #4654.

R=ken2
CC=golang-dev
https://golang.org/cl/7229072
2013-02-01 21:02:15 -05:00
Elias Naur
44cf814d50 runtime, cmd/ld: make code more position-independent
Change the stack unwinding code to compensate for the dynamic
relocation of symbols.
Change the gc instruction GC_CALL to use a relative offset instead of
an absolute address.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7248048
2013-02-01 11:24:49 -08:00
Brad Fitzpatrick
e515d80d5d bytes, strings: add TrimPrefix and TrimSuffix
Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044
2013-02-01 08:41:25 -08:00
Elias Naur
fe14ee52cc cmd/6c, cmd/6g: add flag to support large-model code generation
Added the -pic flag to 6c and 6g to avoid assembler instructions that
cannot use RIP-relative adressing. This is needed to support the -shared mode
in 6l.

See also:
https://golang.org/cl/6926049
https://golang.org/cl/6822078

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7064048
2013-02-01 08:35:33 -08:00
Russ Cox
32a6097fde cmd/go: clean cgo compiler errors
Cut out temporary cgo file in error message.
Show C.foo instead of _Ctype_foo.

Before:
x.go:20[/var/folders/00/05_b8000h01000cxqpysvccm000n9d/T/go-build242036121/command-line-arguments/_obj/x.cgo1.go:19]: cannot use tv.Usec (type int32) as type _Ctype___darwin_suseconds_t in assignment

After:
x.go:20: cannot use tv.Usec (type int32) as type C.__darwin_suseconds_t in assignment

Fixes #4255.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7231075
2013-02-01 08:34:21 -08:00
Russ Cox
f20e3a1065 cmd/cgo: fix line number annotations in generated C code
The old version was using go/ast's CommentGroup.Text method,
but that method drops leading blank lines from the result, so that
if the comment looked like one of

//
// syntax error
import "C"

/*
syntax error
*/
import "C"

then the line numbers for the syntax error would be off by the
number of leading blank lines (1 in each of the above cases).

The new text extractor preserves blank lines.

Fixes #4019.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7232071
2013-02-01 08:34:08 -08:00
Russ Cox
ed9fc7531d cmd/cgo: document //export preamble restriction
Fixes #3497.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7235075
2013-02-01 08:33:52 -08:00