implement #[nolink]; deprecate #[link_name = ""]; note in stdlib to remove empty link_name.
Can't remove them from stdlib until the snapshotted compiler supports #[nolink].
This commit is contained in:
parent
8dc5c445cc
commit
7ddd353ef6
16 changed files with 34 additions and 19 deletions
|
|
@ -57,12 +57,20 @@ fn visit_item(e: env, i: @ast::item) {
|
|||
}
|
||||
either::left(msg) { e.sess.span_fatal(i.span, msg); }
|
||||
}
|
||||
|
||||
let cstore = e.sess.get_cstore();
|
||||
let native_name = i.ident;
|
||||
if vec::len(attr::find_attrs_by_name(i.attrs, "nolink")) > 0u {
|
||||
ret;
|
||||
}
|
||||
alt attr::get_meta_item_value_str_by_name(i.attrs, "link_name") {
|
||||
some(nn) { native_name = nn; }
|
||||
none. { }
|
||||
}
|
||||
if native_name == "" {
|
||||
e.sess.span_fatal(i.span,
|
||||
"empty #[link_name] not allowed; use #[nolink].");
|
||||
}
|
||||
if !cstore::add_used_library(cstore, native_name) { ret; }
|
||||
for a: ast::attribute in
|
||||
attr::find_attrs_by_name(i.attrs, "link_args") {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ fn add_used_library(cstore: cstore, lib: str) -> bool {
|
|||
if lib == "" { ret false; }
|
||||
|
||||
if vec::member(lib, p(cstore).used_libraries) { ret false; }
|
||||
|
||||
p(cstore).used_libraries += [lib];
|
||||
ret true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue