Skip to content

Commit 4f32740

Browse files
committed
---
yaml --- r: 15694 b: refs/heads/try c: 22254c3 h: refs/heads/master v: v3
1 parent 0fbd0a6 commit 4f32740

File tree

21 files changed

+665
-462
lines changed

21 files changed

+665
-462
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 079c3b02a86aa73d0d070876612ed889dc187354
5+
refs/heads/try: 22254c3b480df40d4d3ca48a36a0f7672b8e19a5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/configure

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ esac
259259

260260
DEFAULT_HOST_TRIPLE="${CFG_CPUTYPE}-${CFG_OSTYPE}"
261261

262-
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
263-
CFG_BUILD_DIR="$(pwd)/"
264-
CFG_SELF=${CFG_SRC_DIR}$(basename $0)
262+
CFG_SELF=$(echo $0 | tr '\\' '/')
263+
CFG_SRC_DIR="$(dirname $CFG_SELF)/"
264+
CFG_BUILD_DIR="$(echo $PWD | tr '\\' '/')/"
265265
CFG_CONFIGURE_ARGS="$@"
266266

267267
OPTIONS=""
@@ -509,25 +509,32 @@ step_msg "configuring submodules"
509509
if [ -z $CFG_DISABLE_MANAGE_SUBMODULES ]
510510
then
511511
cd ${CFG_SRC_DIR}
512-
513512
msg "git: submodule sync"
514-
"${CFG_GIT}" submodule --quiet sync
515-
516-
# NB: this is just for the sake of getting the submodule SHA1 values
517-
# and status written into the build log.
518-
msg "git: submodule status"
519-
"${CFG_GIT}" submodule status --recursive
520-
521-
msg "git: submodule update"
522-
"${CFG_GIT}" submodule --quiet update --init --recursive
523-
need_ok "git failed"
524-
525-
msg "git: submodule clobber"
526-
"${CFG_GIT}" submodule --quiet foreach --recursive git clean -dxf
527-
need_ok "git failed"
528-
"${CFG_GIT}" submodule --quiet foreach --recursive git checkout .
529-
need_ok "git failed"
530-
513+
"${CFG_GIT}" submodule sync --quiet
514+
SUBMODULES=$("${CFG_GIT}" submodule status | awk '{print $2}')
515+
for s in $SUBMODULES
516+
do
517+
msg "git: submodule status ${s}"
518+
status=$("${CFG_GIT}" submodule status ${s} | awk '{print $1}')
519+
case ${status} in
520+
-*)
521+
msg "${s} is not initialized, initializing"
522+
"${CFG_GIT}" submodule init --quiet ${s}
523+
need_ok "git failed"
524+
msg "${s} updating"
525+
"${CFG_GIT}" submodule update --quiet ${s}
526+
need_ok "git failed"
527+
;;
528+
+*)
529+
msg "${s} is not up to date, updating"
530+
"${CFG_GIT}" submodule update --quiet ${s}
531+
need_ok "git failed"
532+
;;
533+
*)
534+
msg "${s} is clean"
535+
;;
536+
esac
537+
done
531538
cd ${CFG_BUILD_DIR}
532539
fi
533540

branches/try/mk/tests.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
120120
tidy:
121121
@$(call E, check: formatting)
122122
$(Q)find $(S)src -name '*.r[sc]' \
123-
| grep '^$(S)src/test' -v \
124123
| xargs -n 10 python $(S)src/etc/tidy.py
125124
$(Q)find $(S)src/etc -name '*.py' \
126125
| xargs -n 10 python $(S)src/etc/tidy.py

branches/try/src/etc/tidy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def report_err(s):
3232
report_err("trailing whitespace")
3333
line_len = len(line)-2 if autocrlf else len(line)-1
3434

35-
if line_len > cols:
35+
# Along long lines if they are part of an expected error message
36+
# in a test, which is denoted with "//!":
37+
if line_len > cols and "//!" not in line:
3638
report_err("line longer than %d chars" % cols)
3739
except UnicodeDecodeError, e:
3840
report_err("UTF-8 decoding error " + str(e))

branches/try/src/libcore/os.rs

Lines changed: 43 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -121,141 +121,61 @@ mod win32 {
121121
}
122122
}
123123

124-
fn getenv(n: str) -> option<str> {
125-
global_env::getenv(n)
126-
}
127-
128-
fn setenv(n: str, v: str) {
129-
global_env::setenv(n, v)
130-
}
131124

132-
mod global_env {
133-
#[doc = "Internal module for serializing access to getenv/setenv"];
134-
135-
export getenv;
136-
export setenv;
137-
138-
native mod rustrt {
139-
fn rust_global_env_chan_ptr() -> *libc::uintptr_t;
140-
}
141-
142-
enum msg {
143-
msg_getenv(str, comm::chan<option<str>>),
144-
msg_setenv(str, str, comm::chan<()>)
145-
}
146-
147-
fn getenv(n: str) -> option<str> {
148-
let env_ch = get_global_env_chan();
149-
let po = comm::port();
150-
comm::send(env_ch, msg_getenv(n, comm::chan(po)));
151-
comm::recv(po)
152-
}
153-
154-
fn setenv(n: str, v: str) {
155-
let env_ch = get_global_env_chan();
156-
let po = comm::port();
157-
comm::send(env_ch, msg_setenv(n, v, comm::chan(po)));
158-
comm::recv(po)
159-
}
160-
161-
fn get_global_env_chan() -> comm::chan<msg> {
162-
let global_ptr = rustrt::rust_global_env_chan_ptr();
163-
let builder_fn = {||
164-
let builder = task::builder();
165-
task::unsupervise(builder);
166-
task::set_opts(builder, {
167-
sched: some({
168-
mode: task::single_threaded,
169-
// FIXME: This would be a good place to use
170-
// a very small native stack
171-
native_stack_size: none
172-
})
173-
with task::get_opts(builder)
174-
});
175-
builder
125+
#[cfg(target_os = "linux")]
126+
#[cfg(target_os = "macos")]
127+
#[cfg(target_os = "freebsd")]
128+
fn getenv(n: str) -> option<str> unsafe {
129+
let s = as_c_charp(n, libc::getenv);
130+
ret if unsafe::reinterpret_cast(s) == 0 {
131+
option::none::<str>
132+
} else {
133+
let s = unsafe::reinterpret_cast(s);
134+
option::some::<str>(str::unsafe::from_buf(s))
176135
};
177-
unsafe {
178-
priv::chan_from_global_ptr(
179-
global_ptr, builder_fn, global_env_task)
180-
}
181-
}
136+
}
182137

183-
fn global_env_task(msg_po: comm::port<msg>) unsafe {
184-
priv::weaken_task {|weak_po|
185-
loop {
186-
alt comm::select2(msg_po, weak_po) {
187-
either::left(msg_getenv(n, resp_ch)) {
188-
comm::send(resp_ch, impl::getenv(n))
189-
}
190-
either::left(msg_setenv(n, v, resp_ch)) {
191-
comm::send(resp_ch, impl::setenv(n, v))
192-
}
193-
either::right(_) {
194-
break;
195-
}
196-
}
197-
}
138+
#[cfg(target_os = "win32")]
139+
fn getenv(n: str) -> option<str> unsafe {
140+
import libc::types::os::arch::extra::*;
141+
import libc::funcs::extra::kernel32::*;
142+
import win32::*;
143+
as_utf16_p(n) {|u|
144+
fill_utf16_buf_and_decode() {|buf, sz|
145+
GetEnvironmentVariableW(u, buf, sz)
198146
}
199147
}
200-
201-
mod impl {
202-
203-
#[cfg(target_os = "linux")]
204-
#[cfg(target_os = "macos")]
205-
#[cfg(target_os = "freebsd")]
206-
fn getenv(n: str) -> option<str> unsafe {
207-
let s = str::as_c_str(n, libc::getenv);
208-
ret if unsafe::reinterpret_cast(s) == 0 {
209-
option::none::<str>
210-
} else {
211-
let s = unsafe::reinterpret_cast(s);
212-
option::some::<str>(str::unsafe::from_buf(s))
213-
};
214-
}
215-
216-
#[cfg(target_os = "win32")]
217-
fn getenv(n: str) -> option<str> unsafe {
218-
import libc::types::os::arch::extra::*;
219-
import libc::funcs::extra::kernel32::*;
220-
import win32::*;
221-
as_utf16_p(n) {|u|
222-
fill_utf16_buf_and_decode() {|buf, sz|
223-
GetEnvironmentVariableW(u, buf, sz)
224-
}
225-
}
226-
}
148+
}
227149

228150

229-
#[cfg(target_os = "linux")]
230-
#[cfg(target_os = "macos")]
231-
#[cfg(target_os = "freebsd")]
232-
fn setenv(n: str, v: str) {
151+
#[cfg(target_os = "linux")]
152+
#[cfg(target_os = "macos")]
153+
#[cfg(target_os = "freebsd")]
154+
fn setenv(n: str, v: str) {
233155

234-
// FIXME: remove this when export globs work properly.
235-
import libc::funcs::posix01::unistd::setenv;
236-
str::as_c_str(n) {|nbuf|
237-
str::as_c_str(v) {|vbuf|
238-
setenv(nbuf, vbuf, 1i32);
239-
}
240-
}
156+
// FIXME: remove this when export globs work properly.
157+
import libc::funcs::posix01::unistd::setenv;
158+
as_c_charp(n) {|nbuf|
159+
as_c_charp(v) {|vbuf|
160+
setenv(nbuf, vbuf, 1i32);
241161
}
162+
}
163+
}
242164

243165

244-
#[cfg(target_os = "win32")]
245-
fn setenv(n: str, v: str) {
246-
// FIXME: remove imports when export globs work properly.
247-
import libc::funcs::extra::kernel32::*;
248-
import win32::*;
249-
as_utf16_p(n) {|nbuf|
250-
as_utf16_p(v) {|vbuf|
251-
SetEnvironmentVariableW(nbuf, vbuf);
252-
}
253-
}
166+
#[cfg(target_os = "win32")]
167+
fn setenv(n: str, v: str) {
168+
// FIXME: remove imports when export globs work properly.
169+
import libc::funcs::extra::kernel32::*;
170+
import win32::*;
171+
as_utf16_p(n) {|nbuf|
172+
as_utf16_p(v) {|vbuf|
173+
SetEnvironmentVariableW(nbuf, vbuf);
254174
}
255-
256175
}
257176
}
258177

178+
259179
fn fdopen(fd: c_int) -> *FILE {
260180
ret as_c_charp("r") {|modebuf|
261181
libc::fdopen(fd, modebuf)
@@ -806,13 +726,15 @@ mod tests {
806726
}
807727

808728
#[test]
729+
#[ignore(reason = "fails periodically on mac")]
809730
fn test_setenv() {
810731
let n = make_rand_name();
811732
setenv(n, "VALUE");
812733
assert getenv(n) == option::some("VALUE");
813734
}
814735

815736
#[test]
737+
#[ignore(reason = "fails periodically on mac")]
816738
fn test_setenv_overwrite() {
817739
let n = make_rand_name();
818740
setenv(n, "1");
@@ -825,6 +747,7 @@ mod tests {
825747
// Windows GetEnvironmentVariable requires some extra work to make sure
826748
// the buffer the variable is copied into is the right size
827749
#[test]
750+
#[ignore(reason = "fails periodically on mac")]
828751
fn test_getenv_big() {
829752
let mut s = "";
830753
let mut i = 0;

branches/try/src/librustsyntax/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl codemap_handler of handler for handler_t {
105105
}
106106

107107
fn ice_msg(msg: str) -> str {
108-
#fmt["internal compiler error: %s", msg]
108+
#fmt["internal compiler error %s", msg]
109109
}
110110

111111
fn mk_span_handler(handler: handler, cm: codemap::codemap) -> span_handler {

branches/try/src/librustsyntax/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: str,
152152
parser {
153153
let src = alt io::read_whole_file_str(path) {
154154
result::ok(src) {
155-
// FIXME: This copy is unfortunate (#2319)
155+
// FIXME: This copy is unfortunate
156156
@src
157157
}
158158
result::err(e) {

branches/try/src/libstd/getopts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Simple getopt alternative.
44
Construct a vector of options, either by using reqopt, optopt, and optflag or
55
by building them from components yourself, and pass them to getopts, along
66
with a vector of actual arguments (not including argv[0]). You'll either get a
7-
failure code back, or a match. You'll have to verify whether the amount of
7+
failure code back, or a match. You'll have to verify whether the amount of
88
'free' arguments in the match is what you expect. Use opt_* accessors to get
99
argument values out of the match object.
1010
1111
Single-character options are expected to appear on the command line with a
12-
single preceeding dash; multiple-character options are expected to be
12+
single preceding dash; multiple-character options are expected to be
1313
proceeded by two dashes. Options that expect an argument accept their argument
1414
following either a space or an equals sign.
1515

0 commit comments

Comments
 (0)