Commit Graph

10884 Commits

Author SHA1 Message Date
Russ Cox
d842acd57e crypto/tls: make compatible with go/build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5484073
2011-12-14 10:25:48 -05:00
Russ Cox
23cd406496 hash/crc32: make compatible with go/build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5486060
2011-12-14 10:25:16 -05:00
Russ Cox
576311d72b go/build: make compatible with go/build
The irony!

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5482062
2011-12-14 10:24:17 -05:00
Luuk van Dijk
1f6d130b14 gc: add forgotten typecheck in a lonely corner of sinit
Fixes #2549

R=rsc
CC=golang-dev
https://golang.org/cl/5484060
2011-12-14 15:54:10 +01:00
Luuk van Dijk
a62722bba4 gc: inlining (disabled without -l)
Cross- and intra package inlining of single assignments or return <expression>.
Minus some hairy cases, currently including other calls, expressions with closures and ... arguments.

R=rsc, rogpeppe, adg, gri
CC=golang-dev
https://golang.org/cl/5400043
2011-12-14 15:05:33 +01:00
Andrew Balholm
e25a83d03e html: close <button> element before opening a new one
Pass tests6.dat, test 13:
<button><button>

| <html>
|   <head>
|   <body>
|     <button>
|     <button>

Also pass tests through test 25:
<table><colgroup>foo

R=nigeltao
CC=golang-dev
https://golang.org/cl/5487072
2011-12-14 21:40:31 +11:00
Luuk van Dijk
3c638f2892 gc: Use %#F in error messages instead of %F.
Fixes #2520

R=rsc
CC=golang-dev
https://golang.org/cl/5482056
2011-12-14 08:22:36 +01:00
Luuk van Dijk
6a401339c1 gc: suppress non-root cause message for bad receivers.
Fixed issue 2500

R=rsc
CC=golang-dev
https://golang.org/cl/5485053
2011-12-14 08:21:37 +01:00
Russ Cox
c8a5f8841c undo CL 5485063 / 21595dc0395a
breaks 64-bit build

««« original CL description
8c: handle 64-bit switch value
Cases must still be 32-bit values, but one thing at a time.

R=ality, ken2, ken
CC=golang-dev
https://golang.org/cl/5485063
»»»

R=ken2
CC=golang-dev
https://golang.org/cl/5488075
2011-12-14 00:46:07 -05:00
Christopher Wedgwood
1e63a4e424 runtime: bump gc 'extra bytes' check
(needed for non-zero GOMAXPROCS)

R=iant, rsc
CC=go.peter.90, golang-dev
https://golang.org/cl/5486059
2011-12-13 21:28:43 -08:00
Russ Cox
6481e37d28 8c: handle 64-bit switch value
Cases must still be 32-bit values, but one thing at a time.

R=ality, ken2, ken
CC=golang-dev
https://golang.org/cl/5485063
2011-12-14 00:08:38 -05:00
Rob Pike
ba576b2b48 encoding/gob: better error messages when types mismatch
The transmitter must encode an interface value if it is to be decoded
into an interface value, but it's a common and confusing error to
encode a concrete value and attempt to decode it into an interface,
particularly *interface{}. This CL attempts to explain things better.

Fixes #2367.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5485072
2011-12-13 20:40:55 -08:00
Yasuhiro Matsumoto
1c50c32af0 exp/winfsnotify: fix build.
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5483057
2011-12-14 13:17:48 +11:00
Robert Griesemer
599c18fa3f spec: values of underlying type uintptr can be converted to unsafe.Pointer
Not a language change, just stating the facts.

Fixes #1793.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5488071
2011-12-13 17:22:11 -08:00
Joel Sing
7b5ae29afd syscall: regenerate z-files for openbsd
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5414053
2011-12-14 10:46:49 +11:00
Ian Lance Taylor
26239417bb runtime: Make gc_test test extra allocated space, not total space.
Testing total space fails for gccgo when not using split
stacks, because then each goroutine has a large stack, and so
the total memory usage is large.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5487068
2011-12-13 15:12:55 -08:00
Rob Pike
64776da456 bufio: make the minimum read buffer size 16 bytes.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/5485067
2011-12-13 15:07:17 -08:00
Russ Cox
5fe96c640a test/garbage: move to test/bench/garbage
(These are benchmarks for the garbage collector, not tests.)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5484070
2011-12-13 18:02:49 -05:00
Russ Cox
1161e1172b fix build, sorry
TBR=r
CC=golang-dev
https://golang.org/cl/5488066
2011-12-13 17:53:00 -05:00
Brad Fitzpatrick
39213c1fdb strconv: some allocation tests
R=rsc, r
CC=golang-dev
https://golang.org/cl/5477084
2011-12-13 14:49:26 -08:00
Russ Cox
bcbb2f93ee test/bench: move to test/bench/shootout
R=golang-dev, r, gri, bradfitz
CC=golang-dev
https://golang.org/cl/5487067
2011-12-13 17:46:54 -05:00
Florian Weimer
b1175bebd0 contribute.html: do not fill in the reviewer field
The golang-dev mailing list is added automatically.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5482060
2011-12-13 17:45:01 -05:00
Russ Cox
f4b430c90a A+C: Florian Weimer (individual CLA)
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5486056
2011-12-13 17:44:44 -05:00
Russ Cox
2572803899 math: delete non-Sqrt-based Hypot
I was confused by the existence of two portable Hypot
routines in the tree when I cleaned things up, and I made
ARM use the wrong (imprecise) one.  Use the right one,
and delete the wrong one.

Fixes arm build.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5485065
2011-12-13 17:08:56 -05:00
Russ Cox
2c6d3eaf78 undo CL 5414048 / f6b994f33cf4
breaks build

««« original CL description
http: close connection after printing panic stack trace
In a testing situation, it's possible for a local http
server to panic and the test exit without the stack trace
ever being printed.
Fixes #2480.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5414048

»»»

R=bradfitz
CC=golang-dev
https://golang.org/cl/5482061
2011-12-13 17:08:18 -05:00
Robert Griesemer
5fb7e5b482 go/printer, godoc: print comments in example code
- go/printer: support for printing CommentedNodes
- go/doc: collect comments from examples

Fixes #2429.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/5482052
2011-12-13 14:05:05 -08:00
Robert Griesemer
fe746335aa gofmt: simplify flags
-tabs replaces -tabindent
-spaces has been removed

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/5487066
2011-12-13 14:03:25 -08:00
Andrew Gerrand
0b0a6ec7ec gofix: add googlecode module for rewriting Google Code imports
goinstall: disallow googlecode.com import paths

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5421049
2011-12-14 08:46:26 +11:00
Roger Peppe
516168057e http: close connection after printing panic stack trace
In a testing situation, it's possible for a local http
server to panic and the test exit without the stack trace
ever being printed.
Fixes #2480.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5414048
2011-12-13 16:34:22 -05:00
Yasuhiro Matsumoto
19d064f68a gofix: add fix httputil
R=r, rsc, adg
CC=golang-dev
https://golang.org/cl/5364056
2011-12-13 16:23:06 -05:00
Yasuhiro Matsumoto
e62b40344d codereview: fix path slash issue.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5487057
2011-12-13 16:18:56 -05:00
Christopher Wedgwood
0e9ee93cea archive/tar: (test) structure comparison not reflect.DeepEqual
R=dsymonds
CC=golang-dev
https://golang.org/cl/5487064
2011-12-14 08:08:49 +11:00
Russ Cox
dd8dc6f059 math: regularize build
This will be nicer to the automatic tools.
It requires a few more assembly stubs
but fewer Go files.

There are a few instances where it looks like
there are new blobs of code, but they are just
being copied out of deleted files.

There is no new code here.

Suppose you have a portable implementation for Sin
and a 386-specific assembly one.  The old way to
do this was to write three files

sin_decl.go
   func Sin(x float64) float64  // declaration only
sin_386.s
   assembly implementation

sin_port.go
   func Sin(x float64) float64 { ... }  // pure-Go impl

and then link in either sin_decl.go+sin_386.s or
just sin_port.go.  The Makefile actually did the magic
of linking in only the _port.go files for those without
assembly and only the _decl.go files for those with
assembly, or at least some of that magic.

The biggest problem with this, beyond being hard
to explain to the build system, is that once you do
explain it to the build system, godoc knows which
of sin_port.go or sin_decl.go are involved on a given
architecture, and it (correctly) ignores the other.
That means you have to put identical doc comments
in both files.

The new approach, which is more like what we did
in the later packages math/big and sync/atomic,
is to have

sin.go
   func Sin(x float64) float64  // decl only
   func sin(x float64) float64 {...}  // pure-Go impl

sin_386.s
   // assembly for Sin (ignores sin)
sin_amd64.s
   // assembly for Sin: jmp sin
sin_arm.s
   // assembly for Sin: jmp sin

Once we abandon Makefiles we can put all the assembly
stubs in one source file, so the number of files will
actually go down.

Chris asked whether the branches cost anything.
Given that they are branching to pure-Go implementations
that are not typically known for their speed, the single
direct branch is not going to be noticeable.  That is,
it's on the slow path.

An alternative would have been to preserve the old
"only write assembly files when there's an implementation"
and still have just one copy of the declaration of Sin
(and thus one doc comment) by doing:

sin.go
   func Sin(x float64) float64 { return sin(x) }

sin_decl.go
   func sin(x float64) float64 // declaration only
sin_386.s
   // assembly for sin

sin_port.go
   func sin(x float64) float64 { portable code }

In this version everyone would link in sin.go and
then either sin_decl.go+sin_386.s or sin_port.go.

This has an extra function call on all paths, including
the "fast path" to get to assembly, and it triples the
number of Go files involved compared to what I did
in this CL.  On the other hand you don't have to
write assembly stubs.  After starting down this path
I decided that the assembly stubs were the easier
approach.

As for generating the assembly stubs on the fly, much
of the goal here is to eliminate magic from the build
process, so that zero-configuration tools like goinstall
or the new go tool can handle this package.

R=golang-dev, r, cw, iant, r
CC=golang-dev
https://golang.org/cl/5488057
2011-12-13 15:20:12 -05:00
Christopher Wedgwood
6f975fbb31 cypto/ocsp: fix tests
Actually compare the result with expected not itself

R=agl, bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5477079
2011-12-13 14:40:28 -05:00
Russ Cox
6e2c3ef428 go: implement doc, fmt, fix, list, vet
This CL is concerned with the basic Package structure
and applies it to the (trivial) implementations of the
doc, fmt, fix, list, and vet commands.

The command as a whole is still very much a work in progress.
In particular, work making the error messages look nice
is deferred to a future CL.

R=golang-dev, adg, dsymonds, r
CC=golang-dev
https://golang.org/cl/5482048
2011-12-13 14:28:41 -05:00
Russ Cox
969b71d906 build: disable cgo on Windows/amd64
Apparently it is broken.  Disable so that dashboard
will let us see other breakages on Windows.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5477081
2011-12-13 14:20:38 -05:00
Rob Pike
38df0459ae strconv: make QuoteRune etc. take a rune argument
Just an oversight it didn't already.
Fixes #2515.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5483064
2011-12-13 11:13:23 -08:00
Russ Cox
c0951e9f8b 5g: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/5482059
2011-12-13 14:12:16 -05:00
Rob Pike
02f6719d44 strconv: include package and function name in error strings
Fixes #2548.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5484062
2011-12-13 10:42:05 -08:00
Russ Cox
6bf84214c1 godoc: text wrapping
Example:

PACKAGE

package utf8
    import "unicode/utf8"

    Package utf8 implements functions and constants to support text
    encoded in UTF-8.  This package calls a Unicode character a rune for
    brevity.

CONSTANTS

const (
    RuneError = unicode.ReplacementChar // the "error" Rune or "replacement character".
    RuneSelf  = 0x80                    // characters below Runeself are represented as themselves in a single byte.
    UTFMax    = 4                       // maximum number of bytes of a UTF-8 encoded Unicode character.
)
    Numbers fundamental to the encoding.

FUNCTIONS

func DecodeLastRune(p []byte) (r rune, size int)
    DecodeLastRune unpacks the last UTF-8 encoding in p and returns the
    rune and its width in bytes.

func DecodeLastRuneInString(s string) (r rune, size int)
    DecodeLastRuneInString is like DecodeLastRune but its input is a
    string.

func DecodeRune(p []byte) (r rune, size int)
    DecodeRune unpacks the first UTF-8 encoding in p and returns the rune
    and its width in bytes.

func DecodeRuneInString(s string) (r rune, size int)
    DecodeRuneInString is like DecodeRune but its input is a string.

func EncodeRune(p []byte, r rune) int
    EncodeRune writes into p (which must be large enough) the UTF-8
    encoding of the rune.  It returns the number of bytes written.

func FullRune(p []byte) bool
    FullRune reports whether the bytes in p begin with a full UTF-8
    encoding of a rune.  An invalid encoding is considered a full Rune
    since it will convert as a width-1 error rune.

func FullRuneInString(s string) bool
    FullRuneInString is like FullRune but its input is a string.

func RuneCount(p []byte) int
    RuneCount returns the number of runes in p.  Erroneous and short
    encodings are treated as single runes of width 1 byte.

func RuneCountInString(s string) (n int)
    RuneCountInString is like RuneCount but its input is a string.

func RuneLen(r rune) int
    RuneLen returns the number of bytes required to encode the rune.

func RuneStart(b byte) bool
    RuneStart reports whether the byte could be the first byte of an
    encoded rune.  Second and subsequent bytes always have the top two
    bits set to 10.

func Valid(p []byte) bool
    Valid reports whether p consists entirely of valid UTF-8-encoded
    runes.

func ValidString(s string) bool
    ValidString reports whether s consists entirely of valid UTF-8-encoded
    runes.

TYPES

type String struct {
    // contains filtered or unexported fields
}
    String wraps a regular string with a small structure that provides
    more efficient indexing by code point index, as opposed to byte index.
    Scanning incrementally forwards or backwards is O(1) per index
    operation (although not as fast a range clause going forwards).
    Random access is O(N) in the length of the string, but the overhead is
    less than always scanning from the beginning.  If the string is ASCII,
    random access is O(1).  Unlike the built-in string type, String has
    internal mutable state and is not thread-safe.

func NewString(contents string) *String
    NewString returns a new UTF-8 string with the provided contents.

func (s *String) At(i int) rune
    At returns the rune with index i in the String.  The sequence of runes
    is the same as iterating over the contents with a "for range" clause.

func (s *String) Init(contents string) *String
    Init initializes an existing String to hold the provided contents.
    It returns a pointer to the initialized String.

func (s *String) IsASCII() bool
    IsASCII returns a boolean indicating whether the String contains only
    ASCII bytes.

func (s *String) RuneCount() int
    RuneCount returns the number of runes (Unicode code points) in the
    String.

func (s *String) Slice(i, j int) string
    Slice returns the string sliced at rune positions [i:j].

func (s *String) String() string
    String returns the contents of the String.  This method also means the
    String is directly printable by fmt.Print.

Fixes #2479.

R=golang-dev, dsymonds, mattn.jp, r, gri, r
CC=golang-dev
https://golang.org/cl/5472051
2011-12-13 13:33:40 -05:00
Russ Cox
61655bc513 gc: delete DUPOK definition
The relevant header is already included.

R=ken2
CC=golang-dev
https://golang.org/cl/5487062
2011-12-13 13:25:48 -05:00
Dave Cheney
2b600f77dd exp/ssh: improve client channel close behavior
R=gustav.paul
CC=golang-dev
https://golang.org/cl/5480062
2011-12-13 10:27:17 -05:00
Luuk van Dijk
7cf4825425 gc: small fixes to fmt.c
don't crash when printing error messages about symbols in a garbled state.
render OCOMPLIT in export mode.

R=rsc
CC=golang-dev
https://golang.org/cl/5466045
2011-12-13 09:15:46 +01:00
Luuk van Dijk
e1b1a5fea2 gc: fix use of stackallocated AST node in generation of static initialisation code.
Fixes #2529

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5483048
2011-12-13 09:09:10 +01:00
Rob Pike
5fa18e1061 doc/go1: time
R=rsc
CC=golang-dev
https://golang.org/cl/5477077
2011-12-12 21:08:03 -08:00
Rob Pike
f76bd4fe0f doc/go1: more package updates
Everything there (as first draft) except the time package.

R=golang-dev, adg, bradfitz
CC=golang-dev
https://golang.org/cl/5487052
2011-12-12 19:25:25 -08:00
Russ Cox
196b663075 gc: implement == on structs and arrays
To allow these types as map keys, we must fill in
equal and hash functions in their algorithm tables.
Structs or arrays that are "just memory", like [2]int,
can and do continue to use the AMEM algorithm.
Structs or arrays that contain special values like
strings or interface values use generated functions
for both equal and hash.

The runtime helper func runtime.equal(t, x, y) bool handles
the general equality case for x == y and calls out to
the equal implementation in the algorithm table.

For short values (<= 4 struct fields or array elements),
the sequence of elementwise comparisons is inlined
instead of calling runtime.equal.

R=ken, mpimenov
CC=golang-dev
https://golang.org/cl/5451105
2011-12-12 22:22:09 -05:00
Russ Cox
83f648c962 spec: allow comparison of structs, arrays containing comparable values
Also, clarify when interface comparison panics and
that comparison to nil is a special syntax rather than
a general comparison rule.

R=r, gri, r, iant, cw, bradfitz
CC=golang-dev
https://golang.org/cl/5440117
2011-12-12 22:21:46 -05:00
Nigel Tao
66113ac818 html: update comments to match latest spec.
R=dsymonds
CC=golang-dev
https://golang.org/cl/5482054
2011-12-13 14:20:26 +11:00
Nigel Tao
b9064fb132 html: a first step at parsing foreign content (MathML, SVG).
Nodes now have a Namespace field.

Pass adoption01.dat, test 12:
<a><svg><tr><input></a>

| <html>
|   <head>
|   <body>
|     <a>
|       <svg svg>
|         <svg tr>
|           <svg input>

The other adoption01.dat tests already passed.

R=andybalholm
CC=golang-dev
https://golang.org/cl/5467075
2011-12-13 13:52:47 +11:00