1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:21:22 -06:00
Commit Graph

730 Commits

Author SHA1 Message Date
Russ Cox
58f5f4f18d use separate lex buf for better errors:
package main
func main() { func(){}() + + }

x.go:2: syntax error near _f001

becomes

x.go:2: syntax error near func

R=ken
OCL=27047
CL=27047
2009-04-02 17:59:09 -07:00
Russ Cox
6b07021a2b implement some more 8g
package main
	func main() {
		println("hello,", 123);
	}

R=ken
OCL=27043
CL=27043
2009-04-02 16:48:06 -07:00
Ken Thompson
2450c590e9 typeswitch - expression evaluated
twice instead of once.

R=r
OCL=27015
CL=27015
2009-04-01 21:28:59 -07:00
Russ Cox
aacdc25399 fix http://b/1748082
package main
var f = func(a, b int) int { return a + b }

R=ken
OCL=26935
CL=26935
2009-03-30 22:26:00 -07:00
Russ Cox
5e792b6c09 move portable object routines (especially
signature generation) into gc.

R=ken
OCL=26933
CL=26933
2009-03-30 21:31:29 -07:00
Russ Cox
941ed00b1d closure bug: carry along outnamed flag.
R=ken
OCL=26930
CL=26930
2009-03-30 19:21:36 -07:00
Russ Cox
bac922c6e1 move portable code generation (basic statements) to gc.
R=ken
OCL=26929
CL=26929
2009-03-30 19:15:07 -07:00
Russ Cox
d30285a6f5 move some portable pieces of 6g/gsubr.c into gc/subr.c
int	brcom(int);
	int	brrev(int);
	void	setmaxarg(Type*);
	Sig*	lsort(Sig*, int(*)(Sig*, Sig*));
	int	dotoffset(Node*, int*, Node**);
	void	stringpool(Node*);
	void	tempname(Node*, Type*);

R=ken
OCL=26922
CL=26922
2009-03-30 17:52:21 -07:00
Russ Cox
8e54729b5a move alignment calculations into gc
R=ken
OCL=26914
CL=26914
2009-03-30 17:09:28 -07:00
Russ Cox
e224b1ebdb don't crash on
unsafe.Alignof(struct{x float}{0}.x)

R=ken
OCL=26911
CL=26913
2009-03-30 17:07:30 -07:00
Russ Cox
531f242f5d move bits.c from 6g to gc
R=ken
OCL=26909
CL=26909
2009-03-30 16:13:11 -07:00
Russ Cox
a2cbc2998d don't write cmp's output to the c file.
cope better with p4 not found.

R=r
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=26877
CL=26879
2009-03-30 00:12:56 -07:00
Ken Thompson
b8be809c10 ^ type(const) now inverts "enough" bits
^ signed(const) becomes illegal
^ unsigned(const) becomes legal

R=r
OCL=26697
CL=26697
2009-03-24 16:40:38 -07:00
Russ Cox
5a68303a15 throw away most of the compat.h compatibility layer
in favor of the lib9 compatibility layer.  no need for two.

now that mycreate is gone, .6 files are 0644 not 0755.

TBR=r
OCL=26679
CL=26679
2009-03-24 12:12:57 -07:00
Ken Thompson
79fa5b65cb rewrote switch
fixed bug 141

R=r
OCL=26627
CL=26627
2009-03-22 20:54:21 -07:00
Russ Cox
54aa835b44 range over channels.
also fix multiple-evaluation bug in range over arrays.

R=ken
OCL=26576
CL=26576
2009-03-20 11:32:58 -07:00
Russ Cox
f7772627ad fix b/1722502
BUG=1722502
R=ken
OCL=26526
CL=26526
2009-03-18 19:20:54 -07:00
Ken Thompson
1cdcfda140 remove assignment cases from switch
R=r
OCL=26480
CL=26480
2009-03-18 12:13:42 -07:00
Ken Thompson
1e0c17e294 switch on false error
R=r
OCL=26434
CL=26434
2009-03-17 19:10:32 -07:00
Ken Thompson
0f469a99a3 binary search on type switches.
new feature 'case nil:' in type switch
will match iff the interface is nil.

R=r
OCL=26404
CL=26404
2009-03-17 13:58:38 -07:00
Ken Thompson
5136a9e1f7 change format of Sigt and Sigi
to allow room for type hash
needed for log-time type switch.

R=r
OCL=26354
CL=26354
2009-03-16 15:27:08 -07:00
Russ Cox
5fbadf0bc3 warn -> yyerror in mparith.
close two more bugs.

R=ken
OCL=26226
CL=26226
2009-03-12 19:57:30 -07:00
Russ Cox
8f194bf5ff make 6g constants behave as ken proposes. (i hope.)
various bug fixes and tests involving constants.

test/const1.go is the major new test case.

R=ken
OCL=26216
CL=26224
2009-03-12 19:04:38 -07:00
Ken Thompson
6eb54cb05b chan flags close/closed installed
runtime not finished.

R=r
OCL=26217
CL=26217
2009-03-12 17:55:11 -07:00
Ken Thompson
bb02e481d2 added bitclear operators &^ and &^=
R=r
OCL=26152
CL=26152
2009-03-11 19:59:35 -07:00
Ken Thompson
767845b6fa bug 125
R=r
OCL=26146
CL=26146
2009-03-11 17:37:04 -07:00
Russ Cox
4eb7ceba58 complain when trying to put T into an interface
if T has pointer methods.  this is just a heuristic
but it catches the problem robert ran into and
lets me put the larger interface issues aside for
now.  found one bug in pretty.

R=ken
OCL=26141
CL=26141
2009-03-11 16:06:17 -07:00
Ian Lance Taylor
062d6998ab Add support for a -I option. -I DIR searches for packages in
DIR.

R=ken,rsc
DELTA=49  (41 added, 2 deleted, 6 changed)
OCL=26057
CL=26092
2009-03-10 20:03:31 -07:00
Ken Thompson
d27e9f528d bug086
R=r
OCL=26090
CL=26090
2009-03-10 19:16:31 -07:00
Ken Thompson
0c4f4587d7 bug with interaction of variables
declared in cases and heap allocation

R=r
OCL=26064
CL=26064
2009-03-10 16:49:34 -07:00
Ken Thompson
820f42d977 binary search for constant case statements.
R=r
OCL=25890
CL=25890
2009-03-07 17:33:42 -08:00
Ken Thompson
a4a10ed856 1. type switches
2. fixed fault on bug128
3. got rid of typeof
4. fixed bug in t,ok = I2T

R=r
OCL=25873
CL=25873
2009-03-06 17:50:43 -08:00
Russ Cox
af678a593d new approach for generating sysimport.c
(renamed to avoid any conflict with old p4 copies).

this approach doesn't require auto-generating
files also kept in p4, so it should be easier on
go users who don't sync very often.

this approach will be more work for go developers:
builtin.c needs to be copied to builtin.c.boot in p4
as new functions are added.  mkbuiltin does this
for certain $USERs to help us remember.

R=r
DELTA=343  (176 added, 162 deleted, 5 changed)
OCL=25803
CL=25805
2009-03-05 18:26:12 -08:00
Russ Cox
63985b489b bug085 bug129
R=ken
OCL=25787
CL=25791
2009-03-05 15:57:03 -08:00
Ken Thompson
bf983477a2 new switch implementation
in preparation of type switch.
no functional change (yet).

R=r
OCL=25784
CL=25788
2009-03-05 15:49:34 -08:00
Russ Cox
98b34e5bbd reject invalid map key types at compile time
R=ken
OCL=25720
CL=25720
2009-03-04 17:38:37 -08:00
Russ Cox
955638e2fb disallow ordinary-type.(T), as in spec.
R=ken
OCL=25705
CL=25705
2009-03-04 14:50:25 -08:00
Russ Cox
49cc649e59 back to T{x}, stricter handling of T(x) vs x.(T)
R=ken
DELTA=131  (60 added, 41 deleted, 30 changed)
OCL=25617
CL=25633
2009-03-03 08:41:02 -08:00
Ken Thompson
a665e2924c bug with select :=
R=r
OCL=25278
CL=25278
2009-02-21 12:41:34 -08:00
Russ Cox
ebc10db3e1 allow parens to disambiguate types.
examples:

	chan <- (chan int)
	chan (<- chan int)
	(map[string]func())("a": main)

R=ken
OCL=25151
CL=25151
2009-02-18 10:07:46 -08:00
Ken Thompson
3c0fc400fb fix unsafe.Sizeof("abc")
R=rsc
OCL=25105
CL=25105
2009-02-17 13:10:57 -08:00
Russ Cox
d3d0c256be bug123
R=ken
OCL=25075
CL=25075
2009-02-16 17:44:05 -08:00
Russ Cox
b4af09ab56 embedded interface types in interfaces.
R=ken
OCL=25072
CL=25072
2009-02-16 16:36:18 -08:00
Russ Cox
3b3e63735e bug fix for &x[0] when x is slice
R=ken
OCL=25044
CL=25044
2009-02-15 13:15:46 -08:00
Russ Cox
07244f7c80 add composite literal ( ) syntax.
warn about composite literal { } syntax.

R=ken
OCL=25018
CL=25023
2009-02-13 14:48:16 -08:00
Russ Cox
5f4f5647ef require type assertions when narrowing.
R=ken
OCL=24350
CL=24914
2009-02-11 17:57:29 -08:00
Russ Cox
73dd4a37f9 fix export bug Rob tripped over.
the lexer is already hiding names,
so this clumsy hack is no longer necessary.

R=ken
OCL=24783
CL=24783
2009-02-10 13:57:31 -08:00
Ian Lance Taylor
651972b31f Implement unsafe.Alignof.
R=ken
DELTA=20  (19 added, 0 deleted, 1 changed)
OCL=24719
CL=24771
2009-02-10 11:46:26 -08:00
Russ Cox
a81870badf add error to catch 6g alignment bug.
the fix appears to be to align the
out struct on an 8 boundary, but that
is a bit involved.

R=ken
OCL=24657
CL=24657
2009-02-08 11:19:45 -08:00
Russ Cox
a6c59ce274 gc funarg return fix.
change type (to satisfy OAS) after nodarg:
nodarg uses offset from type too,
and must use correct offset.

R=ken
OCL=24656
CL=24656
2009-02-08 11:01:52 -08:00
Rob Pike
8f2b774ee1 update sysimport.c for unsafe.Offset and Sizeof
R=ken
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=24643
CL=24643
2009-02-07 14:48:32 -08:00
Ken Thompson
8a70545b57 unsafe.Sizeof and unsafe.Offsetof
R=r
OCL=24639
CL=24639
2009-02-07 12:34:45 -08:00
Russ Cox
0970c46863 closures - 6g support
R=ken
OCL=24501
CL=24566
2009-02-06 13:47:10 -08:00
Russ Cox
b0009bef20 bug064
make f(g()) work when g returns multiple
args with names different than f expects.

func swap(a, b int) (c, d int) {
	return b, a
}

swap(swap(1,2))

R=ken
OCL=24474
CL=24476
2009-02-05 15:22:49 -08:00
Russ Cox
aab26a5248 do not generate Init proto for sys and unsafe.
R=ken
OCL=24455
CL=24455
2009-02-05 14:49:53 -08:00
Russ Cox
5e2c05877d allow methods on funcs.
R=ken
OCL=24442
CL=24442
2009-02-05 13:33:07 -08:00
Russ Cox
360f0aacee fix interface not satisifed message:
x.go:13: T is not I - missing M()

NOT
x.go:13: T is not I - missing Mfunc()

R=ken
OCL=24316
CL=24316
2009-02-04 10:37:11 -08:00
Rob Pike
6e395cfecf slightly better code for the frog fix
R=ken
OCL=24025
CL=24025
2009-01-31 16:44:52 -08:00
Rob Pike
2538cf747b Complain about control characters that are not white space.
Bitten by invisible chars too many times.

R=ken
OCL=24024
CL=24024
2009-01-31 16:42:10 -08:00
Russ Cox
9e735985d4 avoid memcpy(x, x),
which valgrind complains about.

R=ken
OCL=23990
CL=23990
2009-01-30 16:31:26 -08:00
Russ Cox
4a43198390 update compiler to new func rules
R=ken
OCL=23958
CL=23961
2009-01-30 14:39:42 -08:00
Russ Cox
391425ae55 if take address of local, move to heap.
heuristic to not print bogus strings.
fix one error message format.

R=ken
OCL=23849
CL=23851
2009-01-29 17:38:58 -08:00
Russ Cox
282bf8cc8c fix possible infinite recursion in eqtype.
don't use intermediate register to move
32-or-fewer-bit immediate constants
into memory.

R=ken
OCL=23726
CL=23726
2009-01-28 16:42:26 -08:00
Russ Cox
3ec4675220 clean up range grammar
R=ken
OCL=23712
CL=23714
2009-01-28 15:41:50 -08:00
Ken Thompson
4b8e030762 bug 135
R=r
OCL=23646
CL=23646
2009-01-27 18:21:03 -08:00
Russ Cox
743ac07cc3 change dotdotdot interfaces to be structs,
not pointers to structs.

fix defered dotdotdot.

R=r,ken
DELTA=25  (7 added, 5 deleted, 13 changed)
OCL=23620
CL=23625
2009-01-27 15:05:25 -08:00
Ken Thompson
1e1cc4eb57 defer
R=r
OCL=23592
CL=23592
2009-01-27 12:03:53 -08:00
Russ Cox
5b129cda5f assignment count mismatch: 2 = 1.
R=ken
OCL=23534
CL=23534
2009-01-26 17:20:29 -08:00
Russ Cox
f1fe21a08f bug134
R=ken
OCL=23532
CL=23532
2009-01-26 17:06:20 -08:00
Russ Cox
4efad58d0a bug133
R=ken
OCL=23528
CL=23528
2009-01-26 16:57:24 -08:00
Russ Cox
3c5f3a8641 print(map) and print(chan) as pointers.
R=ken
OCL=23520
CL=23520
2009-01-26 15:36:28 -08:00
Ken Thompson
7859ae8a2f removed a:b in range syntax
added another channel test

R=r
OCL=23488
CL=23488
2009-01-26 11:34:38 -08:00
Russ Cox
a7f6d4066e implement new restrictions on what
can be compared/hashed.

R=r
DELTA=351  (201 added, 80 deleted, 70 changed)
OCL=23423
CL=23481
2009-01-26 09:56:42 -08:00
Russ Cox
1f8a40d85c move math routines from package sys to package math,
though they still build in src/runtime.

use cgo instead of hand-written wrappers.

R=r
DELTA=740  (289 added, 300 deleted, 151 changed)
OCL=23326
CL=23331
2009-01-22 16:23:44 -08:00
Russ Cox
61590c4c44 disallow P.t for lowercase t and not our package P.
implement hiding lowercase methods m in
signatures by adding in a hash of the package name
to the type hash code.

remove remaining checks for internally-generated _ names:
they are all gone.

R=ken
OCL=23236
CL=23238
2009-01-21 14:51:57 -08:00
Russ Cox
35e37bbf41 6g: better genembedtramp fatal error,
and don't put inaccessible private methods
   in signature.

R=ken
OCL=23138
CL=23140
2009-01-20 15:36:57 -08:00
Russ Cox
839a68469b delete export
TBR=r
OCL=23121
CL=23127
2009-01-20 14:40:40 -08:00
Russ Cox
0183baaf44 * delete export
* rename init functions

R=ken
OCL=23122
CL=23126
2009-01-20 14:40:00 -08:00
Russ Cox
aec4d3194a disallow other package's names in method calls
R=ken
OCL=22999
CL=22999
2009-01-16 15:35:07 -08:00
Russ Cox
06869eedf9 disallow other package's names in struct field dot.
R=ken
OCL=22996
CL=22996
2009-01-16 15:25:52 -08:00
Russ Cox
360962420c casify, cleanup sys
R=r
OCL=22978
CL=22984
2009-01-16 14:58:14 -08:00
Russ Cox
dec12d3654 re-export of bools was changing
format from hex to decimal, confusing
ar's strcmp-based value comparison.

switched export format to "true" or "false"
to keep bools separate from ints.

R=ken
OCL=22944
CL=22944
2009-01-16 10:45:28 -08:00
Russ Cox
c1e7e270f1 don't crash on:
package main
var x int
type x struct { a int }

R=ken
OCL=22903
CL=22903
2009-01-15 17:32:31 -08:00
Russ Cox
605d0746c5 catch export on func.
print names in message.

R=ken
OCL=22891
CL=22891
2009-01-15 16:43:51 -08:00
Russ Cox
3decb42e6f add warning for export of lowercase too.
R=ken
OCL=22887
CL=22887
2009-01-15 16:20:21 -08:00
Russ Cox
07d344e442 remove export name-list statement.
make package local the default.
warn about name case not matching export keyword.

R=ken
OCL=22881
CL=22886
2009-01-15 16:16:52 -08:00
Russ Cox
a3ed4e716a add sys.caller
R=r
DELTA=139  (101 added, 38 deleted, 0 changed)
OCL=22462
CL=22466
2009-01-09 15:52:43 -08:00
Russ Cox
ae167bf08f clean up automatic indirect, delete some dead code.
R=ken
OCL=22454
CL=22457
2009-01-09 15:21:41 -08:00
Russ Cox
316d377ac2 now that TCHAN, TMAP, and TSTRING are real types,
can do methods on them without pointer worries.

R=ken
OCL=22434
CL=22436
2009-01-09 13:50:58 -08:00
Russ Cox
a91af04c06 6g cleanup suggested by ken.
remove TPTR wrapper around TMAP, TCHAN, TSTRING.

R=ken
OCL=22406
CL=22409
2009-01-09 11:13:39 -08:00
Russ Cox
484ba939d2 update sys.reflect and sys.unreflect to accomodate
the possibility of large objects in interface values.

R=r
DELTA=171  (97 added, 22 deleted, 52 changed)
OCL=22382
CL=22382
2009-01-09 00:17:46 -08:00
Russ Cox
e512481b17 second pass on interface fixes and tests.
R=ken
OCL=22370
CL=22372
2009-01-08 18:06:06 -08:00
Russ Cox
1b7881adb4 fix:
type T []int
	var a []int
	var t = T(a)

R=ken
OCL=22341
CL=22341
2009-01-08 15:01:22 -08:00
Russ Cox
c0b8a7965a typo
R=ken
OCL=22327
CL=22327
2009-01-08 14:31:11 -08:00
Russ Cox
20595ac4b0 many interface bug fixes.
also, after
	func g() (int, int)
	func f(int, int)
allow
	f(g())
and
	func h() (int, int) { return g() }

R=ken
DELTA=356  (252 added, 26 deleted, 78 changed)
OCL=22319
CL=22325
2009-01-08 14:30:00 -08:00
Ken Thompson
eed3addb9d more
R=r
OCL=22240
CL=22240
2009-01-07 15:54:08 -08:00
Ken Thompson
3f135be389 conversion from closed array to slice
R=r
OCL=22236
CL=22236
2009-01-07 15:26:11 -08:00
Ken Thompson
c458c98388 [...] bug
R=r
OCL=22218
CL=22218
2009-01-07 13:20:10 -08:00
Russ Cox
855495eab6 iscomposite test in OCONV is unnecessary
now that OCOMP exists

R=ken
OCL=22216
CL=22216
2009-01-07 12:39:48 -08:00
Ken Thompson
179af0bb19 clear automatic arrays created with literals
R=r
OCL=22215
CL=22215
2009-01-07 12:28:23 -08:00
Ken Thompson
b0f627a6e1 closed arrays including [...]
R=r
OCL=22182
CL=22182
2009-01-06 17:31:24 -08:00
Russ Cox
84953bdaa8 fix newfn
R=ken
OCL=22173
CL=22173
2009-01-06 15:39:28 -08:00
Russ Cox
dabdfa6cce new new &Point{1,2}
R=ken
OCL=22168
CL=22168
2009-01-06 15:24:12 -08:00
Ken Thompson
88b5c5f0f8 make for slice/map/chan
new for pointers

R=r
OCL=22158
CL=22158
2009-01-06 14:52:26 -08:00
Russ Cox
859ba57bbb make acid build with bison.
ask for bison explicitly in cc, gc to try to
avoid problems with other yaccs that
might be installed.

R=r
DELTA=29  (10 added, 2 deleted, 17 changed)
OCL=22110
CL=22113
2009-01-06 09:53:30 -08:00
Russ Cox
2d259c817a add comments and delete dead code
R=ken
OCL=22078
CL=22080
2009-01-05 17:32:23 -08:00
Ken Thompson
b2dfd787d7 allow slices (open arrays) to be
receivers in methods.
put back original code for hilbert/bignum

R=r
OCL=21910
CL=21920
2008-12-30 14:02:20 -08:00
Ken Thompson
85815fe0ad diagnostic to catch pointer to
rvalue promoted to method receiver.
fixes to bignum that failed.

R=r
OCL=21827
CL=21827
2008-12-26 14:42:20 -08:00
Russ Cox
af5e16cfd9 fix new(T) if type T []int.
make sure type of expr is T not just []int

R=ken
OCL=21688
CL=21688
2008-12-20 16:30:44 -08:00
Russ Cox
c3077f7606 [] and struct in interfaces.
other [] cleanup.

convert() is gone.

R=r
DELTA=352  (144 added, 68 deleted, 140 changed)
OCL=21660
CL=21662
2008-12-19 17:11:54 -08:00
Ken Thompson
6fa74e0973 portability bug
cant assign to closed array

R=r
OCL=21634
CL=21634
2008-12-19 14:04:25 -08:00
Russ Cox
cd40cd2435 fix new(bool) error message
R=ken
OCL=21616
CL=21616
2008-12-19 12:18:44 -08:00
Russ Cox
eee50ae1ac chan and map of [] and struct
R=r
DELTA=192  (145 added, 8 deleted, 39 changed)
OCL=21609
CL=21614
2008-12-19 12:05:22 -08:00
Russ Cox
cbff09d666 g4 open sysimport.c before writing it
R=r
DELTA=1  (1 added, 0 deleted, 0 changed)
OCL=21577
CL=21603
2008-12-19 09:03:44 -08:00
Russ Cox
c4416ac06b new error messages
x.go:11: illegal types for operand: AS
	*I
	*T
	(*interface vs *struct)

R=r
DELTA=10  (8 added, 0 deleted, 2 changed)
OCL=21457
CL=21602
2008-12-19 09:03:24 -08:00
Russ Cox
dc7b2e98d2 compiler changes for *chan -> chan; *map -> map; new(T) -> new(*T)
mainly a syntactic change: the compiler representations don't change
(chan and map are now hidden pointers like string).

R=ken
OCL=21578
CL=21582
2008-12-19 03:05:54 -08:00
Russ Cox
d47d888ba6 convert *[] to [].
R=r
OCL=21563
CL=21571
2008-12-18 22:37:22 -08:00
Ken Thompson
9786f69f74 print(array)
R=r
OCL=21570
CL=21570
2008-12-18 22:17:05 -08:00
Russ Cox
f38d2b80a4 new []int literal
R=ken
OCL=21568
CL=21568
2008-12-18 21:59:12 -08:00
Ken Thompson
dcc064fe94 cmp [] to nil
R=r
OCL=21567
CL=21567
2008-12-18 21:33:45 -08:00
Russ Cox
78fc888e64 another [] fix
R=ken
OCL=21566
CL=21566
2008-12-18 21:15:26 -08:00
Russ Cox
92f74ca7e2 [] fixes
R=ken
OCL=21565
CL=21565
2008-12-18 21:11:56 -08:00
Ken Thompson
4026500d18 arrays
R=r
OCL=21564
CL=21564
2008-12-18 20:06:28 -08:00
Russ Cox
697cb17b30 trailing white space
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=21403
CL=21415
2008-12-17 10:14:29 -08:00
Russ Cox
e53d5ad620 fix type/name thing, again
R=r
DELTA=8  (7 added, 0 deleted, 1 changed)
OCL=21379
CL=21379
2008-12-16 17:45:28 -08:00
Russ Cox
99435cac09 another "want type got name" error case
R=ken
OCL=21377
CL=21377
2008-12-16 17:37:07 -08:00
Ken Thompson
ae5a475e20 range clause must have = or :=
:= illegal in for-increment

R=r
OCL=21204
CL=21204
2008-12-15 13:44:27 -08:00
Ken Thompson
42d89ac02c even more code improvement
R=r
OCL=21160
CL=21160
2008-12-14 18:45:00 -08:00
Ken Thompson
e683fb7a54 bug104
R=r
OCL=21082
CL=21082
2008-12-12 13:10:36 -08:00
Ken Thompson
c7ab332744 restrict declarations of type map/chan/string
(they must be pointers)

R=r
OCL=21009
CL=21009
2008-12-11 16:09:45 -08:00
Russ Cox
73653841af reject struct to interface conversion for now
R=ken
OCL=21007
CL=21007
2008-12-11 15:56:13 -08:00
Russ Cox
fa945d5bf8 fix race with fresh perforce checkouts
R=r
DELTA=15  (9 added, 0 deleted, 6 changed)
OCL=20977
CL=20981
2008-12-11 11:58:45 -08:00
Russ Cox
cb64ec5bb6 only generate non-trivial signatures in the
file in which they occur.  avoids duplicate
trampoline generation across multiple files.

R=ken
OCL=20976
CL=20980
2008-12-11 11:54:33 -08:00
Ken Thompson
5f1a3be9dd bug120
R=r
OCL=20921
CL=20921
2008-12-10 14:17:24 -08:00
Ken Thompson
7dd62cb3bc 2 minor bugs
R=r
OCL=20906
CL=20906
2008-12-10 12:38:16 -08:00
Ken Thompson
57bd0da375 bug126
R=r
OCL=20879
CL=20879
2008-12-09 18:31:31 -08:00
Ken Thompson
8bce3b5658 bug127
R=r
OCL=20874
CL=20874
2008-12-09 17:52:41 -08:00
Ken Thompson
92a1190c6c robs bug converting unsafe.pointer
R=r
OCL=20834
CL=20834
2008-12-09 13:00:50 -08:00
Ken Thompson
bf6164719a conversion to/from
any pointer or uintptr
and unsafe.pointer

R=r
OCL=20795
CL=20795
2008-12-08 20:50:17 -08:00
Ken Thompson
1d4daa2d39 foundation for import unsafe
R=r
OCL=20794
CL=20794
2008-12-08 19:46:39 -08:00
Ken Thompson
b79272d9a2 allowed syntax for range
a range m (implies :=)
a,b range m (implies :=)
a:b range m (implies :=)

a := range m
a,b := range m
a:b := range m

a = range m
a,b = range m
a:b = range m

R=r
OCL=20676
CL=20676
2008-12-06 13:40:30 -08:00
Ken Thompson
26b357ca5b range statement
R=r
OCL=20667
CL=20667
2008-12-05 18:24:05 -08:00
Ken Thompson
a0a14b98fa empty switches -- bug128
R=r
OCL=20520
CL=20522
2008-12-04 16:05:40 -08:00
Ken Thompson
c597845e13 const/var/iota declarations as discussed
R=r
OCL=20506
CL=20506
2008-12-04 15:33:40 -08:00
Russ Cox
bf3dd3f0ef add mutex.Mutex
R=r
DELTA=349  (348 added, 0 deleted, 1 changed)
OCL=20380
CL=20472
2008-12-04 12:51:36 -08:00
Ken Thompson
f8797daa9f import/export of exact mp floating constants
new syntax for exact mp floating constants
     decimal_int ( "p" | "P" ) [ "+" | "-" ] decimal_int
     the value is decimal1 * 2^decimal2

R=r
OCL=20357
CL=20357
2008-12-03 13:17:26 -08:00
Ken Thompson
89996e1fb1 truncating of float constants when
used in float64 or float32 contexts

R=r
OCL=20297
CL=20297
2008-12-02 17:03:47 -08:00
Russ Cox
28a30254e7 remove reference to non-existent mparith.h
R=ken
OCL=20188
CL=20188
2008-12-01 17:35:15 -08:00
Ken Thompson
3fa4610601 multi precision floating point
R=r
OCL=20185
CL=20185
2008-12-01 17:22:05 -08:00
Rob Pike
d7c1048771 really restore helpful error rules
R=rsc
OCL=19929
CL=19929
2008-11-24 14:23:53 -08:00
Rob Pike
46f89d53c6 restore helpful error rules
R=rsc
OCL=19928
CL=19928
2008-11-24 14:15:53 -08:00
Ken Thompson
8e3fe10ee3 1. retract general field names
2. array bounds bug
3. ... optimization bug

R=r
OCL=19927
CL=19927
2008-11-24 14:01:12 -08:00
Ken Thompson
ffafad1919 setup for keywords in fieldnames
R=r
OCL=19883
CL=19883
2008-11-23 15:58:48 -08:00
Ken Thompson
e081f25c3e reg and peep
R=r
OCL=19871
CL=19871
2008-11-22 17:58:53 -08:00
Russ Cox
67addd4e11 symbol table changes
* add gotype string to symbol table
	* fill in gotype in 6l for known funcs/vars
	* print gotype with nm -t

	* load symbol and pc/ln tables into memory at magic address 0x99<<32.
	* add sys.symdat() to retrieve raw bytes of symbol table
	  and pc/ln table.

most of this should be considered experimental
and subject to change.

R=r
DELTA=157  (128 added, 0 deleted, 29 changed)
OCL=19746
CL=19750
2008-11-20 17:32:18 -08:00
Russ Cox
10002bb0fb accept empty list of package imports.
R=ken
OCL=19617
CL=19617
2008-11-19 14:27:48 -08:00
Russ Cox
63a84348cc look for .6 before .a; accept archives with 0 length __.SYMDEF
TBR=r
OCL=19612
CL=19612
2008-11-19 14:21:44 -08:00
Russ Cox
4656686cf5 use correct lineno in nod even if yacc has looked ahead.
makes lineno correct for statements without semicolons.

R=ken
OCL=19454
CL=19454
2008-11-18 09:32:05 -08:00
Russ Cox
a1585b676b fix the easy parts of bug120
R=r,ken
DELTA=66  (52 added, 3 deleted, 11 changed)
OCL=19386
CL=19389
2008-11-17 13:58:45 -08:00
Russ Cox
9c7b064043 fix bugs in package locals
R=ken
OCL=19299
CL=19299
2008-11-14 17:31:29 -08:00
Russ Cox
d3f6093931 package-local declarations using keyword "package".
R=r
DELTA=129  (81 added, 0 deleted, 48 changed)
OCL=19283
CL=19291
2008-11-14 16:35:08 -08:00
Ken Thompson
e875055461 switch
R=r
OCL=19288
CL=19288
2008-11-14 16:24:27 -08:00
Rob Pike
2f4d35ffb9 converting uint bits back into floats
R=rsc
DELTA=32  (32 added, 0 deleted, 0 changed)
OCL=19084
CL=19091
2008-11-12 11:51:34 -08:00
Russ Cox
b682f924d7 don't try interface/structure conversion until
last resort, because it assumes every call is a
real use of the conversion.

R=ken
OCL=19026
CL=19026
2008-11-11 15:55:32 -08:00
Russ Cox
792145723e width fixes.
* check for uncomputed struct offsets
* distinguish function structs from ordinary structs
* make sure function structs are not examined in isolation

R=ken
OCL=19005
CL=19005
2008-11-11 13:46:55 -08:00
Rob Pike
335a5236e7 add sys.float32bits, sys.float64bits
R=rsc
DELTA=21  (21 added, 0 deleted, 0 changed)
OCL=18709
CL=18718
2008-11-06 15:48:36 -08:00
Russ Cox
0eda21a2fd change minimum sethi/ullman number to 1
to distinguish not computed (0) vs trivial (1).

add missing ullmancalc on function args.

R=ken
OCL=18711
CL=18711
2008-11-06 14:50:58 -08:00
Russ Cox
9906bfc7bb 6g ninit fixes - fixes the two test cases
i isolated last night.  does not fix rob's
interface-smashing bug.

R=ken
OCL=18698
CL=18698
2008-11-06 13:31:13 -08:00
Ken Thompson
79fbbe37a7 select default
R=r
OCL=18646
CL=18646
2008-11-05 21:50:28 -08:00
Russ Cox
553c98dca4 fix renamed-package bug in exported names:
always show original name

R=ken
OCL=18603
CL=18603
2008-11-05 15:59:34 -08:00
Ken Thompson
83a798513c more on t,ok = I.(T)
R=r
OCL=18599
CL=18599
2008-11-05 15:33:01 -08:00
Ken Thompson
a8b56a73a4 T,ok = I.(T)
R=r
OCL=18580
CL=18582
2008-11-05 14:27:07 -08:00
Russ Cox
1983121bbb 6g interface changes:
* allow conversion between nil interface and any type.
	* mark signatures as DUPOK so that multiple .6 can
	  contain sigt.*[]byte and only one gets used.

R=ken
OCL=18538
CL=18542
2008-11-05 11:27:50 -08:00
Russ Cox
e5d9a5c9f0 runtime support for interface ok,
whatever the final syntax ends up being.

R=ken
OCL=18414
CL=18414
2008-11-03 17:34:37 -08:00
Russ Cox
47caf6424c 6l: generate gotypesigs on demand.
add sys.unreflect, which uses gotypesigs.

R=r
DELTA=170  (152 added, 12 deleted, 6 changed)
OCL=18396
CL=18404
2008-11-03 16:03:12 -08:00
Russ Cox
c249a8de32 rename various magic names.
sigi and sigt:
	sys·sigi_inter -> sigi·inter
	sys·sigt_int -> sigt·int
	Package·sigt_Type -> sigt·Package.Type

	local type T in file x.go T_x -> T·x
	second one T_x_1 -> T·x·1

	method names M on T  T_M -> T·M

correctly handle local embedded types

init functions are the only place left that use underscores

R=ken
OCL=18377
CL=18377
2008-11-03 15:36:08 -08:00
Ken Thompson
90e5574f1c treat ... as agreed
only unencapsulated if passing one ddd
argument to one ddd parameter.

R=r
OCL=18376
CL=18376
2008-11-03 15:32:49 -08:00
Russ Cox
6b05518553 silence gcc warnings
R=ken
OCL=18348
CL=18348
2008-11-03 13:09:30 -08:00
Ken Thompson
2fef4c7198 DOTDOTDOT import/export
R=r
OCL=18319
CL=18319
2008-11-01 16:52:12 -07:00
Ken Thompson
74427c6346 DOTDOTDOT
R=r
OCL=18317
CL=18317
2008-11-01 16:36:46 -07:00
Russ Cox
8a1ad75644 make %Z handle embedded NULs; remove fixed-size buffer
R=r
DELTA=44  (2 added, 15 deleted, 27 changed)
OCL=18270
CL=18273
2008-10-31 14:57:57 -07:00
Russ Cox
57804f1d2d escape \ in %Z
R=ken
OCL=18202
CL=18202
2008-10-30 17:28:33 -07:00
Russ Cox
4958d41d3b change from $$ to \n$$ for .6 meta section delimiter
R=r
DELTA=13  (5 added, 0 deleted, 8 changed)
OCL=18190
CL=18192
2008-10-30 16:33:50 -07:00
Russ Cox
dc6bd11ce8 make %Z escape "
R=ken
OCL=18180
CL=18180
2008-10-30 15:35:56 -07:00
Russ Cox
f2b1536328 annotations on embedded types
R=ken
OCL=18179
CL=18179
2008-10-30 15:29:55 -07:00
Russ Cox
1850b29da6 struct annotations in imports.
distribute tag across multiple names.

R=ken
OCL=18178
CL=18178
2008-10-30 15:25:26 -07:00
Russ Cox
f27aaf4819 structure field annotation strings
R=ken
OCL=18176
CL=18176
2008-10-30 15:13:09 -07:00
Ken Thompson
2c050571d8 shift bugs
R=r
OCL=18095
CL=18095
2008-10-29 20:25:34 -07:00
Ken Thompson
2f5a05a859 bug 113
R=r
OCL=18081
CL=18081
2008-10-29 16:55:52 -07:00
Ken Thompson
4fdf3d6247 bug 113
R=r
OCL=18077
CL=18077
2008-10-29 16:38:23 -07:00
Ken Thompson
4a3ce5f19e sigt_int
R=r
OCL=18030
CL=18030
2008-10-29 13:40:00 -07:00
Ken Thompson
89f341db23 new(chan)
R=r
OCL=18027
CL=18027
2008-10-29 13:18:21 -07:00
Ken Thompson
c21d9a1ec9 the end of life as we know it
int is new type

R=r
OCL=18023
CL=18023
2008-10-29 12:46:44 -07:00
Russ Cox
b5c739bd1b Uncomment the name/type error checking.
R=ken
OCL=17928
CL=17928
2008-10-28 01:02:33 -07:00
Ken Thompson
e8278bcb29 allow len := 0
R=r
OCL=17869
CL=17869
2008-10-26 14:04:09 -07:00
Ken Thompson
a3cdd2e802 bug
R=r
OCL=17853
CL=17853
2008-10-25 14:24:51 -07:00
Ken Thompson
6d3d56d55a bug
R=r
OCL=17852
CL=17852
2008-10-25 13:50:18 -07:00
Ken Thompson
b642cf8c00 embedded methods
R=r
OCL=17851
CL=17851
2008-10-25 13:31:25 -07:00
Ken Thompson
b379d54dea another step toward interface subtypes
put explicit ./ on some runtime tests

R=r
OCL=17839
CL=17839
2008-10-24 20:14:28 -07:00
Russ Cox
689b28fd96 fix method function type compare bug (again)
R=ken
OCL=17819
CL=17819
2008-10-24 14:56:54 -07:00
Russ Cox
c14c961ae4 Automated g4 rollback of changelist 17815.
*** Reason for rollback ***

  now it's comparing function parameter names...

*** Original change description ***

fix method function type compare bug

R=ken
OCL=17816
CL=17816
2008-10-24 14:32:48 -07:00
Russ Cox
0be746d581 fix method function type compare bug
R=ken
OCL=17815
CL=17815
2008-10-24 14:29:01 -07:00
Ken Thompson
7ed8fc611d embedded types
auto & on methods

R=r
OCL=17682
CL=17682
2008-10-22 18:18:08 -07:00
Russ Cox
ad48706a24 do not use fake names on anonymous function return values
R=ken
OCL=17679
CL=17679
2008-10-22 17:45:47 -07:00
Ken Thompson
6fecb76eea embedded types
R=r
OCL=17676
CL=17676
2008-10-22 17:25:10 -07:00
Russ Cox
21617250f4 import/export of embedded types
R=ken
OCL=17643
CL=17643
2008-10-22 13:22:56 -07:00
Russ Cox
40fa690d75 fix handling of *f() = 1
R=ken
OCL=17625
CL=17641
2008-10-22 13:13:01 -07:00
Ken Thompson
14c639161a elided dots
R=r
OCL=17601
CL=17601
2008-10-21 20:55:40 -07:00
Russ Cox
dbabeb1d7a reject new of function type
R=ken
OCL=17598
CL=17598
2008-10-21 18:03:25 -07:00
Russ Cox
beee6915f8 rewrite &Point{1, 2} as allocation
R=ken
OCL=17592
CL=17592
2008-10-21 16:53:54 -07:00
Russ Cox
44b0ecc5ca 6g: use full type in sigt[0].name
sys: add sys.reflect
runtime: add canfail flag for later

R=ken
OCL=17583
CL=17583
2008-10-21 15:38:26 -07:00
Ken Thompson
0347e95b63 changes to imbedded
R=r
OCL=17572
CL=17572
2008-10-21 15:04:10 -07:00
Russ Cox
1a149ca1be stop looking for type names beginning with _.
they're gone.

R=ken
OCL=17569
CL=17569
2008-10-21 14:44:31 -07:00
Russ Cox
aacfbb461b 6g:
* print int as int, not P.int
	* write type info for non-exported types
	   in its own new section.

ar:
	skip over rest of line after $$

R=ken
OCL=17568
CL=17568
2008-10-21 14:34:45 -07:00
Russ Cox
28912ce03f fix compiler warnings
R=r
DELTA=44  (10 added, 9 deleted, 25 changed)
OCL=17502
CL=17502
2008-10-20 15:26:38 -07:00
Russ Cox
ef40d9435b 6g:
make sure methods end up immediately following
	the struct they are methods on.
ar:
	eliminate duplicate definitions from __.PKGDEF.
	check that multiple .6 do not give different defs for same
		exported type/var/func/const.
	increase ar header name size from 16 to 64 bytes

R=r
DELTA=379  (333 added, 18 deleted, 28 changed)
OCL=17477
CL=17481
2008-10-20 13:53:56 -07:00
Ken Thompson
61361af9e8 unnamed substructures - not complete
R=r
OCL=17437
CL=17437
2008-10-19 20:13:37 -07:00
Russ Cox
5fe4cd83a8 do not set t->recur on basic types.
the comment talked about printing, but now
t->recur is only used for typehash.
in typehash it is important to compute different
hashes for the different basic types.

add test that makes sure an interface { X() int8 }
cannot be used as interface { X() int64 }

R=ken
OCL=17396
CL=17396
2008-10-17 17:51:29 -07:00
Russ Cox
ab9db8a5f8 cleanup - delete unneeded vargen++
R=ken
OCL=17394
CL=17394
2008-10-17 17:45:32 -07:00
Russ Cox
ba46bd1e5a export prereq for interface types
R=ken
OCL=17377
CL=17377
2008-10-17 16:13:17 -07:00
Russ Cox
1163b1db6f diagnose various conversion problems
R=ken
OCL=17320
CL=17320
2008-10-16 15:59:31 -07:00
Russ Cox
493a9d2f42 put toplevel & check back and add test
R=ken
OCL=17307
CL=17307
2008-10-16 14:02:20 -07:00
Ken Thompson
2e4b8d94cd diagnosed some incorrect
inputs for method receivers.

R=r
OCL=17304
CL=17304
2008-10-16 13:29:03 -07:00
Russ Cox
59167e5bdb diagnose export of incomplete type
R=ken
OCL=17253
CL=17253
2008-10-15 17:51:23 -07:00
Russ Cox
7cd173a4f8 error about & at top level until it is safe
R=ken
OCL=17241
CL=17241
2008-10-15 17:09:42 -07:00
Ken Thompson
1bf38484d1 interface on arbitrary types
global signatures for basic types

R=r
OCL=17238
CL=17240
2008-10-15 17:08:10 -07:00
Russ Cox
4248607ffe simplify comma code per ken's suggestion
R=ken
OCL=17164
CL=17164
2008-10-14 18:47:24 -07:00
Russ Cox
82e41cc533 allow trailing comma in braced initialized list
R=ken
OCL=17141
CL=17143
2008-10-14 17:10:39 -07:00
Rob Pike
5933dbda3a delete hack for interface equality now that it supported by the 6g compiler
R=rsc
DELTA=21  (0 added, 21 deleted, 0 changed)
OCL=17123
CL=17136
2008-10-14 16:33:11 -07:00
Ken Thompson
e2e8aa0ee1 interface equality (strings specifically)
R=r
OCL=17134
CL=17134
2008-10-14 16:10:44 -07:00
Ken Thompson
edb1412c50 interface equality
R=r
OCL=17116
CL=17118
2008-10-14 15:08:23 -07:00
Ken Thompson
1836541566 bug with struct-type { 1 }
R=r
OCL=17096
CL=17096
2008-10-14 12:48:14 -07:00
Ken Thompson
1ea5bc7533 stack allocation for the init function
R=r
OCL=17063
CL=17063
2008-10-13 20:14:09 -07:00
Russ Cox
0adc1db757 until 6g implements it, warn about using int in interface.
R=ken
OCL=16935
CL=16935
2008-10-10 16:14:13 -07:00
Russ Cox
827dcb86b7 add sys.BUG_intereq to compare interfaces for equality
R=r
OCL=16929
CL=16929
2008-10-10 15:30:32 -07:00
Russ Cox
5f1202428b add empty var ( ), type ( ), const ( ) factorings
suggested by rob (could make programs generating
go easier to write).

R=ken
DELTA=13  (13 added, 0 deleted, 0 changed)
OCL=16766
CL=16766
2008-10-08 15:33:09 -07:00
Russ Cox
b4f8e01acb more interface checks:
- pointer to interface cannot have methods
	- record type names for better runtime error

R=r,ken
DELTA=85  (80 added, 0 deleted, 5 changed)
OCL=16658
CL=16722
2008-10-08 09:21:57 -07:00
Russ Cox
02d184b303 remove support for *T as an implicit declaration of T
R=ken
OCL=16651
CL=16653
2008-10-07 13:00:10 -07:00
Russ Cox
96da920f1a fix bug:
type T struct
	export type T struct { a int }

was not exporting T

R=ken
OCL=16650
CL=16650
2008-10-07 12:42:57 -07:00
Russ Cox
d364d28142 implement new semicolon rules:
*  1. all statements and declarations are terminated by semicolons
 *  2. semicolons can be omitted at top level.
 *  3. semicolons can be omitted before and after the closing ) or }
 *	on a list of statements or declarations.

now that semicolons are in, uncomment forward declaration
	of interfaces

R=ken
DELTA=285  (124 added, 114 deleted, 47 changed)
OCL=16638
CL=16646
2008-10-07 12:36:30 -07:00
Rob Pike
7ee60b174d sys.stringtorune doesn't need a length parameter.
R=rsc
DELTA=7  (0 added, 0 deleted, 7 changed)
OCL=16600
CL=16630
2008-10-07 10:03:34 -07:00
Russ Cox
74e2e087e2 change type names to go live at the name, so that
type T struct {
		next *T
	}

and

	type T *struct {
		next T
	}

are valid without needing forward declarations.

add "type T struct" syntax for forward struct declarations.

add "type T interface" syntax, but commented out
	(need to fix semicolons first)

R=ken
DELTA=452  (259 added, 115 deleted, 78 changed)
OCL=16580
CL=16584
2008-10-06 16:44:17 -07:00
Russ Cox
1b257b2bb3 silence gcc warning - initialize two variables
R=ken
OCL=16550
CL=16550
2008-10-06 13:52:23 -07:00
Ken Thompson
6499fbe734 bug060
R=r
OCL=16497
CL=16497
2008-10-04 17:11:01 -07:00
Ken Thompson
f25843e65e bug 026
R=r
OCL=16494
CL=16494
2008-10-04 15:17:49 -07:00
Russ Cox
c8b9970e16 change *a1++; to plain a1++
R=ken
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=16489
CL=16489
2008-10-04 02:54:19 -07:00
Russ Cox
2e1bb4a4cf add method test & fix method name bugs
R=ken,r
DELTA=86  (72 added, 9 deleted, 5 changed)
OCL=16488
CL=16488
2008-10-04 02:51:03 -07:00
Russ Cox
45f4e38506 silence gcc warnings
R=ken
OCL=16449
CL=16466
2008-10-03 16:23:02 -07:00
Russ Cox
b8babed7c2 new import/export format
package flag
	export type flag.Flag struct { name flag.string; usage flag.string; \
		value flag.Value; next *flag.Flag }
	type flag.string string
	type flag.Value interface { AsBool () (? *flag.BoolValue); \
		AsInt () (? *flag.IntValue); AsString () (? *flag.StringValue); \
		IsBool () (? flag.bool); IsInt () (? flag.bool); IsString () (? flag.bool); \
		Str () (? flag.string); ValidValue (str flag.string) (? flag.bool) }
	type flag.BoolValue struct { val flag.bool; p *flag.bool }
	type flag.IntValue struct { val flag.int64; p *flag.int64 }
	type flag.StringValue struct { val flag.string; p *flag.string }
	type flag.bool bool
	func (e *flag.StringValue) AsBool () (? *flag.BoolValue)
	func (e *flag.StringValue) AsInt () (? *flag.IntValue)
	...

the \ continuations are for this message, not real.

changed delimiter for import from (( )) to $$ $$.

replaced mksys.bash with mksys.c

changed sys.go to use leading export,
	fake package name is now SYS not foop

don't always require ; on forward func decls

R=ken,r
DELTA=1827  (446 added, 1083 deleted, 298 changed)
OCL=16433
CL=16463
2008-10-03 16:15:55 -07:00
Ken Thompson
8877d27b40 interfaces of all types
R=r
OCL=16462
CL=16462
2008-10-03 16:12:21 -07:00
Ken Thompson
ed139c1e37 more on arbitrary receiver types
this CL passes the tests, but should
be considered unstable

R=r
OCL=16390
CL=16390
2008-10-02 20:51:10 -07:00
Ken Thompson
53a22770a7 names now println/panicln
bug fix in named-return

R=r
OCL=16377
CL=16377
2008-10-02 15:37:15 -07:00
Ken Thompson
f21e731c71 added printn and panicn
prints that insert spaces and new line

R=r
OCL=16370
CL=16370
2008-10-02 14:38:07 -07:00
Russ Cox
0216273c7a add values to some "return" statements.
delete unused variables

R=ken
OCL=16360
CL=16360
2008-10-02 11:34:04 -07:00
Russ Cox
8dc08788ef remove ( ) around mismatch type prints,
so that they don't look like functions.

R=ken
OCL=16244
CL=16244
2008-09-30 15:38:41 -07:00
Russ Cox
387c1bc31e pretty types; use 6g -t to disable
R=ken
OCL=16240
CL=16242
2008-09-30 15:35:40 -07:00
Russ Cox
a05c59fe91 cleanup export
R=ken
OCL=16219
CL=16219
2008-09-30 13:52:44 -07:00
Russ Cox
b033c581db fix export bug for /usr/r/rpc
R=ken
OCL=16218
CL=16218
2008-09-30 13:49:31 -07:00
Russ Cox
4d571c9093 fix up arg list parsing to handle any names:
type t1 int;
type t2 int;
type t3 int;
func f1(t1, t2, t3);
func f2(t1, t2, t3 bool);
func f3(t1, t2, x t3);
func f4(*t2, x t3);	// error: cannot mix
func f5(t1, *t3);
func (x *t1) f6(y *[]t2) (t1, *t3);
func f7() (int, *string);
func f8(t1, *t2, x t3);	// error: cannot mix
func f9() (x int, *string);
func f10(*t2, t3);

R=ken
OCL=16202
CL=16210
2008-09-30 12:53:11 -07:00
Ken Thompson
b6f59358b5 minor bugs
R=r
OCL=16163
CL=16163
2008-09-29 20:33:51 -07:00
Ken Thompson
89ac5618ac toward methods on any type
R=r
OCL=16068
CL=16068
2008-09-28 20:22:31 -07:00
Ken Thompson
3a884d76ac bug in simul assignment
R=r
OCL=16053
CL=16053
2008-09-27 17:46:40 -07:00
Ken Thompson
7be2b9fdf6 bug in argument passing
R=r
OCL=16044
CL=16044
2008-09-27 13:32:38 -07:00
Ken Thompson
9f3d600be6 export
syntax for inheritance

R=r
OCL=16028
CL=16028
2008-09-26 21:27:26 -07:00
Ken Thompson
fb86c39362 bug with array bounds
R=r
OCL=16021
CL=16023
2008-09-26 17:41:43 -07:00
Ken Thompson
8545700af8 export
R=r
OCL=16018
CL=16022
2008-09-26 17:41:23 -07:00
Russ Cox
c3d841f5d4 handle negative numeric constants in import.
(fixes bugs/bug106)

package bug0
export const A = -1

package bug1
import "bug0"

R=ken
DELTA=21  (19 added, 0 deleted, 2 changed)
OCL=15901
CL=15968
2008-09-26 11:44:20 -07:00
Ken Thompson
bcd07252e1 export
R=r
OCL=15805
CL=15805
2008-09-24 16:20:01 -07:00
Russ Cox
afd04fdb98 cleanup; sys.sleep can go.
R=r
OCL=15786
CL=15792
2008-09-24 15:28:03 -07:00
Ken Thompson
5f0a5e7a13 more export
R=r
OCL=15771
CL=15771
2008-09-24 14:12:21 -07:00
Ken Thompson
1101d406ec more on export
R=r
OCL=15704
CL=15704
2008-09-23 14:16:41 -07:00
Ken Thompson
dc04d096f0 fixed export sort for methods
R=r
OCL=15699
CL=15699
2008-09-23 12:48:52 -07:00
Russ Cox
5383e28ea0 change string([]byte) to pass array, rather than &a[0],
to string convert.  if the byte array has length 0,
the computation of &a[0] throws an index bounds error.

for fixed size arrays, this ends up invoking arrays2d
unnecessarily, but it works.

R=ken
DELTA=304  (44 added, 28 deleted, 232 changed)
OCL=15674
CL=15678
2008-09-22 20:12:15 -07:00
Ken Thompson
4332e0a546 remove extraneous print
R=r
OCL=15666
CL=15666
2008-09-22 17:29:12 -07:00
Ken Thompson
adaec0c4f4 vectors bug
R=r
OCL=15664
CL=15664
2008-09-22 16:58:30 -07:00
Russ Cox
fb2c66710c compiler changes:
export.c:
		- only expose explicitly exported types to importer
		- fix behind your back
	go.h:
		- add deep() prototype (fixes 64-bit linux crash on time.go)
	go.y:
		- add a new syntax error case
	walk.c:
		- allow a,b = f() where f is func ptr (fixes bug088)

R=ken
OCL=15617
CL=15630
2008-09-22 12:45:01 -07:00
Ken Thompson
8231e94520 now method/interface code
R=r
OCL=15627
CL=15627
2008-09-22 12:16:19 -07:00
Russ Cox
b676b0e125 better yacc rule in Makefile
if y.tab.c is older than y.tab.h, make
interprets doing nothing as a failure,
because y.tab.c hasn't been updated.
so update it.

R=r
DELTA=4  (0 added, 0 deleted, 4 changed)
OCL=15615
CL=15622
2008-09-22 10:56:54 -07:00
Ken Thompson
8a9752dcfb another async select bug
R=r
OCL=15599
CL=15599
2008-09-20 19:56:40 -07:00
Ken Thompson
39a4b1421f bug103 - but the fix caused other
things to break. hopefully all fixed
now.

R=r
OCL=15597
CL=15597
2008-09-20 14:59:15 -07:00
Russ Cox
5eb9e0621b avoid dereferencing nil type on undefined name.
R=ken
DELTA=12  (12 added, 0 deleted, 0 changed)
OCL=15506
CL=15528
2008-09-19 09:39:09 -07:00
Russ Cox
76036192b9 make Makefiles safe for parallel make
use -j4 (4-way parallel) in make.bash.

halves time for make.bash on r45

also add libregexp, acid to default build

R=r
DELTA=90  (39 added, 37 deleted, 14 changed)
OCL=15485
CL=15487
2008-09-18 15:06:43 -07:00
Russ Cox
13f3149a01 more helpful messages for name-related syntax errors.
R=ken
OCL=15477
CL=15479
2008-09-18 13:32:14 -07:00
Russ Cox
f0635bbfaa Linux bison rejects // comments outside { code snippets }
R=ken
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=15444
CL=15446
2008-09-17 14:09:44 -07:00
Ken Thompson
304440356d assignment in select
with new select operator

R=r
OCL=15418
CL=15418
2008-09-16 20:51:50 -07:00
Rob Pike
47919799b4 new grammar:
binary <- is send
	unary <- is recv
	-< is gone
	case a := <-ch: works in select
	case a = <-ch: works in select
support for new cases is not yet in the compiler but all non-select
code works

second CL will update affected go source

R=ken
OCL=15414
CL=15414
2008-09-16 19:14:33 -07:00
Ken Thompson
721cb9c6a1 redeclaring methods
R=r
OCL=15375
CL=15375
2008-09-15 19:07:23 -07:00
Ken Thompson
d01a1ec260 robs wednesday bug
R=r
OCL=15327
CL=15327
2008-09-14 17:29:50 -07:00
Ken Thompson
2119294af9 methods on any type
-- but only *struct tested

R=r
OCL=15326
CL=15326
2008-09-14 16:57:55 -07:00
Ken Thompson
1ae08bee90 Automated g4 rollback of changelist 15312.
*** Reason for rollback ***

  <enter reason for rollback>

*** Original change description ***

correct signal name thru package rename

R=r
OCL=15313
CL=15313
2008-09-13 14:49:36 -07:00
Ken Thompson
28b9702741 correct signal name thru package rename
R=r
OCL=15312
CL=15312
2008-09-13 14:46:19 -07:00
Ken Thompson
904d4045d3 1 got rid if static 'fn wo return' test
2 added dynamic calls to throw for array bounds
  and 'fn wo return'
3 small optimization on index[constant]

R=r
OCL=15281
CL=15281
2008-09-12 16:48:35 -07:00
Ken Thompson
47580f79b4 bug075
R=r
OCL=15192
CL=15192
2008-09-11 19:09:25 -07:00
Ken Thompson
ff65872fbf function wo return is an error - not warning
R=r
OCL=15169
CL=15169
2008-09-11 15:44:45 -07:00
Ken Thompson
d30c9a4be5 implement discussed function wo return statement
R=r
OCL=15166
CL=15166
2008-09-11 15:23:01 -07:00
Ken Thompson
0a7e4a7415 bug generating duplicate interface signatures
R=r
OCL=15119
CL=15119
2008-09-10 19:49:35 -07:00
Ken Thompson
a0e57201c7 bug in type of first argument to slice
R=r
OCL=15113
CL=15113
2008-09-10 16:45:41 -07:00
Ken Thompson
d40f032d18 fixed bug in certain
evaluation of complex literals

R=r
OCL=15036
CL=15036
2008-09-09 15:47:31 -07:00
Ken Thompson
077fe40867 bug with struct literal with metods
R=r
OCL=14937
CL=14937
2008-09-08 13:10:11 -07:00
Ken Thompson
0194aaf918 T{} syntax for constructors
T(expression) for conversion
FUNC keyword no longer a type

R=r
OCL=14887
CL=14887
2008-09-05 19:50:34 -07:00
Ken Thompson
193eac7917 bugs 29, 61, 62, 74
fixedbugs 49 now (correctly) fails
bugs 32, 41, 68, 77 shouldnt be bugs

R=r
OCL=14842
CL=14842
2008-09-04 17:15:15 -07:00
Ken Thompson
9dbaab54d1 rewriting bugs
R=r
OCL=14810
CL=14810
2008-09-04 12:21:10 -07:00
Ken Thompson
182f91ffe0 map literals
R=r
OCL=14759
CL=14759
2008-09-03 14:40:22 -07:00
Ken Thompson
4539ced714 array literals
R=r
OCL=14756
CL=14756
2008-09-03 14:09:29 -07:00
Ken Thompson
1423bf3dc4 structure literals
R=r
OCL=14735
CL=14735
2008-09-02 19:11:25 -07:00
Ken Thompson
0ffacfd995 order of evaluation in function args
R=r
OCL=14733
CL=14733
2008-09-02 17:12:32 -07:00
Ken Thompson
9c5669bd0b bug in conv(string, bytearray)
R=r
OCL=14732
CL=14732
2008-09-02 16:21:30 -07:00
Ken Thompson
a7f1af81bd minor bugs
R=r
OCL=14702
CL=14702
2008-09-01 14:37:32 -07:00
Ken Thompson
33ee52727f fixed labels/break/continue/goto
R=r
OCL=14675
CL=14675
2008-08-29 20:30:19 -07:00
Ken Thompson
944ad62ecd fix type of (1<<x)
R=r
OCL=14656
CL=14656
2008-08-29 13:24:53 -07:00
Ken Thompson
53010efe01 shift operations to new spec
R=r
OCL=14641
CL=14641
2008-08-28 19:59:42 -07:00
Ken Thompson
c6130e9f1f get rid of static/dynamic array distinction
R=r
OCL=14634
CL=14634
2008-08-28 15:17:37 -07:00
Ken Thompson
66a603c986 arrays
R=r
OCL=14603
CL=14603
2008-08-27 17:28:30 -07:00
Ken Thompson
30fd44cf9d fix fat copy of overlapping data
R=r
OCL=14417
CL=14417
2008-08-21 20:49:04 -07:00
Rob Pike
b59b551be7 allow predefined identifiers (len, etc.) to be exported.
(they were not accepted as names by the import parser)

R=ken
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=14159
CL=14159
2008-08-13 15:24:55 -07:00
Ken Thompson
52861558f4 put i2s, s2i and i2i in convert
R=r
OCL=14143
CL=14143
2008-08-12 19:13:09 -07:00
Ken Thompson
ead7a6d47a i2s and i2i
R=r
OCL=14140
CL=14140
2008-08-12 16:36:18 -07:00
Ken Thompson
c1ab5a554f resolve go.y edits
R=r
OCL=14132
CL=14132
2008-08-12 14:28:58 -07:00
Ken Thompson
4797523572 fixed bugs in const/case
R=r
DELTA=138  (75 added, 12 deleted, 51 changed)
OCL=14129
CL=14131
2008-08-12 14:04:03 -07:00
Rob Pike
72d50900e3 fix a typo in the comments
R=ken
OCL=14104
CL=14104
2008-08-11 21:29:11 -07:00
Ken Thompson
a8a9dbc9c6 print() and field names
R=r
DELTA=86  (61 added, 3 deleted, 22 changed)
OCL=14099
CL=14099
2008-08-11 19:17:28 -07:00
Ken Thompson
2b75556436 export large constants
R=r
DELTA=37  (31 added, 4 deleted, 2 changed)
OCL=14089
CL=14089
2008-08-11 13:22:04 -07:00
Ken Thompson
5649c23c8c fixed op=, ++ and -- on maps (bug060)
R=r
DELTA=22  (21 added, 0 deleted, 1 changed)
OCL=14049
CL=14049
2008-08-10 16:49:01 -07:00
Ken Thompson
258c817a1b allow name-type or pointer-to-named-type as method name (bug046)
R=r
DELTA=17  (11 added, 3 deleted, 3 changed)
OCL=14048
CL=14048
2008-08-10 15:09:09 -07:00
Ken Thompson
091047f36c adding and deleting files
R=r
DELTA=1685  (920 added, 765 deleted, 0 changed)
OCL=14030
CL=14030
2008-08-09 17:33:35 -07:00
Ken Thompson
272ae659db mp fixed arith
R=r
DELTA=149  (80 added, 62 deleted, 7 changed)
OCL=14029
CL=14029
2008-08-09 17:29:26 -07:00
Ken Thompson
67c4cc473c forgot a file
R=r
DELTA=427  (427 added, 0 deleted, 0 changed)
OCL=14017
CL=14017
2008-08-08 17:15:46 -07:00
Ken Thompson
9c2ade358d mp constants
R=r
DELTA=381  (142 added, 26 deleted, 213 changed)
OCL=14011
CL=14016
2008-08-08 17:13:31 -07:00
Russ Cox
d28acc42ec first cut at multithreading. works on Linux.
* kick off new os procs (machs) as needed
* add sys·sleep for testing
* add Lock, Rendez
* properly lock mal, sys·newproc, scheduler
* linux syscall arg #4 is in R10, not CX
* chans are not multithread-safe yet
* multithreading disabled by default;
  set $gomaxprocs=2 (or 1000) to turn it on

This should build on OS X but may not.
Rob and I will fix soon after submitting.

TBR=r
OCL=13784
CL=13842
2008-08-04 16:43:49 -07:00
Ken Thompson
695f83a9e0 export external functions
R=r
DELTA=16  (10 added, 4 deleted, 2 changed)
OCL=13815
CL=13815
2008-08-04 13:18:59 -07:00
Russ Cox
34514bdb72 Use a single Make.conf for setting CC, etc.
This makes it easy to build with other flags
(like -ggdb) or other compilers (like cc64).

R=r
DELTA=45  (6 added, 22 deleted, 17 changed)
OCL=13790
CL=13793
2008-08-03 23:03:31 -07:00
Ken Thompson
989676d2ba add 'export' adjectives to external
var, const and type declarations.

R=r
DELTA=49  (12 added, 28 deleted, 9 changed)
OCL=13791
CL=13791
2008-08-03 18:47:02 -07:00
Russ Cox
9aad9fef76 make 6a, 6c, 6g, 6l, libmach_amd64 build on 64-bit gcc.
these guys really really want long to be 32-bits,
so ,s/long/int32/ (and then manual fixup).
still passes all tests.

(i started out looking for just those longs that
needed to be int32 instead, and it was just too hard
to track them down one by one.)

the longs were rare enough that i don't think
it will cause integration problems.

R=ken
OCL=13787
CL=13789
2008-08-03 17:25:15 -07:00
Ken Thompson
b2d9020242 len now takes an expression
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=13523
CL=13523
2008-07-28 13:54:58 -07:00
Ken Thompson
b1abcc195d random bug fixes
R=r
DELTA=18  (6 added, 1 deleted, 11 changed)
OCL=13504
CL=13504
2008-07-27 13:09:15 -07:00
Ken Thompson
bd397d2f9b select
R=r
DELTA=29  (27 added, 1 deleted, 1 changed)
OCL=13503
CL=13503
2008-07-27 11:42:52 -07:00
Ken Thompson
120827284e select/chan
R=r
DELTA=517  (137 added, 98 deleted, 282 changed)
OCL=13495
CL=13495
2008-07-26 14:21:21 -07:00
Ken Thompson
949ab5c7ff select
R=r
APPROVED=r
DELTA=41  (24 added, 13 deleted, 4 changed)
OCL=13480
CL=13480
2008-07-25 17:03:27 -07:00
Ken Thompson
e963cba8a1 select
R=r
APPROVED=r
DELTA=147  (94 added, 14 deleted, 39 changed)
OCL=13477
CL=13477
2008-07-25 15:55:12 -07:00
Ken Thompson
ece3e57c85 read select
R=r
APPROVED=r
DELTA=120  (108 added, 0 deleted, 12 changed)
OCL=13468
CL=13468
2008-07-25 11:58:26 -07:00
Ken Thompson
cb9b1038db select
R=r
APPROVED=r
DELTA=638  (433 added, 21 deleted, 184 changed)
OCL=13426
CL=13438
2008-07-24 15:57:30 -07:00
Rob Pike
05caa7f820 help management of empty pkg and lib directories in perforce
R=gri
DELTA=4  (4 added, 0 deleted, 0 changed)
OCL=13328
CL=13328
2008-07-21 17:10:49 -07:00
Ken Thompson
b78676a49d start of select
random bugs fixed

SVN=128149
2008-07-20 20:13:07 -07:00
Ken Thompson
963753d3f9 tweaks to init
rand using init

SVN=128142
2008-07-20 13:33:45 -07:00
Ken Thompson
f24f8ffae0 init
SVN=128128
2008-07-19 18:39:12 -07:00
Ken Thompson
90da636c15 init filename vs pkgname
SVN=128117
2008-07-19 14:20:46 -07:00
Ken Thompson
fb3af53f4e initialization
SVN=128115
2008-07-19 13:38:29 -07:00
Ken Thompson
4c5a165873 len(fixed array)
SVN=128050
2008-07-18 11:59:35 -07:00
Ken Thompson
0ca551fc36 loop in subtype
SVN=127933
2008-07-17 18:15:05 -07:00
Ken Thompson
9e2d185040 div bug
[]ptr bug
proc reuses old g* structures
differnt assignment of offsets to parameters

SVN=127888
2008-07-17 15:03:39 -07:00