Skip to content

Commit 1e6217f

Browse files
tedhorstbrson
authored andcommitted
---
yaml --- r: 11189 b: refs/heads/master c: 36d5074 h: refs/heads/master i: 11187: 1ae4180 v: v3
1 parent 2f01edc commit 1e6217f

24 files changed

+129
-255
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 54875908607aeba57477e117a08e5f8f3611bf76
2+
refs/heads/master: 36d5074f8f402c13354bf67dc90fcc30f870a0e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ opt docs 1 "build documentation"
262262
opt optimize 1 "build optimized rust code"
263263
opt optimize-cxx 1 "build optimized C++ code"
264264
opt optimize-llvm 1 "build optimized LLVM"
265+
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
265266
opt manage-submodules 1 "let the build manage the git submodules"
266267
opt mingw-cross 0 "cross-compile for win32 using mingw"
267268
opt clang 0 "prefer clang to gcc for building the runtime"

trunk/mk/llvm.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
2+
ifdef CFG_ENABLE_FAST_MAKE
3+
LLVM_DEPS := $(S)/.gitmodules
4+
else
15
# Recursive wildcard function
26
# http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
37
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
48
$(filter $(subst *,%,$2),$d))
59

610
# This is just a rough approximation of LLVM deps
711
LLVM_DEPS=$(call rwildcard,$(CFG_LLVM_SRC_DIR),*cpp *hpp)
12+
endif
813

914
define DEF_LLVM_RULES
1015

trunk/mk/rt.mk

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,18 @@ rt/$(1)/$(CFG_RUNTIME): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \
158158
# FIXME: For some reason libuv's makefiles can't figure out the correct definition
159159
# of CC on the mingw I'm using, so we are explicitly using gcc. Also, we
160160
# have to list environment variables first on windows... mysterious
161-
$$(LIBUV_LIB_$(1)): $$(wildcard \
162-
$$(S)src/libuv/* \
163-
$$(S)src/libuv/*/* \
164-
$$(S)src/libuv/*/*/* \
165-
$$(S)src/libuv/*/*/*/*)
161+
162+
ifdef CFG_ENABLE_FAST_MAKE
163+
LIBUV_DEPS := $$(S)/.gitmodules
164+
else
165+
LIBUV_DEPS := $$(wildcard \
166+
$$(S)src/libuv/* \
167+
$$(S)src/libuv/*/* \
168+
$$(S)src/libuv/*/*/* \
169+
$$(S)src/libuv/*/*/*/*)
170+
endif
171+
172+
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
166173
$$(Q)$$(MAKE) -C $$(S)mk/libuv/$$(LIBUV_ARCH_$(1))/$$(LIBUV_OSTYPE_$(1)) \
167174
CFLAGS="$$(LIBUV_FLAGS_$$(HOST_$(1)))" \
168175
LDFLAGS="$$(LIBUV_FLAGS_$$(HOST_$(1)))" \

trunk/src/comp/driver/diagnostic.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,22 @@ fn diagnosticcolor(lvl: level) -> u8 {
159159

160160
fn print_diagnostic(topic: str, lvl: level, msg: str) {
161161
if str::is_not_empty(topic) {
162-
io::stdout().write_str(#fmt["%s ", topic]);
162+
io::stderr().write_str(#fmt["%s ", topic]);
163163
}
164164
if term::color_supported() {
165-
term::fg(io::stdout(), diagnosticcolor(lvl));
165+
term::fg(io::stderr(), diagnosticcolor(lvl));
166166
}
167-
io::stdout().write_str(#fmt["%s:", diagnosticstr(lvl)]);
167+
io::stderr().write_str(#fmt["%s:", diagnosticstr(lvl)]);
168168
if term::color_supported() {
169-
term::reset(io::stdout());
169+
term::reset(io::stderr());
170170
}
171-
io::stdout().write_str(#fmt[" %s\n", msg]);
171+
io::stderr().write_str(#fmt[" %s\n", msg]);
172172
}
173173

174174
fn emit(cmsp: option<(codemap::codemap, span)>,
175175
msg: str, lvl: level) {
176176
alt cmsp {
177177
some((cm, sp)) {
178-
let sp = codemap::adjust_span(cm,sp);
179178
let ss = codemap::span_to_str(sp, cm);
180179
let lines = codemap::span_to_lines(sp, cm);
181180
print_diagnostic(ss, lvl, msg);
@@ -203,10 +202,10 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
203202
}
204203
// Print the offending lines
205204
for line: uint in display_lines {
206-
io::stdout().write_str(#fmt["%s:%u ", fm.name, line + 1u]);
205+
io::stderr().write_str(#fmt["%s:%u ", fm.name, line + 1u]);
207206
let s = codemap::get_line(fm, line as int);
208207
if !str::ends_with(s, "\n") { s += "\n"; }
209-
io::stdout().write_str(s);
208+
io::stderr().write_str(s);
210209
}
211210
if elided {
212211
let last_line = display_lines[vec::len(display_lines) - 1u];
@@ -215,7 +214,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
215214
let out = "";
216215
while indent > 0u { out += " "; indent -= 1u; }
217216
out += "...\n";
218-
io::stdout().write_str(out);
217+
io::stderr().write_str(out);
219218
}
220219

221220

@@ -240,7 +239,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
240239
let width = hi.col - lo.col - 1u;
241240
while width > 0u { str::push_char(s, '~'); width -= 1u; }
242241
}
243-
io::stdout().write_str(s + "\n");
242+
io::stderr().write_str(s + "\n");
244243
}
245244
}
246245

trunk/src/comp/syntax/codemap.rs

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ type file_pos = {ch: uint, byte: uint};
88
* compiler.
99
*/
1010

11-
enum file_substr {
12-
fss_none,
13-
fss_internal(span),
14-
fss_external({filename: str, line: uint, col: uint})
15-
}
11+
type file_substr_ = {lo: uint, hi: uint, col: uint, line: uint};
12+
type file_substr = option<file_substr_>;
1613

1714
type filemap =
1815
@{name: filename, substr: file_substr, src: @str,
@@ -36,14 +33,16 @@ fn new_filemap_w_substr(filename: filename, substr: file_substr,
3633
fn new_filemap(filename: filename, src: @str,
3734
start_pos_ch: uint, start_pos_byte: uint)
3835
-> filemap {
39-
ret new_filemap_w_substr(filename, fss_none, src,
36+
ret new_filemap_w_substr(filename, none, src,
4037
start_pos_ch, start_pos_byte);
4138
}
4239

43-
fn mk_substr_filename(cm: codemap, sp: span) -> str
40+
fn get_substr_info(cm: codemap, lo: uint, hi: uint)
41+
-> (filename, file_substr_)
4442
{
45-
let pos = lookup_char_pos(cm, sp.lo);
46-
ret #fmt("<%s:%u:%u>", pos.file.name, pos.line, pos.col);
43+
let pos = lookup_char_pos(cm, lo);
44+
let name = #fmt("<%s:%u:%u>", pos.file.name, pos.line, pos.col);
45+
ret (name, {lo: lo, hi: hi, col: pos.col, line: pos.line});
4746
}
4847

4948
fn next_line(file: filemap, chpos: uint, byte_pos: uint) {
@@ -90,66 +89,26 @@ fn lookup_byte_pos(map: codemap, pos: uint) -> loc {
9089
ret lookup_pos(map, pos, lookup);
9190
}
9291

93-
fn lookup_char_pos_adj(map: codemap, pos: uint)
94-
-> {filename: str, line: uint, col: uint, file: option<filemap>}
95-
{
96-
let loc = lookup_char_pos(map, pos);
97-
alt (loc.file.substr) {
98-
fss_none {
99-
{filename: loc.file.name, line: loc.line, col: loc.col,
100-
file: some(loc.file)}
101-
}
102-
fss_internal(sp) {
103-
lookup_char_pos_adj(map, sp.lo + (pos - loc.file.start_pos.ch))
104-
}
105-
fss_external(eloc) {
106-
{filename: eloc.filename,
107-
line: eloc.line + loc.line - 1u,
108-
col: if loc.line == 1u {eloc.col + loc.col} else {loc.col},
109-
file: none}
110-
}
111-
}
112-
}
113-
114-
fn adjust_span(map: codemap, sp: span) -> span {
115-
fn lookup(pos: file_pos) -> uint { ret pos.ch; }
116-
let line = lookup_line(map, sp.lo, lookup);
117-
alt (line.fm.substr) {
118-
fss_none {sp}
119-
fss_internal(s) {
120-
adjust_span(map, {lo: s.lo + (sp.lo - line.fm.start_pos.ch),
121-
hi: s.lo + (sp.hi - line.fm.start_pos.ch),
122-
expn_info: sp.expn_info})}
123-
fss_external(_) {sp}
124-
}
125-
}
126-
12792
enum expn_info_ {
12893
expanded_from({call_site: span,
12994
callie: {name: str, span: option<span>}})
13095
}
13196
type expn_info = option<@expn_info_>;
13297
type span = {lo: uint, hi: uint, expn_info: expn_info};
13398

134-
fn span_to_str_no_adj(sp: span, cm: codemap) -> str {
99+
fn span_to_str(sp: span, cm: codemap) -> str {
135100
let lo = lookup_char_pos(cm, sp.lo);
136101
let hi = lookup_char_pos(cm, sp.hi);
137102
ret #fmt("%s:%u:%u: %u:%u", lo.file.name,
138103
lo.line, lo.col, hi.line, hi.col)
139104
}
140105

141-
fn span_to_str(sp: span, cm: codemap) -> str {
142-
let lo = lookup_char_pos_adj(cm, sp.lo);
143-
let hi = lookup_char_pos_adj(cm, sp.hi);
144-
ret #fmt("%s:%u:%u: %u:%u", lo.filename,
145-
lo.line, lo.col, hi.line, hi.col)
146-
}
147-
148106
type file_lines = {file: filemap, lines: [uint]};
149107

150108
fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines {
151109
let lo = lookup_char_pos(cm, sp.lo);
152110
let hi = lookup_char_pos(cm, sp.hi);
111+
// FIXME: Check for filemap?
153112
let lines = [];
154113
uint::range(lo.line - 1u, hi.line as uint) {|i| lines += [i]; };
155114
ret @{file: lo.file, lines: lines};

trunk/src/comp/syntax/ext/expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import std::map::hashmap;
55
import syntax::ast::{crate, expr_, expr_mac, mac_invoc};
66
import syntax::fold::*;
77
import syntax::ext::base::*;
8-
import syntax::ext::qquote::{qq_helper};
8+
import syntax::ext::qquote::{expand_qquote,qq_helper};
99
import syntax::parse::parser::parse_expr_from_source_str;
1010

1111
import codemap::{span, expanded_from};

trunk/src/comp/syntax/ext/qquote.rs

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ fn expand_ast(ecx: ext_ctxt, _sp: span,
143143
}
144144
}
145145
let body = get_mac_body(ecx,_sp,body);
146+
fn finish<T: qq_helper>(ecx: ext_ctxt, body: ast::mac_body_,
147+
f: fn (p: parser) -> T)
148+
-> @ast::expr
149+
{
150+
let cm = ecx.session().parse_sess.cm;
151+
let str = @codemap::span_to_snippet(body.span, cm);
152+
let (fname, ss) = codemap::get_substr_info
153+
(cm, body.span.lo, body.span.hi);
154+
let node = parse_from_source_str
155+
(f, fname, some(ss), str,
156+
ecx.session().opts.cfg, ecx.session().parse_sess);
157+
ret expand_qquote(ecx, node.span(), *str, node);
158+
}
146159

147160
ret alt what {
148161
"expr" {finish(ecx, body, parser::parse_expr)}
@@ -169,33 +182,23 @@ fn parse_item(p: parser) -> @ast::item {
169182
}
170183
}
171184

172-
fn finish<T: qq_helper>
173-
(ecx: ext_ctxt, body: ast::mac_body_, f: fn (p: parser) -> T)
185+
fn expand_qquote<N: qq_helper>
186+
(ecx: ext_ctxt, sp: span, str: str, node: N)
174187
-> @ast::expr
175188
{
176-
let cm = ecx.session().parse_sess.cm;
177-
let str = @codemap::span_to_snippet(body.span, cm);
178-
let fname = codemap::mk_substr_filename(cm, body.span);
179-
let node = parse_from_source_str
180-
(f, fname, codemap::fss_internal(body.span), str,
181-
ecx.session().opts.cfg, ecx.session().parse_sess);
182-
let loc = codemap::lookup_char_pos(cm, body.span.lo);
183-
184-
let sp = node.span();
185189
let qcx = gather_anti_quotes(sp.lo, node);
186190
let cx = qcx;
187-
188-
// assert that the vector is sorted by position:
189-
uint::range(1u, vec::len(cx.gather)) {|i|
190-
assert cx.gather[i-1u].lo < cx.gather[i].lo;
191+
let prev = 0u;
192+
for {lo: lo, _} in cx.gather {
193+
assert lo > prev;
194+
prev = lo;
191195
}
192-
193196
let str2 = "";
194197
enum state {active, skip(uint), blank};
195198
let state = active;
196199
let i = 0u, j = 0u;
197200
let g_len = vec::len(cx.gather);
198-
str::chars_iter(*str) {|ch|
201+
str::chars_iter(str) {|ch|
199202
if (j < g_len && i == cx.gather[j].lo) {
200203
assert ch == '$';
201204
let repl = #fmt("$%u ", j);
@@ -225,12 +228,8 @@ fn finish<T: qq_helper>
225228
["syntax", "parse", "parser",
226229
"parse_from_source_str"],
227230
[node.mk_parse_fn(cx,sp),
228-
mk_str(cx,sp, fname),
229-
mk_call(cx,sp,
230-
["syntax","ext","qquote", "mk_file_substr"],
231-
[mk_str(cx,sp, loc.file.name),
232-
mk_uint(cx,sp, loc.line),
233-
mk_uint(cx,sp, loc.col)]),
231+
mk_str(cx,sp, "<anon>"),
232+
mk_path(cx,sp, ["option","none"]),
234233
mk_unary(cx,sp, ast::box(ast::imm),
235234
mk_str(cx,sp, str2)),
236235
mk_access_(cx,sp,
@@ -307,10 +306,6 @@ fn print_expr(expr: @ast::expr) {
307306
stdout.write_str("\n");
308307
}
309308

310-
fn mk_file_substr(fname: str, line: uint, col: uint) -> codemap::file_substr {
311-
codemap::fss_external({filename: fname, line: line, col: col})
312-
}
313-
314309
// Local Variables:
315310
// mode: rust
316311
// fill-column: 78;

trunk/src/comp/syntax/parse/lexer.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ impl reader for reader {
4343
let next = str::char_range_at(*self.src, self.pos);
4444
self.pos = next.next;
4545
self.curr = next.ch;
46-
} else {
47-
if (self.curr != -1 as char) {
48-
self.col += 1u;
49-
self.chpos += 1u;
50-
self.curr = -1 as char;
51-
}
52-
}
46+
} else { self.curr = -1 as char; }
5347
}
5448
fn fatal(m: str) -> ! {
5549
self.span_diagnostic.span_fatal(

trunk/src/comp/syntax/parse/parser.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import std::{io, fs};
22
import either::{left, right};
33
import std::map::{hashmap, new_str_hash};
44
import token::can_begin_expr;
5-
import codemap::{span,fss_none};
5+
import codemap::span;
66
import util::interner;
77
import ast::{node_id, spanned};
88
import ast_util::{mk_sp, ident_to_path};
@@ -2607,7 +2607,7 @@ fn parse_crate_from_source_file(input: str, cfg: ast::crate_cfg,
26072607

26082608
fn parse_expr_from_source_str(name: str, source: @str, cfg: ast::crate_cfg,
26092609
sess: parse_sess) -> @ast::expr {
2610-
let p = new_parser_from_source_str(sess, cfg, name, fss_none, source);
2610+
let p = new_parser_from_source_str(sess, cfg, name, none, source);
26112611
let r = parse_expr(p);
26122612
sess.chpos = p.reader.chpos;
26132613
sess.byte_pos = sess.byte_pos + p.reader.pos;
@@ -2622,17 +2622,14 @@ fn parse_from_source_str<T>(f: fn (p: parser) -> T,
26222622
{
26232623
let p = new_parser_from_source_str(sess, cfg, name, ss, source);
26242624
let r = f(p);
2625-
if !p.reader.is_eof() {
2626-
p.reader.fatal("expected end-of-string");
2627-
}
26282625
sess.chpos = p.reader.chpos;
26292626
sess.byte_pos = sess.byte_pos + p.reader.pos;
26302627
ret r;
26312628
}
26322629

26332630
fn parse_crate_from_source_str(name: str, source: @str, cfg: ast::crate_cfg,
26342631
sess: parse_sess) -> @ast::crate {
2635-
let p = new_parser_from_source_str(sess, cfg, name, fss_none, source);
2632+
let p = new_parser_from_source_str(sess, cfg, name, none, source);
26362633
let r = parse_crate_mod(p, cfg);
26372634
sess.chpos = p.reader.chpos;
26382635
sess.byte_pos = sess.byte_pos + p.reader.pos;

trunk/src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ fn check_error_patterns(props: test_props,
198198

199199
let next_err_idx = 0u;
200200
let next_err_pat = props.error_patterns[next_err_idx];
201-
for line: str in str::split_byte(procres.stdout, '\n' as u8) {
201+
for line: str in str::split_byte(procres.stderr, '\n' as u8) {
202202
if str::find(line, next_err_pat) > 0 {
203203
#debug("found error pattern %s", next_err_pat);
204204
next_err_idx += 1u;
@@ -245,7 +245,7 @@ fn check_expected_errors(expected_errors: [errors::expected_error],
245245
// filename:line1:col1: line2:col2: *warning:* msg
246246
// where line1:col1: is the starting point, line2:col2:
247247
// is the ending point, and * represents ANSI color codes.
248-
for line: str in str::split_byte(procres.stdout, '\n' as u8) {
248+
for line: str in str::split_byte(procres.stderr, '\n' as u8) {
249249
let was_expected = false;
250250
vec::iteri(expected_errors) {|i, ee|
251251
if !found_flags[i] {

trunk/src/rt/rust_srv.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ rust_srv::realloc(void *p, size_t bytes) {
2525

2626
void
2727
rust_srv::log(char const *msg) {
28-
printf("rust: %s\n", msg);
29-
// FIXME: flushing each time is expensive, but at the moment
30-
// necessary to get output through before a rust_task::fail
31-
// call. This should be changed.
32-
fflush(stdout);
28+
fprintf(stderr, "rust: %s\n", msg);
3329
}
3430

3531
void

0 commit comments

Comments
 (0)