about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <respindola@mozilla.com>2011-06-28 08:21:13 -0400
committerRafael Ávila de Espíndola <respindola@mozilla.com>2011-06-28 08:21:13 -0400
commitecc080ed0b4aa8a93e6e9f190c7e2638ff13bbca (patch)
tree47a496b72d9052e829b476028d2a678d7eda6908 /src
parent663aa7663533b6b1cbeb2229c95b4bbde1a5d18e (diff)
downloadrust-ecc080ed0b4aa8a93e6e9f190c7e2638ff13bbca.tar.gz
rust-ecc080ed0b4aa8a93e6e9f190c7e2638ff13bbca.zip
Use "" in the native_name as an indication that no extra options have to
be passed to the "linker". Use that for libc.
Diffstat (limited to 'src')
-rw-r--r--src/comp/driver/session.rs3
-rw-r--r--src/comp/front/parser.rs2
-rw-r--r--src/comp/metadata/creader.rs10
-rw-r--r--src/lib/linux_os.rs2
-rw-r--r--src/lib/macos_os.rs2
-rw-r--r--src/lib/win32_os.rs2
-rw-r--r--src/test/run-pass/binops.rs2
-rw-r--r--src/test/run-pass/import-glob-1.rs2
-rw-r--r--src/test/run-pass/native-opaque-type.rs2
-rw-r--r--src/test/run-pass/native2.rs8
10 files changed, 16 insertions, 19 deletions
diff --git a/src/comp/driver/session.rs b/src/comp/driver/session.rs
index 30a14f45bd7..da710fd3389 100644
--- a/src/comp/driver/session.rs
+++ b/src/comp/driver/session.rs
@@ -125,6 +125,9 @@ obj session(ast::crate_num cnum,
     }
     fn has_external_crate(int num) -> bool { ret crates.contains_key(num); }
     fn add_used_library(&str lib) {
+        if (lib == "") {
+            ret;
+        }
         // A program has a small number of libraries, so a vector is probably
         // a good data structure in here.
         for (str l in used_libraries) {
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index d153f0273f8..90f8fedb6dc 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -1920,7 +1920,7 @@ fn parse_item_native_mod(&parser p, vec[ast::attribute] attrs) -> @ast::item {
         expect(p, token::EQ);
         native_name = parse_str(p);
     } else {
-        native_name = "";
+        native_name = id;
     }
     expect(p, token::LBRACE);
     auto m = parse_native_mod_items(p, native_name, abi);
diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs
index 9772e7eb817..14118da3c5c 100644
--- a/src/comp/metadata/creader.rs
+++ b/src/comp/metadata/creader.rs
@@ -203,18 +203,12 @@ fn visit_view_item(env e, &@ast::view_item i) {
 fn visit_item(env e, &@ast::item i) {
     alt (i.node) {
         case (ast::item_native_mod(?m)) {
-            auto name;
-            if (m.native_name == "" ) {
-                name = i.ident;
-            } else {
-                name = m.native_name;
-            }
             alt (m.abi) {
                 case (ast::native_abi_rust) {
-                    e.sess.add_used_library(name);
+                    e.sess.add_used_library(m.native_name);
                 }
                 case (ast::native_abi_cdecl) {
-                    e.sess.add_used_library(name);
+                    e.sess.add_used_library(m.native_name);
                 }
                 case (ast::native_abi_llvm) {
                 }
diff --git a/src/lib/linux_os.rs b/src/lib/linux_os.rs
index fbd5c138bdc..92c2d74e496 100644
--- a/src/lib/linux_os.rs
+++ b/src/lib/linux_os.rs
@@ -5,7 +5,7 @@ import vec::vbuf;
 
 // FIXME Somehow merge stuff duplicated here and macosx_os.rs. Made difficult
 // by https://github.com/graydon/rust/issues#issue/268
-native "cdecl" mod libc = "c" {
+native "cdecl" mod libc = "" {
     fn open(sbuf s, int flags, uint mode) -> int;
     fn read(int fd, vbuf buf, uint count) -> int;
     fn write(int fd, vbuf buf, uint count) -> int;
diff --git a/src/lib/macos_os.rs b/src/lib/macos_os.rs
index b20ea8e5019..6ba5e24ac98 100644
--- a/src/lib/macos_os.rs
+++ b/src/lib/macos_os.rs
@@ -2,7 +2,7 @@
 import str::sbuf;
 import vec::vbuf;
 
-native "cdecl" mod libc = "c" {
+native "cdecl" mod libc = "" {
     fn open(sbuf s, int flags, uint mode) -> int;
     fn read(int fd, vbuf buf, uint count) -> int;
     fn write(int fd, vbuf buf, uint count) -> int;
diff --git a/src/lib/win32_os.rs b/src/lib/win32_os.rs
index f8b38b30538..fdd4eea3afc 100644
--- a/src/lib/win32_os.rs
+++ b/src/lib/win32_os.rs
@@ -2,7 +2,7 @@
 import str::sbuf;
 import vec::vbuf;
 
-native "cdecl" mod libc = "c" {
+native "cdecl" mod libc = "" {
     fn open(sbuf s, int flags, uint mode) -> int = "_open";
     fn read(int fd, vbuf buf, uint count) -> int = "_read";
     fn write(int fd, vbuf buf, uint count) -> int = "_write";
diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs
index e265028af8c..4e3dee3ccf9 100644
--- a/src/test/run-pass/binops.rs
+++ b/src/test/run-pass/binops.rs
@@ -112,7 +112,7 @@ fn test_fn() {
   assert (h1 >= h2);
 }
 
-native "rust" mod native_mod = "c" {
+native "rust" mod native_mod = "" {
   fn str_byte_len(str s) -> vec[u8];
   fn str_alloc(uint n_bytes) -> str;
 }
diff --git a/src/test/run-pass/import-glob-1.rs b/src/test/run-pass/import-glob-1.rs
index 717e722a87a..72f44d12c1a 100644
--- a/src/test/run-pass/import-glob-1.rs
+++ b/src/test/run-pass/import-glob-1.rs
@@ -12,7 +12,7 @@ mod a1 {                    //
 }                           //   |   |   |
                             //   |   |   |
 mod a2 {                    //   |   |   |
-  native mod b1 = "c" {     //   |   |   |
+  native mod b1 = "" {      //   |   |   |
     import a1::b2::*;       //   | <-/  -/
     export word_traveler;   //   |
   }                         //   |
diff --git a/src/test/run-pass/native-opaque-type.rs b/src/test/run-pass/native-opaque-type.rs
index 1a304fddf83..fa4a5e25e5a 100644
--- a/src/test/run-pass/native-opaque-type.rs
+++ b/src/test/run-pass/native-opaque-type.rs
@@ -1,6 +1,6 @@
 
 
-native "cdecl" mod libc = "c" {
+native "cdecl" mod libc = "" {
     type file_handle;
 }
 
diff --git a/src/test/run-pass/native2.rs b/src/test/run-pass/native2.rs
index 40bb8304d7f..d03440462ce 100644
--- a/src/test/run-pass/native2.rs
+++ b/src/test/run-pass/native2.rs
@@ -5,14 +5,14 @@ native "rust" mod rustrt {
     fn vec_buf[T](vec[T] v, uint offset) -> vbuf;
 }
 
-native "rust" mod bar = "c" { }
+native "rust" mod bar = "" { }
 
-native "cdecl" mod zed = "c" { }
+native "cdecl" mod zed = "" { }
 
-native "cdecl" mod libc = "c" {
+native "cdecl" mod libc = "" {
     fn write(int fd, rustrt::vbuf buf, uint count) -> int;
 }
 
-native "cdecl" mod baz = "c" { }
+native "cdecl" mod baz = "" { }
 
 fn main(vec[str] args) { }
\ No newline at end of file