Commit Graph

5664 Commits

Author SHA1 Message Date
Rob Pike
6c08859b0e Effective Go: update ... discussion.
R=rsc
CC=golang-dev
https://golang.org/cl/1698041
2010-06-14 22:40:35 -07:00
Russ Cox
c9172fb2a3 runtime: correct fault for 16-bit divide on Leopard
R=r
CC=golang-dev
https://golang.org/cl/1703041
2010-06-14 18:07:17 -07:00
Rob Pike
177746ba31 fmt.Printf: write tests for %T.
Fix a bug that caused it to ignore field widths.

R=rsc
CC=golang-dev
https://golang.org/cl/1704041
2010-06-14 17:42:31 -07:00
Rob Pike
d482c163be fmt.Print*: reimplement to switch on type first.
This shortens, simplifies and regularizes the code significantly.
(Improvements to reflect could make another step.)
Passes all.bash.

One semantic change occurs: The String() method changes
behavior. It used to run only for string formats such as %s and %q.
Instead, it now runs whenever the item has the method and the
result is then processed by the format as a string. Besides the
regularization, this has three effects:

	1) width is honored for String() items
	2) %x works for String() items
	3) implementations of String that merely recur will recur forever

Regarding point 3, example from the updated documentation:
	type X int
	func (x X) String() string { return Sprintf("%d", x) }
should cast the value before recurring:
	func (x X) String() string { return Sprintf("%d", int(x)) }

R=rsc
CC=golang-dev
https://golang.org/cl/1613045
2010-06-14 17:16:35 -07:00
Nigel Tao
43b3a247d3 html: sync testdata/webkit to match WebKit tip.
R=rsc
CC=golang-dev
https://golang.org/cl/1701041
2010-06-15 09:07:47 +10:00
Rob Pike
dee4db0691 Add test for division by zero.
It fails with 6g. Once 6g is fixed up I will extend the value tests.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/1677043
2010-06-14 15:00:19 -07:00
Roger Peppe
18274e0075 Add IndexFunc and LastIndexFunc.
Change TrimRight and TrimLeft to use these functions.
Incidentally fix minor bug in TrimRight.
Add some test cases for this.
YMMV whether it's worth saving the closure allocation.

R=r, r2
CC=golang-dev, hoisie, rsc
https://golang.org/cl/1198044
2010-06-14 14:54:48 -07:00
Rob Pike
b9055629c1 tutorial: update discussion of variadic functions
R=rsc
CC=golang-dev
https://golang.org/cl/1677042
2010-06-14 12:27:22 -07:00
Russ Cox
d5a80d0ba4 gc: no more ...
various cleanup, deleting unused code

R=ken2
CC=golang-dev
https://golang.org/cl/1663041
2010-06-14 11:24:51 -07:00
Russ Cox
6672b40c09 remove uses of ... from tree, add one test
R=r
CC=golang-dev
https://golang.org/cl/1662041
2010-06-14 11:23:11 -07:00
Nigel Tao
44a17e9df7 exp/draw: small draw.drawGlyphOver optimization.
Make dpix variable names consistent.

R=rsc
CC=golang-dev
https://golang.org/cl/1563041
2010-06-14 16:49:43 +10:00
Russ Cox
9562592342 spec: remove ... (keeping ...T)
R=gri, iant, ken2, r, r2
CC=golang-dev
https://golang.org/cl/1632041
2010-06-12 11:37:13 -07:00
Russ Cox
76da2780c3 gc: less aggressive name binding, for better line numbers in errors
Cleans up a few other corner cases too.

R=ken2
CC=golang-dev
https://golang.org/cl/1592045
2010-06-12 11:17:24 -07:00
Russ Cox
53a529ab2b runtime: fix 386 signal handler bug
Cannot assume that g == m->curg at time of signal.
Must save actual g and restore.

Fixes flaky crashes with messages like

throw: malloc mlookup
throw: malloc/free - deadlock
throw: unwindstack on self
throw: free mlookup

(and probably others) when running cgo.

R=iant
CC=golang-dev
https://golang.org/cl/1648043
2010-06-12 10:48:04 -07:00
Russ Cox
9d72aaabda gopack: add S flag to force marking a package as safe
R=r
CC=golang-dev
https://golang.org/cl/1597044
2010-06-12 10:47:42 -07:00
Rob Pike
db8c2b1803 spec: clarify that result parameters are always zeroed before the function executes.
R=golang-dev
CC=golang-dev
https://golang.org/cl/1641043
2010-06-11 21:30:03 -07:00
Russ Cox
089da369a3 8l: correct test for sp == top of stack in 8l -K code
R=ken2
CC=golang-dev
https://golang.org/cl/1627042
2010-06-11 16:17:47 -07:00
Russ Cox
ee0bca35a4 gopack: simplify go metadata code
There's only one Go object file per package now,
so there's no need to parse the metadata and merge
metadata from multiple files.  Just save the original
and use it as __.PKGDEF verbatim.

R=r
CC=golang-dev
https://golang.org/cl/1647042
2010-06-11 15:29:19 -07:00
Russ Cox
d20ad1c75a gc: change -u to require imports to be marked safe
R=ken2
CC=golang-dev
https://golang.org/cl/1597043
2010-06-11 15:28:43 -07:00
Ian Lance Taylor
fe43325b30 Pad Go symbol table out to page boundary when linking dynamically.
This avoids a crash when using cgo where glibc's malloc thinks
that it can use some of the memory following the symbol table.
This fails because the symbol table is mapped read-only, which
affects the whole page.

R=rsc
CC=golang-dev
https://golang.org/cl/1616042
2010-06-11 13:41:49 -07:00
Alex Brainman
c1e20720f7 runtime: switch to OS stack during Windows syscall
R=rsc
CC=golang-dev
https://golang.org/cl/1381041
2010-06-11 01:38:12 -07:00
Alex Brainman
fdb460ec11 runtime: free lock handles on Windows
R=rsc
CC=golang-dev
https://golang.org/cl/1652041
2010-06-11 00:53:54 -07:00
Russ Cox
6cd8537fd1 test: check that surrogate pair runes and huge rune values are rejected
R=r
CC=golang-dev
https://golang.org/cl/1615042
2010-06-10 13:30:39 -07:00
Paolo Giarrusso
9eb806f80b .hgignore: ignore doc/htmlgen
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/1555042
2010-06-09 21:39:40 -07:00
Paolo Giarrusso
3ca72458ec codereview: avoid exception in match
R=rsc
CC=golang-dev
https://golang.org/cl/1585041
2010-06-09 21:37:11 -07:00
Russ Cox
19783ef482 A+C: James Whitehead and Paolo Giarrusso (both individual CLA)
R=r
CC=golang-dev
https://golang.org/cl/1649041
2010-06-09 21:25:13 -07:00
Rob Pike
62b5c7c69d add path.Base, analogous to Unix basename
R=rsc
CC=golang-dev
https://golang.org/cl/1633042
2010-06-09 19:59:22 -07:00
Adam Langley
5f0319c0a6 asn1: allow '*' in PrintableString.
Although technically incorrect, we want this in order to parse X.509
certificates where a wildcard hostname ("*.example.com") has been put
into a PrintableString.

Fixes #850.

R=rsc
CC=golang-dev
https://golang.org/cl/1615043
2010-06-09 20:52:41 -04:00
Robert Griesemer
fb279e7347 bug286: test case
R=r
CC=golang-dev
https://golang.org/cl/1644042
2010-06-09 16:05:00 -07:00
Robert Griesemer
e0e5c150b0 exp/eval test: fix build
R=r
CC=golang-dev
https://golang.org/cl/1599043
2010-06-09 15:52:42 -07:00
Robert Griesemer
ace5269dfe go/scanner: report illegal escape sequences
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/1636043
2010-06-09 15:19:22 -07:00
Andrew Gerrand
4032b7c5a1 release.2010-06-09 tag
R=rsc
CC=golang-dev
https://golang.org/cl/1626043
2010-06-09 23:13:01 +02:00
Andrew Gerrand
61be33d3ae release.2010-06-09
R=rsc
CC=golang-dev
https://golang.org/cl/1644041
2010-06-09 23:10:28 +02:00
Russ Cox
a2a7d473f4 gc: more cleanup
* disallow surrogate pair runes.
 * diagnose impossible type assertions
 * eliminate another static buffer.
 * do not overflow lexbuf.
 * add -u flag to disable package unsafe.

R=ken2
CC=golang-dev
https://golang.org/cl/1619042
2010-06-09 11:00:55 -07:00
Russ Cox
42a691b877 fix build: invalid character literals
R=r
CC=golang-dev
https://golang.org/cl/1631041
2010-06-08 22:32:04 -07:00
Russ Cox
565b5dc076 gc: new typechecking rules
* Code for assignment, conversions now mirrors spec.
* Changed some snprint -> smprint.
* Renamed runtime functions to separate
  interface conversions from type assertions:
  convT2I, assertI2T, etc.
* Correct checking of \U sequences.

Fixes #840.
Fixes #830.
Fixes #778.

R=ken2
CC=golang-dev
https://golang.org/cl/1303042
2010-06-08 18:50:02 -07:00
Russ Cox
6aaef04469 misc cleanup: gofmt + &x -> x[0:] conversion
R=gri
CC=golang-dev
https://golang.org/cl/1620042
2010-06-08 17:51:57 -07:00
Robert Griesemer
f29fb251dc go/printer: deleted dead code
(remains of the semicolon conversion)

R=rsc
CC=golang-dev
https://golang.org/cl/1623041
2010-06-08 17:46:04 -07:00
Robert Griesemer
4337c7c0bc gofmt: update test script so it can run to completion again
R=rsc
CC=golang-dev
https://golang.org/cl/1621041
2010-06-08 17:25:04 -07:00
Robert Griesemer
3f3ff2bd5c go/parser: correct position of empty statement ';'
(caused certain files to not be idempotent under gofmt)

- corrected golden files for go/printer
- slightly simplified some code in nodes.go (no impact on formatting)
- these changes have no impact on gofmt output of .go files under src, misc

fallthrough statement considered harmful!

R=rsc
CC=golang-dev
https://golang.org/cl/1593042
2010-06-08 17:06:26 -07:00
Russ Cox
f892540513 fix build
R=gri
CC=golang-dev
https://golang.org/cl/1616041
2010-06-08 16:14:19 -07:00
Russ Cox
104cd57c6d doc: add Google I/O talk and programs
R=r
CC=golang-dev
https://golang.org/cl/1614041
2010-06-08 16:00:04 -07:00
Russ Cox
57a62a8bcb bug284: make conversion legal, fix error patterns
R=gri
CC=golang-dev
https://golang.org/cl/1612041
2010-06-08 15:51:31 -07:00
Russ Cox
2ec58f73e3 bug285: delete invalid map assignment
*T2 implements I2, but T2 does not.

R=gri
CC=golang-dev
https://golang.org/cl/1613041
2010-06-08 15:50:53 -07:00
Robert Griesemer
98b27814ae gc: better error message when ~ operator is found
Fixes #844.

R=ken2, rsc, ken3
CC=golang-dev
https://golang.org/cl/1593041
2010-06-07 18:27:26 -07:00
Robert Griesemer
0c222d6e49 gc: backslash newline is not a legal escape sequence in strings
Fixes #827.

R=ken2
CC=golang-dev, rsc
https://golang.org/cl/1592041
2010-06-07 18:10:48 -07:00
Robert Griesemer
440cc95470 go spec: rename "assignment compatible" -> "assignable"
R=r, rsc
CC=golang-dev
https://golang.org/cl/1590041
2010-06-07 17:40:21 -07:00
Andrew Gerrand
9b3c743f82 http: add Head function for making HTTP HEAD requests
R=rsc
CC=golang-dev
https://golang.org/cl/1581041
2010-06-08 01:28:40 +02:00
Robert Griesemer
7bc03718f4 go spec: clean-up and consolidation of spec with implementation
Specifically:
- introduced notion of "underlying type"
- removed notion of type compatibility
- consolidated rules about assignment compatibility in
  assignment compatibility section
- be consistent with specyfing that nil is the value
  for uninitialized variables that can be nil (this
  was not specified clearly for pointers, functions, interfaces)
- added/fixed various related links throughout
- clarify language on conversions

R=rsc, r, iant, ken2
CC=golang-dev
https://golang.org/cl/1536041
2010-06-07 15:49:39 -07:00
Daniel Theophanes
129c6c14d1 runtime: finish pchw -> tiny, added gettime for tiny
R=rsc
CC=golang-dev
https://golang.org/cl/1514041
2010-06-07 14:18:42 -07:00