Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Delta Between Two Patch Sets: src/cmd/gc/sinit.c

Issue 8601044: code review 8601044: cmd/gc: compute initialization order for top-level blan... (Closed)
Left Patch Set: diff -r 1c764773c6ce https://go.googlecode.com/hg/ Created 11 years, 10 months ago
Right Patch Set: diff -r c56c0d1f613e https://go.googlecode.com/hg/ Created 11 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | test/fixedbugs/issue5244.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 /* 5 /*
6 * static initialization 6 * static initialization
7 */ 7 */
8 8
9 #include <u.h> 9 #include <u.h>
10 #include <libc.h> 10 #include <libc.h>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 init1(n->type->nname, out); 43 init1(n->type->nname, out);
44 } 44 }
45 45
46 if(n->op != ONAME) 46 if(n->op != ONAME)
47 return; 47 return;
48 switch(n->class) { 48 switch(n->class) {
49 case PEXTERN: 49 case PEXTERN:
50 case PFUNC: 50 case PFUNC:
51 break; 51 break;
52 default: 52 default:
53 » » if(isblank(n) && n->curfn == N && n->defn != N && n->defn->inito rder == InitNotStarted) 53 » » if(isblank(n) && n->curfn == N && n->defn != N && n->defn->inito rder == InitNotStarted) {
54 » » » break; 54 » » » // blank names initialization is part of init() but not
55 » » » // when they are inside a function.
56 » » » break;
57 » » }
55 return; 58 return;
56 } 59 }
57 60
58 if(n->initorder == InitDone) 61 if(n->initorder == InitDone)
59 return; 62 return;
60 if(n->initorder == InitPending) { 63 if(n->initorder == InitPending) {
61 if(n->class == PFUNC) 64 if(n->class == PFUNC)
62 return; 65 return;
63 66
64 // if there have already been errors printed, 67 // if there have already been errors printed,
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 if(p->cap == 0) 1417 if(p->cap == 0)
1415 p->cap = 4; 1418 p->cap = 4;
1416 else 1419 else
1417 p->cap *= 2; 1420 p->cap *= 2;
1418 p->e = realloc(p->e, p->cap*sizeof p->e[0]); 1421 p->e = realloc(p->e, p->cap*sizeof p->e[0]);
1419 if(p->e == nil) 1422 if(p->e == nil)
1420 fatal("out of memory"); 1423 fatal("out of memory");
1421 } 1424 }
1422 return &p->e[p->len++]; 1425 return &p->e[p->len++];
1423 } 1426 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b