Russ Cox
b1f44a120f
gc: improve error message for x \= 0
...
was
x.go:2: syntax error: unexpected $undefined
now
x.go:2: syntax error: unexpected \
R=ken2
CC=golang-dev
https://golang.org/cl/2267044
2010-09-24 17:09:31 -04:00
Russ Cox
d19fcd0784
gc: spell debug['u'] correctly
...
R=ken2
CC=golang-dev
https://golang.org/cl/2214042
2010-09-16 15:50:46 -04:00
Russ Cox
555f5b6b24
gc: make sure path names are canonical
...
R=ken2
CC=golang-dev
https://golang.org/cl/2209042
2010-09-16 15:37:57 -04:00
Russ Cox
b49561d884
gc: graceful exit on seg fault
...
R=ken2
CC=golang-dev
https://golang.org/cl/1882043
2010-07-26 16:52:51 -07:00
Russ Cox
0decedf636
gc: various bug fixes
...
Fixes #935 .
Fixes #936 .
Fixes #941 .
R=ken2
CC=golang-dev
https://golang.org/cl/1867042
2010-07-20 23:45:33 -07:00
Russ Cox
b693847ea8
gc: print error detail about failure to open import
...
R=ken2
CC=golang-dev
https://golang.org/cl/1872041
2010-07-16 21:38:51 -07:00
Rob Pike
8519134b98
fix typo in lex.c comment
...
R=rsc
CC=golang-dev
https://golang.org/cl/1862044
2010-07-16 15:08:31 -07:00
Ken Thompson
19d7fc4026
change line pragma from
...
//line number file
to
//line file:number
R=rsc
CC=golang-dev
https://golang.org/cl/1868041
2010-07-16 13:34:36 -07:00
Ken Thompson
444066e56d
interpret lines that look like
...
//line 10 units.y
which is equiv to c
#line 10 units.y
the purpose is to generate diagnostics
that correctly point to preprocessed source.
R=rsc
CC=golang-dev
https://golang.org/cl/1863042
2010-07-15 20:21:33 -07:00
Russ Cox
691d765121
gc: bug274
...
R=ken2
CC=golang-dev
https://golang.org/cl/1742044
2010-07-15 15:05:56 -07:00
Rob Pike
c9f83372d8
add missing argument to usage message.
...
Fixes #912 .
R=rsc
CC=golang-dev
https://golang.org/cl/1819041
2010-07-12 16:31:51 -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
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
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
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
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
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
Russ Cox
9e497c3656
gc: disallow · in Go programs
...
Fixes #793 .
R=ken2
CC=golang-dev
https://golang.org/cl/1249043
2010-05-20 17:34:22 -07:00
Russ Cox
b5f54db359
gc: bug267
...
R=ken2
CC=golang-dev
https://golang.org/cl/1067042
2010-05-03 15:29:59 -07:00
Russ Cox
69a2e1dc52
gc: better windows detection
...
R=ken2
CC=golang-dev
https://golang.org/cl/944043
2010-04-27 17:19:15 -07:00
Russ Cox
3bcef5ac30
gc: fix islocalname on windows
...
Fixes #732 .
R=ken2
CC=golang-dev
https://golang.org/cl/956050
2010-04-27 13:52:43 -07:00
Russ Cox
9475cafa73
gc: distinguish fatal compiler bug from error+exit
...
R=ken2
CC=golang-dev
https://golang.org/cl/902044
2010-04-11 14:52:06 -07:00
Russ Cox
9b1507b050
gc: implement panic and recover
...
R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/831042
2010-03-31 11:46:01 -07:00
Russ Cox
01eaf780a8
gc: add panic and recover (still unimplemented in runtime)
...
main semantic change is to enforce single argument to panic.
runtime: change to 1-argument panic.
use String method on argument if it has one.
R=ken2, r
CC=golang-dev
https://golang.org/cl/812043
2010-03-30 10:53:16 -07:00
Russ Cox
5d0ec6c076
gc: flush warnings, if any
...
R=ken2
CC=golang-dev
https://golang.org/cl/811042
2010-03-29 23:34:59 -07:00
Ken Thompson
623dfd1b07
depricate panicln
...
R=rsc
CC=golang-dev
https://golang.org/cl/743041
2010-03-24 16:53:54 -07:00
Dean Prichard
f015c53ada
gc: avoid fixed length buffer cleanbuf
...
R=rsc
CC=golang-dev
https://golang.org/cl/302042
2010-03-08 17:00:14 -08:00
Ken Thompson
426099f42e
6g complex type usable
...
8g and 5g have stubs to ignore complex
R=rsc
CC=golang-dev
https://golang.org/cl/257042
2010-03-05 20:16:04 -08:00
Russ Cox
f1550482fa
gc: fix imported and not used message - show path
...
R=ken2
CC=golang-dev
https://golang.org/cl/229046
2010-03-03 17:23:47 -08:00
Ken Thompson
33d6a260c1
new types complex, complex64 and complex128
...
only front-end compiler work.
best to do thin in 3 steps
1. frontend
2. backend
3. lib
R=rsc
CC=golang-dev
https://golang.org/cl/214042
2010-02-17 22:08:30 -08:00
Russ Cox
cfff862862
gc: disallow NUL byte, catch more invalid UTF-8, test
...
R=ken2, ken3
CC=golang-dev
https://golang.org/cl/209041
2010-02-16 16:47:39 -08:00
Russ Cox
e7fc5c2789
gc: test & fix handling of very long string constants
...
R=ken2
CC=golang-dev
https://golang.org/cl/207106
2010-02-16 10:16:24 -08:00
Andrew Gerrand
b4fb00b69b
*l/*c: add -V flag to display version number
...
R=rsc
CC=golang-dev
https://golang.org/cl/204044
2010-02-08 09:46:53 -08:00
Russ Cox
288c1c83d9
gc: tweak error messages, avoid internalization settings in bison
...
R=r
CC=golang-dev
https://golang.org/cl/194129
2010-01-28 15:57:44 -08:00
Russ Cox
2a01d72878
gc: improved syntax errors
...
* example-based syntax errors (go.errors)
* enable bison's more specific errors
and translate grammar token names into
tokens like ++
* test cases
R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/194085
2010-01-26 23:13:22 -08:00
Russ Cox
5f4c052e2d
gc: do not treat .6 different from .a anymore
...
R=ken2
CC=golang-dev
https://golang.org/cl/195050
2010-01-26 16:12:50 -08:00
Russ Cox
531e6b77c8
eliminate package global name space
...
R=ken2
CC=golang-dev
https://golang.org/cl/194071
2010-01-25 18:31:35 -08:00
Russ Cox
1cecac8134
gc: record full package paths in runtime type data
...
detect compilation of special package runtime with
compiler flag instead of package name.
R=ken2
CC=golang-dev
https://golang.org/cl/193080
2010-01-24 23:33:59 -08:00
Russ Cox
fd150e77e1
gc: cut some dead code, fix 6g -S output
...
R=ken2
CC=golang-dev
https://golang.org/cl/193079
2010-01-24 22:36:26 -08:00
Russ Cox
758f2bc556
eliminate the package global name space assumption in object files
...
5g/6g/8g: add import statements to export metadata, mapping package path to package name.
recognize "" as the path of the package in export metadata.
use "" as the path of the package in object symbol names.
5c/6c/8c, 5a/6a/8a: rewrite leading . to "". so that ·Sin means Sin in this package.
5l/6l/8l: rewrite "" in symbol names as object files are read.
gotest: handle new symbol names.
gopack: handle new import lines in export metadata.
Collectively, these changes eliminate the assumption of a global
name space in the object file formats. Higher level pieces such as
reflect and the computation of type hashes still depend on the
assumption; we're not done yet.
R=ken2, r, ken3
CC=golang-dev
https://golang.org/cl/186263
2010-01-22 17:06:20 -08:00
Russ Cox
4f8117d9eb
build: move GOOS, GOARCH, GOROOT lookup into central library.
...
bake default values in during build.
R=r
CC=golang-dev
https://golang.org/cl/186173
2010-01-18 21:46:46 -08:00
Russ Cox
5a5799f613
gc: more precise handling of import .
...
Fixes #455 .
R=ken2
CC=golang-dev
https://golang.org/cl/186212
2010-01-18 16:26:40 -08:00
Rob Pike
ccbcefe2b6
ignore $GOARCH inside the compiler and linker.
...
by definition, they know what they are building for.
makes it easier to switch architectures when testing.
% 6g x.go
% 6l x.6
% 6.out
"Wed Jan 13 10:57:46 EST 2010"
% 8g x.go
% 8l x.8
% 8.out
"Wed Jan 13 10:57:46 EST 2010"
% echo $GOARCH
%
R=rsc
CC=golang-dev
https://golang.org/cl/186116
2010-01-13 14:39:16 +11:00
Russ Cox
1b1f39eb86
gc: bug219, bug239, bug240
...
Fixes #475 .
R=ken2
CC=golang-dev
https://golang.org/cl/183157
2010-01-07 23:24:48 -08:00
Russ Cox
3997495dc3
gc: semicolons
...
Fixes #89 .
Fixes #92 .
Fixes #118 .
Fixes #182 .
Fixes #328 .
Fixes #340 .
R=ken2, ken3
CC=golang-dev
https://golang.org/cl/172049
2009-12-11 15:59:41 -08:00
Russ Cox
8777759f59
gc: make 'invalid rune in string' a little less cryptic
...
Fixes #371 .
R=ken2
https://golang.org/cl/164091
2009-12-02 23:23:11 -08:00
Ken Thompson
c4606d05da
install copy predefined
...
did not test 386, but should work
shouldnt matter if copy is not used
R=rsc
https://golang.org/cl/156055
2009-11-17 20:41:44 -08:00
Russ Cox
7932950844
gc: increase maximum path size in getwd from 100 to 1000.
...
Fixes #31 .
To try the fix before the next release:
hg pull -u
R=r1, r
https://golang.org/cl/154058
2009-11-11 12:00:41 -08:00
Rob Pike
3fa379e797
document the gc go compilers.
...
fix the usage message.
R=rsc
CC=go-dev
http://go/go-review/1016033
2009-11-03 22:00:36 -08:00
Russ Cox
1be74762c1
bug169
...
R=ken
OCL=35899
CL=35899
2009-10-19 19:55:17 -07:00
Russ Cox
8fffa1d698
bug190.
...
also eliminate float80 dregs
R=ken
OCL=35894
CL=35896
2009-10-19 18:47:37 -07:00
Russ Cox
22a5c78f44
rename sys functions to runtime,
...
because they are in package runtime.
another step to enforcing package boundaries.
R=r
DELTA=732 (114 added, 93 deleted, 525 changed)
OCL=35811
CL=35824
2009-10-15 23:10:49 -07:00
Russ Cox
2372408189
sort errors by line number
...
turn off testdclstack and "not used" errors
when there are syntax errors.
BUG=2181825
R=ken
OCL=35606
CL=35608
2009-10-12 11:03:48 -07:00
Russ Cox
d515063588
better handling of mistaken top-level variable
...
references during the parsing of :=. the base
problem is that when reading
a,b,c,d
the parser makes those refer to existing variables,
which might create a few stub top-level ones
for undefined names, but then if a := is the next
token, we need to undo those stubs.
this was causing problems in multifile packages
in which one file used a := variable named rpc
and the other imported a package named rpc.
R=ken
OCL=35446
CL=35446
2009-10-07 14:55:12 -07:00
Russ Cox
a95ee61aea
ideal bools and related fixes
...
R=ken
OCL=34859
CL=34865
2009-09-21 15:45:55 -07:00
Russ Cox
73e52ae971
check for unused imports
...
R=ken
OCL=34732
CL=34756
2009-09-17 16:42:10 -07:00
Russ Cox
e780fa8669
defining package block names must override
...
universe block names.
BUG=2097244
R=ken
OCL=34295
CL=34473
2009-09-09 01:01:39 -07:00
Russ Cox
5d16d23362
update type switch to match spec.
...
R=ken
OCL=34471
CL=34471
2009-09-09 00:18:16 -07:00
Russ Cox
5438be4541
write-only variable _
...
R=ken
OCL=34465
CL=34470
2009-09-08 23:16:19 -07:00
Russ Cox
107d404378
stop using filename for disambiguation within a package.
...
R=ken
OCL=34339
CL=34341
2009-09-03 15:23:21 -07:00
Russ Cox
5600435fe4
produce diagnostic for
...
import "fmt"
var fmt = 1
R=ken
OCL=33556
CL=33561
2009-08-19 17:27:08 -07:00
Russ Cox
38df5ec58d
try to do better line number reporting
...
in the presence of yacc lookahead.
better but still not perfect
R=ken
OCL=33541
CL=33541
2009-08-19 15:18:08 -07:00
Russ Cox
43f29e64a6
mechanism for putting go types into 6.out symbol table.
...
no types yet.
R=ken
OCL=33142
CL=33146
2009-08-12 18:16:24 -07:00
Russ Cox
66bb399fdd
whole-package compilation
...
R=ken
OCL=33063
CL=33095
2009-08-12 13:18:19 -07:00
Russ Cox
b648716ee9
forward declarations not necessary.
...
still to do:
* initializer cycle detection
* nicer error for type checking cycles
R=ken
OCL=32855
CL=32880
2009-08-07 12:50:26 -07:00
Russ Cox
a121410541
make Syms smaller.
...
collapse a lot of duplication in dcl.c
switch to NodeList* from Dcl*
R=ken
OCL=32770
CL=32770
2009-08-04 22:59:23 -07:00
Russ Cox
db508ccbff
baby step: const decls can refer to future
...
consts in the same factored block
const (
X = Y;
Y = 2;
)
R=ken
OCL=31782
CL=31782
2009-07-17 13:38:16 -07:00
Russ Cox
e52e9ca82e
another step toward eliminating forward declarations.
...
introduce NodeList* type in compiler to replace OLIST.
this clarifies where lists can and cannot occur.
list append and concatenation are now cheap.
the _r rules are gone from yacc.
rev and unrev are gone.
no more lists of lists.
the representation of assignments is a bit clunkier.
split into OAS (1=1) and OAS2 (2 or more on one side).
delete dead chanrecv3 code.
delay construction of func types.
R=ken
OCL=31745
CL=31762
2009-07-17 01:00:44 -07:00
Russ Cox
db312fa8de
bug163
...
R=ken
OCL=31149
CL=31149
2009-07-03 13:34:05 -07:00
Russ Cox
5d5904bb4d
bug163 bug164 bug166
...
R=ken
OCL=30889
CL=30889
2009-06-29 17:46:22 -07:00
Russ Cox
70e232e668
separate local path lookup from standard package directories
...
R=ken
OCL=30760
CL=30779
2009-06-25 20:15:56 -07:00
Russ Cox
1ea28570ec
the any fix was too aggressive; allow any in any import.
...
R=ken
OCL=30768
CL=30768
2009-06-25 16:57:56 -07:00
Russ Cox
30f2799f88
disable "any" except during canned imports.
...
new flag -A enables it during mkbuiltin.
avoids mysterious errors in programs
that refer to any accidentally.
R=ken
OCL=30763
CL=30763
2009-06-25 16:22:46 -07:00
Ken Thompson
eba82f4391
better diagnostics for eof in a string.
...
this assumes that embedded newlines are
legal in back-quote strings.
R=r
OCL=30502
CL=30502
2009-06-18 15:49:41 -07:00
Russ Cox
8abcdee175
implement optional semicolons with help from the lexer,
...
instead of having to double the type and statement grammars.
R=ken
OCL=29987
CL=29998
2009-06-06 19:27:48 -07:00
Russ Cox
8f4af6d205
gc: grammar cleanup:
...
* no longer distinguishes const, var, type, package names.
* all the predefined names are not tokens anymore.
R=ken
OCL=29326
CL=29985
2009-06-06 12:46:38 -07:00
Russ Cox
01fe6a9c58
more build refinements:
...
* use new Make.$GOARCH files in gobuild.
* rename 6ar to arch-generic gopack.
* place objects in $GOROOT/pkg/$GOOS_$GOARCH
(makes cross-compiling easier, and no one
ever types these paths by hand anyway).
R=r
DELTA=29 (6 added, 8 deleted, 15 changed)
OCL=29923
CL=29967
2009-06-05 22:18:32 -07:00
Russ Cox
f51ca384eb
fix handling of floating point zero constant 0p+0
...
R=r
DELTA=25 (25 added, 0 deleted, 0 changed)
OCL=29875
CL=29875
2009-06-04 11:06:37 -07:00
Russ Cox
4beac9985b
simplifying grammar: delete LBASETYPE and LACONST.
...
take 2
R=ken
OCL=29304
CL=29306
2009-05-22 22:46:06 -07:00
Russ Cox
ca2fe5d8bd
Automated g4 rollback of changelist 29302.
...
*** Reason for rollback ***
too many files included
*** Original change description ***
simplifying grammar: delete LBASETYPE and LACONST
R=ken
OCL=29303
CL=29303
2009-05-22 22:43:57 -07:00
Russ Cox
2a4dcfffc9
simplifying grammar: delete LBASETYPE and LACONST
...
R=ken
OCL=29300
CL=29302
2009-05-22 22:42:12 -07:00
Russ Cox
d06a79e31b
no need for compiler to hard-code definition of runtime.
...
use the actual go source instead.
R=r
DELTA=90 (66 added, 18 deleted, 6 changed)
OCL=28708
CL=28719
2009-05-12 16:15:52 -07:00
Russ Cox
b3533dfd72
6g:
...
new type equality restrictions
better handling of renamed packages
"sys" is no longer available to programs
R=ken
OCL=28553
CL=28578
2009-05-08 15:40:31 -07:00
Russ Cox
918afd9491
move things out of sys into os and runtime
...
R=r
OCL=28569
CL=28573
2009-05-08 15:21:41 -07:00
Russ Cox
83cd4ee070
6g: generate string data as individual symbols,
...
so that 6l can discard strings used by dead code.
also, for short strings, generate DUPOK global
symbols so that references to, say, "%s: %s" in
multiple files result in only a single symbol.
R=ken
OCL=28361
CL=28361
2009-05-06 13:47:40 -07:00
Ken Thompson
3657061550
change representation of strings
...
R=r
OCL=27293
CL=27293
2009-04-09 18:16:21 -07:00
Russ Cox
f95da9a639
yet another attempt at auto-linking
...
store only the original import path string (+ .a)
if 6g resolves it to an archive file.
let 6l re-resolve the .a at link time.
this lets libraries build against an archive
in the current directory but get used
against an installed archive.
R=r
OCL=27244
CL=27244
2009-04-08 22:45:33 -07:00
Russ Cox
416b27548e
use _f007·filename for func literals.
...
this avoids problems people have run into with
multiple closures in the same package.
when preparing filename, only cut off .go, not .anything.
this fixes a bug tgs ran into with foo.pb.go and foo.go
in the same package.
also turn bad identifier chars from filename into
underscores: a-b.pb.go => a_b_pb
R=ken
OCL=27050
CL=27050
2009-04-02 18:32:57 -07:00
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
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
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
8e54729b5a
move alignment calculations into gc
...
R=ken
OCL=26914
CL=26914
2009-03-30 17:09:28 -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
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
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
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
63985b489b
bug085 bug129
...
R=ken
OCL=25787
CL=25791
2009-03-05 15:57:03 -08:00
Russ Cox
d3d0c256be
bug123
...
R=ken
OCL=25075
CL=25075
2009-02-16 17:44:05 -08:00