1
0
mirror of https://github.com/golang/go synced 2024-10-04 01:31:25 -06:00
Commit Graph

133 Commits

Author SHA1 Message Date
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
3c0fc400fb fix unsafe.Sizeof("abc")
R=rsc
OCL=25105
CL=25105
2009-02-17 13:10:57 -08:00
Russ Cox
b4af09ab56 embedded interface types in interfaces.
R=ken
OCL=25072
CL=25072
2009-02-16 16:36:18 -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
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
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
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
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
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
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
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
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
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
e512481b17 second pass on interface fixes and tests.
R=ken
OCL=22370
CL=22372
2009-01-08 18:06:06 -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
4026500d18 arrays
R=r
OCL=21564
CL=21564
2008-12-18 20:06:28 -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
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
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
26b357ca5b range statement
R=r
OCL=20667
CL=20667
2008-12-05 18:24:05 -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
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
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
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
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
Russ Cox
f27aaf4819 structure field annotation strings
R=ken
OCL=18176
CL=18176
2008-10-30 15:13:09 -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
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
14c639161a elided dots
R=r
OCL=17601
CL=17601
2008-10-21 20:55:40 -07:00
Ken Thompson
0347e95b63 changes to imbedded
R=r
OCL=17572
CL=17572
2008-10-21 15:04:10 -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
Ken Thompson
61361af9e8 unnamed substructures - not complete
R=r
OCL=17437
CL=17437
2008-10-19 20:13:37 -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
1163b1db6f diagnose various conversion problems
R=ken
OCL=17320
CL=17320
2008-10-16 15:59:31 -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
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
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
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
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
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
89ac5618ac toward methods on any type
R=r
OCL=16068
CL=16068
2008-09-28 20:22:31 -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
fb86c39362 bug with array bounds
R=r
OCL=16021
CL=16023
2008-09-26 17:41:43 -07:00
Ken Thompson
721cb9c6a1 redeclaring methods
R=r
OCL=15375
CL=15375
2008-09-15 19:07:23 -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
0a7e4a7415 bug generating duplicate interface signatures
R=r
OCL=15119
CL=15119
2008-09-10 19:49:35 -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
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
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
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
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
Ken Thompson
814320c8b4 parameter in fn literals
SVN=127695
2008-07-16 18:31:01 -07:00
Ken Thompson
8003849498 parameter declartions in func literals
SVN=127678
2008-07-16 17:22:54 -07:00
Ken Thompson
4528854308 unique import/export names
more on go statement

SVN=126421
2008-07-08 17:19:17 -07:00
Rob Pike
655c281303 disambiguate typedefs in export blocks of .6 files
SVN=126366
2008-07-08 14:20:04 -07:00
Ken Thompson
4d6d4e7f4e random little bugs
SVN=126049
2008-07-05 17:43:25 -07:00
Ken Thompson
417a971f9a output args declared
arguments in first block for diagnostics
thomo return
better syntax error recovery

SVN=126045
2008-07-05 12:49:25 -07:00
Rob Pike
1f672596c5 fix a few spelling mistakes in messages
SVN=125108
2008-06-27 10:29:02 -07:00
Ken Thompson
54abac678a redeclarations of variables in the same block.
half-step toward multivalued map indexing

SVN=124019
2008-06-21 15:11:29 -07:00
Ken Thompson
e1a06ccc80 now checks for lvalue/rvalue context of
expressions.
start of generics for calling builtin
     functions
start of map type
'any' demoted from reserved word to type

SVN=122808
2008-06-15 20:24:30 -07:00
Ken Thompson
efec14bc5a plan9 line numbers and line table
SVN=122793
2008-06-13 18:16:23 -07:00
Ken Thompson
2254a8ee99 import/export
SVN=122309
2008-06-11 21:06:26 -07:00
Rob Pike
0cafb9ea3d Add compiler source to new directory structure
SVN=121164
2008-06-04 14:37:38 -07:00