auto merge of #11073 : klutzy/rust/issue-10978, r=alexcrichton

This patchset fixes small glitches which caused #10978.
This commit is contained in:
bors 2013-12-19 20:06:36 -08:00
commit bb02d147fe
3 changed files with 11 additions and 1 deletions

View file

@ -7,6 +7,7 @@ import subprocess
f = open(sys.argv[1], 'wb')
components = sys.argv[2].split(' ')
components = [i for i in components if i] # ignore extra whitespaces
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
@ -51,6 +52,10 @@ for llconfig in sys.argv[3:]:
proc = subprocess.Popen(args, stdout = subprocess.PIPE)
out, err = proc.communicate()
if err:
print("failed to run llconfig: args = `{}`".format(args))
sys.exit(1)
for lib in out.strip().split(' '):
lib = lib[2:] # chop of the leading '-l'
f.write("#[link(name = \"" + lib + "\", kind = \"static\")]\n")

View file

@ -219,7 +219,11 @@ fn visit_item(e: &Env, i: @ast::item) {
@"foo"
}
};
cstore::add_used_library(cstore, n.to_owned(), kind);
if n.is_empty() {
e.sess.span_err(m.span, "#[link(name = \"\")] given with empty name");
} else {
cstore::add_used_library(cstore, n.to_owned(), kind);
}
}
None => {}
}

View file

@ -9,6 +9,7 @@
// except according to those terms.
#[link()] //~ ERROR: specified without `name =
#[link(name = "")] //~ ERROR: with empty name
#[link(name = "foo")]
#[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind
extern {}