]> git.lizzy.rs Git - rust.git/commitdiff
Remove #[fixed_stack_segment] and #[rust_stack]
authorAlex Crichton <alex@alexcrichton.com>
Wed, 6 Nov 2013 23:16:04 +0000 (15:16 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 11 Nov 2013 18:40:34 +0000 (10:40 -0800)
These two attributes are no longer useful now that Rust has decided to leave
segmented stacks behind. It is assumed that the rust task's stack is always
large enough to make an FFI call (due to the stack being very large).

There's always the case of stack overflow, however, to consider. This does not
change the behavior of stack overflow in Rust. This is still normally triggered
by the __morestack function and aborts the whole process.

C stack overflow will continue to corrupt the stack, however (as it did before
this commit as well). The future improvement of a guard page at the end of every
rust stack is still unimplemented and is intended to be the mechanism through
which we attempt to detect C stack overflow.

Closes #8822
Closes #10155

111 files changed:
doc/tutorial-ffi.md
src/libextra/c_vec.rs
src/libextra/flate.rs
src/libextra/lib.rs
src/libextra/test.rs
src/libextra/time.rs
src/librustc/driver/driver.rs
src/librustc/lib.rs
src/librustc/lib/llvm.rs
src/librustc/middle/lint.rs
src/librustc/middle/stack_check.rs [deleted file]
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/intrinsic.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render.rs
src/librustpkg/path_util.rs
src/librustpkg/tests.rs
src/librustuv/file.rs
src/librustuv/lib.rs
src/librustuv/net.rs
src/librustuv/uvll.rs
src/libstd/c_str.rs
src/libstd/lib.rs
src/libstd/libc.rs
src/libstd/local_data.rs
src/libstd/num/f32.rs
src/libstd/num/f64.rs
src/libstd/os.rs
src/libstd/rand/os.rs
src/libstd/rt/args.rs
src/libstd/rt/basic.rs
src/libstd/rt/context.rs
src/libstd/rt/crate_map.rs
src/libstd/rt/global_heap.rs
src/libstd/rt/io/native/file.rs
src/libstd/rt/io/native/process.rs
src/libstd/rt/io/signal.rs
src/libstd/rt/io/stdio.rs
src/libstd/rt/local_ptr.rs
src/libstd/rt/logging.rs
src/libstd/rt/mod.rs
src/libstd/rt/sched.rs
src/libstd/rt/stack.rs
src/libstd/rt/task.rs
src/libstd/rt/test.rs
src/libstd/rt/thread.rs
src/libstd/rt/thread_local_storage.rs
src/libstd/rt/util.rs
src/libstd/run.rs
src/libstd/task/mod.rs
src/libstd/unstable/dynamic_lib.rs
src/libstd/unstable/intrinsics.rs
src/libstd/unstable/mod.rs
src/libstd/unstable/sync.rs
src/libsyntax/diagnostic.rs
src/libsyntax/ext/expand.rs
src/libsyntax/lib.rs
src/test/auxiliary/extern-crosscrate-source.rs
src/test/bench/core-map.rs
src/test/bench/shootout-fannkuch-redux.rs
src/test/bench/shootout-fasta-redux.rs
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-pidigits.rs
src/test/bench/shootout-reverse-complement.rs
src/test/bench/shootout-spectralnorm.rs
src/test/compile-fail/extern-cstack-lint.rs [deleted file]
src/test/compile-fail/lint-cstack.rs [deleted file]
src/test/compile-fail/lint-unused-unsafe.rs
src/test/compile-fail/variadic-ffi.rs
src/test/run-pass/anon-extern-mod-cross-crate-2.rs
src/test/run-pass/anon-extern-mod.rs
src/test/run-pass/c-stack-returning-int64.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/extern-call-deep.rs
src/test/run-pass/extern-call-deep2.rs
src/test/run-pass/extern-call-direct.rs
src/test/run-pass/extern-call-indirect.rs
src/test/run-pass/extern-call-scrub.rs
src/test/run-pass/extern-crosscrate.rs
src/test/run-pass/extern-pass-TwoU16s.rs
src/test/run-pass/extern-pass-TwoU32s.rs
src/test/run-pass/extern-pass-TwoU64s-ref.rs
src/test/run-pass/extern-pass-TwoU64s.rs
src/test/run-pass/extern-pass-TwoU8s.rs
src/test/run-pass/extern-pass-char.rs
src/test/run-pass/extern-pass-double.rs
src/test/run-pass/extern-pass-u32.rs
src/test/run-pass/extern-pass-u64.rs
src/test/run-pass/extern-return-TwoU16s.rs
src/test/run-pass/extern-return-TwoU32s.rs
src/test/run-pass/extern-return-TwoU64s.rs
src/test/run-pass/extern-return-TwoU8s.rs
src/test/run-pass/extern-stress.rs
src/test/run-pass/extern-yield.rs
src/test/run-pass/foreign-call-no-runtime.rs
src/test/run-pass/foreign-dupe.rs
src/test/run-pass/foreign-fn-linkname.rs
src/test/run-pass/foreign-no-abi.rs
src/test/run-pass/invoke-external-foreign.rs
src/test/run-pass/issue-2214.rs
src/test/run-pass/issue-6470.rs
src/test/run-pass/lint-cstack.rs
src/test/run-pass/newtype-struct-with-dtor.rs
src/test/run-pass/pub-extern-privacy.rs
src/test/run-pass/regions-mock-trans.rs
src/test/run-pass/rename-directory.rs
src/test/run-pass/static-mut-foreign.rs
src/test/run-pass/struct-return.rs
src/test/run-pass/variadic-ffi.rs
src/test/run-pass/x86stdcall2.rs

index 7d975d0ef6248026e45bc95b993aa1e76ca600fa..371e0e2f3e4524588d7197b077d76bf268affe2a 100644 (file)
@@ -19,10 +19,9 @@ extern {
     fn snappy_max_compressed_length(source_length: size_t) -> size_t;
 }
 
-#[fixed_stack_segment]
 fn main() {
     let x = unsafe { snappy_max_compressed_length(100) };
-    println(fmt!("max compressed length of a 100 byte buffer: %?", x));
+    println!("max compressed length of a 100 byte buffer: {}", x);
 }
 ~~~~
 
@@ -36,11 +35,6 @@ interfaces that aren't thread-safe, and almost any function that takes a pointer
 valid for all possible inputs since the pointer could be dangling, and raw pointers fall outside of
 Rust's safe memory model.
 
-Finally, the `#[fixed_stack_segment]` annotation that appears on
-`main()` instructs the Rust compiler that when `main()` executes, it
-should request a "very large" stack segment.  More details on
-stack management can be found in the following sections.
-
 When declaring the argument types to a foreign function, the Rust compiler will not check if the
 declaration is correct, so specifying it correctly is part of keeping the binding correct at
 runtime.
@@ -81,8 +75,6 @@ length is number of elements currently contained, and the capacity is the total
 the allocated memory. The length is less than or equal to the capacity.
 
 ~~~~ {.xfail-test}
-#[fixed_stack_segment]
-#[inline(never)]
 pub fn validate_compressed_buffer(src: &[u8]) -> bool {
     unsafe {
         snappy_validate_compressed_buffer(vec::raw::to_ptr(src), src.len() as size_t) == 0
@@ -94,36 +86,6 @@ The `validate_compressed_buffer` wrapper above makes use of an `unsafe` block, b
 guarantee that calling it is safe for all inputs by leaving off `unsafe` from the function
 signature.
 
-The `validate_compressed_buffer` wrapper is also annotated with two
-attributes `#[fixed_stack_segment]` and `#[inline(never)]`. The
-purpose of these attributes is to guarantee that there will be
-sufficient stack for the C function to execute. This is necessary
-because Rust, unlike C, does not assume that the stack is allocated in
-one continuous chunk. Instead, we rely on a *segmented stack* scheme,
-in which the stack grows and shrinks as necessary.  C code, however,
-expects one large stack, and so callers of C functions must request a
-large stack segment to ensure that the C routine will not run off the
-end of the stack.
-
-The compiler includes a lint mode that will report an error if you
-call a C function without a `#[fixed_stack_segment]` attribute. More
-details on the lint mode are given in a later section.
-
-You may be wondering why we include a `#[inline(never)]` directive.
-This directive informs the compiler never to inline this function.
-While not strictly necessary, it is usually a good idea to use an
-`#[inline(never)]` directive in concert with `#[fixed_stack_segment]`.
-The reason is that if a fn annotated with `fixed_stack_segment` is
-inlined, then its caller also inherits the `fixed_stack_segment`
-annotation. This means that rather than requesting a large stack
-segment only for the duration of the call into C, the large stack
-segment would be used for the entire duration of the caller. This is
-not necessarily *bad* -- it can for example be more efficient,
-particularly if `validate_compressed_buffer()` is called multiple
-times in a row -- but it does work against the purpose of the
-segmented stack scheme, which is to keep stacks small and thus
-conserve address space.
-
 The `snappy_compress` and `snappy_uncompress` functions are more complex, since a buffer has to be
 allocated to hold the output too.
 
@@ -134,8 +96,6 @@ the true length after compression for setting the length.
 
 ~~~~ {.xfail-test}
 pub fn compress(src: &[u8]) -> ~[u8] {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         let srclen = src.len() as size_t;
         let psrc = vec::raw::to_ptr(src);
@@ -156,8 +116,6 @@ format and `snappy_uncompressed_length` will retrieve the exact buffer size requ
 
 ~~~~ {.xfail-test}
 pub fn uncompress(src: &[u8]) -> Option<~[u8]> {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         let srclen = src.len() as size_t;
         let psrc = vec::raw::to_ptr(src);
@@ -181,98 +139,28 @@ pub fn uncompress(src: &[u8]) -> Option<~[u8]> {
 For reference, the examples used here are also available as an [library on
 GitHub](https://github.com/thestinger/rust-snappy).
 
-# Automatic wrappers
-
-Sometimes writing Rust wrappers can be quite tedious.  For example, if
-function does not take any pointer arguments, often there is no need
-for translating types. In such cases, it is usually still a good idea
-to have a Rust wrapper so as to manage the segmented stacks, but you
-can take advantage of the (standard) `externfn!` macro to remove some
-of the tedium.
-
-In the initial section, we showed an extern block that added a call
-to a specific snappy API:
-
-~~~~ {.xfail-test}
-use std::libc::size_t;
-
-#[link_args = "-lsnappy"]
-extern {
-    fn snappy_max_compressed_length(source_length: size_t) -> size_t;
-}
-
-#[fixed_stack_segment]
-fn main() {
-    let x = unsafe { snappy_max_compressed_length(100) };
-    println(fmt!("max compressed length of a 100 byte buffer: %?", x));
-}
-~~~~
-
-To avoid the need to create a wrapper fn for `snappy_max_compressed_length()`,
-and also to avoid the need to think about `#[fixed_stack_segment]`, we
-could simply use the `externfn!` macro instead, as shown here:
-
-~~~~ {.xfail-test}
-use std::libc::size_t;
-
-externfn!(#[link_args = "-lsnappy"]
-          fn snappy_max_compressed_length(source_length: size_t) -> size_t)
-
-fn main() {
-    let x = unsafe { snappy_max_compressed_length(100) };
-    println(fmt!("max compressed length of a 100 byte buffer: %?", x));
-}
-~~~~
-
-As you can see from the example, `externfn!` replaces the extern block
-entirely. After macro expansion, it will create something like this:
-
-~~~~ {.xfail-test}
-use std::libc::size_t;
-
-// Automatically generated by
-//   externfn!(#[link_args = "-lsnappy"]
-//             fn snappy_max_compressed_length(source_length: size_t) -> size_t)
-unsafe fn snappy_max_compressed_length(source_length: size_t) -> size_t {
-    #[fixed_stack_segment]; #[inline(never)];
-    return snappy_max_compressed_length(source_length);
-
-    #[link_args = "-lsnappy"]
-    extern {
-        fn snappy_max_compressed_length(source_length: size_t) -> size_t;
-    }
-}
-
-fn main() {
-    let x = unsafe { snappy_max_compressed_length(100) };
-    println(fmt!("max compressed length of a 100 byte buffer: %?", x));
-}
-~~~~
-
-# Segmented stacks and the linter
-
-By default, whenever you invoke a non-Rust fn, the `cstack` lint will
-check that one of the following conditions holds:
-
-1. The call occurs inside of a fn that has been annotated with
-   `#[fixed_stack_segment]`;
-2. The call occurs inside of an `extern fn`;
-3. The call occurs within a stack closure created by some other
-   safe fn.
-
-All of these conditions ensure that you are running on a large stack
-segment. However, they are sometimes too strict. If your application
-will be making many calls into C, it is often beneficial to promote
-the `#[fixed_stack_segment]` attribute higher up the call chain.  For
-example, the Rust compiler actually labels main itself as requiring a
-`#[fixed_stack_segment]`. In such cases, the linter is just an
-annoyance, because all C calls that occur from within the Rust
-compiler are made on a large stack. Another situation where this
-frequently occurs is on a 64-bit architecture, where large stacks are
-the default. In cases, you can disable the linter by including a
-`#[allow(cstack)]` directive somewhere, which permits violations of
-the "cstack" rules given above (you can also use `#[warn(cstack)]` to
-convert the errors into warnings, if you prefer).
+# Stack management
+
+Rust tasks by default run on a "large stack". This is actually implemented as a
+reserving a large segment of the address space and then lazily mapping in pages
+as they are needed. When calling an external C function, the code is invoked on
+the same stack as the rust stack. This means that there is no extra
+stack-switching mechanism in place because it is assumed that the large stack
+for the rust task is plenty for the C function to have.
+
+A planned future improvement (net yet implemented at the time of this writing)
+is to have a guard page at the end of every rust stack. No rust function will
+hit this guard page (due to rust's usage of LLVM's __morestack). The intention
+for this unmapped page is to prevent infinite recursion in C from overflowing
+onto other rust stacks. If the guard page is hit, then the process will be
+terminated with a message saying that the guard page was hit.
+
+For normal external function usage, this all means that there shouldn't be any
+need for any extra effort on a user's perspective. The C stack naturally
+interleaves with the rust stack, and it's "large enough" for both to
+interoperate. If, however, it is determined that a larger stack is necessary,
+there are appropriate functions in the task spawning API to control the size of
+the stack of the task which is spawned.
 
 # Destructors
 
@@ -296,9 +184,6 @@ pub struct Unique<T> {
 
 impl<T: Send> Unique<T> {
     pub fn new(value: T) -> Unique<T> {
-        #[fixed_stack_segment];
-        #[inline(never)];
-
         unsafe {
             let ptr = malloc(std::mem::size_of::<T>() as size_t) as *mut T;
             assert!(!ptr::is_null(ptr));
@@ -322,9 +207,6 @@ impl<T: Send> Unique<T> {
 #[unsafe_destructor]
 impl<T: Send> Drop for Unique<T> {
     fn drop(&mut self) {
-        #[fixed_stack_segment];
-        #[inline(never)];
-
         unsafe {
             let x = intrinsics::init(); // dummy value to swap in
             // moving the object out is needed to call the destructor
@@ -384,8 +266,8 @@ extern {
 }
 
 fn main() {
-    println(fmt!("You have readline version %d installed.",
-                 rl_readline_version as int));
+    println!("You have readline version {} installed.",
+             rl_readline_version as int);
 }
 ~~~
 
index bd3ce20742ed19e26382382585b7ebec9862afff..205e0be41cb02d488dadebbb9d78814f403f22aa 100644 (file)
@@ -162,7 +162,6 @@ struct LibcFree {
     }
 
     impl Runnable for LibcFree {
-        #[fixed_stack_segment]
         fn run(~self) {
             unsafe {
                 libc::free(self.mem)
@@ -171,9 +170,6 @@ fn run(~self) {
     }
 
     fn malloc(n: size_t) -> CVec<u8> {
-        #[fixed_stack_segment];
-        #[inline(never)];
-
         unsafe {
             let mem = libc::malloc(n);
 
index 3f3b588e8bc183a04701a81ba76d1a0932b38dff..83a3ef60a8aff6aa54183d3cc13a000640118792 100644 (file)
@@ -47,8 +47,6 @@ pub fn tinfl_decompress_mem_to_heap(psrc_buf: *c_void,
 static TDEFL_WRITE_ZLIB_HEADER : c_int = 0x01000; // write zlib header and adler32 checksum
 
 fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> ~[u8] {
-    #[fixed_stack_segment]; #[inline(never)];
-
     do bytes.as_imm_buf |b, len| {
         unsafe {
             let mut outsz : size_t = 0;
@@ -75,8 +73,6 @@ pub fn deflate_bytes_zlib(bytes: &[u8]) -> ~[u8] {
 }
 
 fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> ~[u8] {
-    #[fixed_stack_segment]; #[inline(never)];
-
     do bytes.as_imm_buf |b, len| {
         unsafe {
             let mut outsz : size_t = 0;
index a74c4993be3507e6b317bd9c019481d0f0a2b137..106dc5bf5c9da682e786dbe8759ae2e2b3c3734c 100644 (file)
@@ -38,6 +38,8 @@
 
 #[deny(non_camel_case_types)];
 #[deny(missing_doc)];
+#[allow(unrecognized_lint)]; // NOTE: remove after the next snapshot
+#[allow(cstack)]; // NOTE: remove after the next snapshot.
 
 use std::str::{StrSlice, OwnedStr};
 
index 4cdb3841acf9b0c91c0c3b67df78d0315e907292..04f045c961ff53565f704b3ca8674c0fbf957d73 100644 (file)
@@ -220,8 +220,6 @@ fn optgroups() -> ~[getopts::groups::OptGroup] {
 }
 
 fn usage(binary: &str, helpstr: &str) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     let message = format!("Usage: {} [OPTIONS] [FILTER]", binary);
     println(groups::usage(message, optgroups()));
     println("");
index eff0da96bffbae654c6d630234bca527f03aa45d..aed42e8d7fe965cb59cafb4d43adb78db14e8868 100644 (file)
@@ -63,8 +63,6 @@ fn lt(&self, other: &Timespec) -> bool {
  * nanoseconds since 1970-01-01T00:00:00Z.
  */
 pub fn get_time() -> Timespec {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         let mut sec = 0i64;
         let mut nsec = 0i32;
@@ -79,8 +77,6 @@ pub fn get_time() -> Timespec {
  * in nanoseconds since an unspecified epoch.
  */
 pub fn precise_time_ns() -> u64 {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         let mut ns = 0u64;
         rustrt::precise_time_ns(&mut ns);
@@ -98,8 +94,6 @@ pub fn precise_time_s() -> f64 {
 }
 
 pub fn tzset() {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         rustrt::rust_tzset();
     }
@@ -143,8 +137,6 @@ pub fn empty_tm() -> Tm {
 
 /// Returns the specified time in UTC
 pub fn at_utc(clock: Timespec) -> Tm {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         let Timespec { sec, nsec } = clock;
         let mut tm = empty_tm();
@@ -160,8 +152,6 @@ pub fn now_utc() -> Tm {
 
 /// Returns the specified time in the local timezone
 pub fn at(clock: Timespec) -> Tm {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         let Timespec { sec, nsec } = clock;
         let mut tm = empty_tm();
@@ -179,8 +169,6 @@ pub fn now() -> Tm {
 impl Tm {
     /// Convert time to the seconds from January 1, 1970
     pub fn to_timespec(&self) -> Timespec {
-        #[fixed_stack_segment]; #[inline(never)];
-
         unsafe {
             let sec = match self.tm_gmtoff {
                 0_i32 => rustrt::rust_timegm(self),
@@ -969,7 +957,6 @@ mod tests {
     use std::libc;
 
     #[cfg(windows)]
-    #[fixed_stack_segment]
     fn set_time_zone() {
         // Windows crt doesn't see any environment variable set by
         // `SetEnvironmentVariable`, which `os::setenv` internally uses.
index 34c03ac8e42641bd907f3f0c0edb2ee9ebbdd241..880d79ac48a935f23c451995fbe648617f770be4 100644 (file)
@@ -278,9 +278,6 @@ pub fn phase_3_run_analysis_passes(sess: Session,
     time(time_passes, "loop checking", (), |_|
          middle::check_loop::check_crate(ty_cx, crate));
 
-    time(time_passes, "stack checking", (), |_|
-         middle::stack_check::stack_check_crate(ty_cx, crate));
-
     let middle::moves::MoveMaps {moves_map, moved_variables_set,
                                  capture_map} =
         time(time_passes, "compute moves", (), |_|
@@ -428,7 +425,6 @@ pub fn stop_after_phase_5(sess: Session) -> bool {
     return false;
 }
 
-#[fixed_stack_segment]
 pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
                      outdir: &Option<Path>, output: &Option<Path>) {
     // We need nested scopes here, because the intermediate results can keep
@@ -703,12 +699,7 @@ pub fn build_session_options(binary: @str,
     }
 
     if debugging_opts & session::debug_llvm != 0 {
-        set_llvm_debug();
-
-        fn set_llvm_debug() {
-            #[fixed_stack_segment]; #[inline(never)];
-            unsafe { llvm::LLVMSetDebug(1); }
-        }
+        unsafe { llvm::LLVMSetDebug(1); }
     }
 
     let output_type =
index 8d273e638ee734fe61b63626e5291a05cc1c34b0..798418f52dc74d707ecb92353ad2e1faea7efaa2 100644 (file)
 #[crate_type = "lib"];
 
 #[feature(macro_rules, globs, struct_variant, managed_boxes)];
-
-// Rustc tasks always run on a fixed_stack_segment, so code in this
-// module can call C functions (in particular, LLVM functions) with
-// impunity.
-#[allow(cstack)];
+#[allow(unrecognized_lint)]; // NOTE: remove after the next snapshot
+#[allow(cstack)]; // NOTE: remove after the next snapshot.
 
 extern mod extra;
 extern mod syntax;
@@ -81,7 +78,6 @@ pub mod middle {
     pub mod reachable;
     pub mod graph;
     pub mod cfg;
-    pub mod stack_check;
 }
 
 pub mod front {
index 043b3dcc7aa57a078b06198a579040dcc67def28..14af20f0cb9eed3b5a4b774f61d2ba491fed95e5 100644 (file)
@@ -8,9 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// LLVM wrappers are intended to be called from trans,
-// which already runs in a #[fixed_stack_segment]
-#[allow(cstack)];
 #[allow(non_uppercase_pattern_statics)];
 
 use std::c_str::ToCStr;
index 4517e19f48e3edd138a5d7bab809821df8619372..21a9b1904dd042aa758abd9b7651da30775c8d1e 100644 (file)
@@ -63,7 +63,6 @@
 #[deriving(Clone, Eq)]
 pub enum lint {
     ctypes,
-    cstack,
     unused_imports,
     unnecessary_qualification,
     while_true,
@@ -136,13 +135,6 @@ enum LintSource {
         default: warn
      }),
 
-    ("cstack",
-     LintSpec {
-        lint: cstack,
-        desc: "only invoke foreign functions from fixedstacksegment fns",
-        default: deny
-     }),
-
     ("unused_imports",
      LintSpec {
         lint: unused_imports,
diff --git a/src/librustc/middle/stack_check.rs b/src/librustc/middle/stack_check.rs
deleted file mode 100644 (file)
index fdb7f15..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*!
-
-Lint mode to detect cases where we call non-Rust fns, which do not
-have a stack growth check, from locations not annotated to request
-large stacks.
-
-*/
-
-use middle::lint;
-use middle::ty;
-use syntax::ast;
-use syntax::ast_map;
-use syntax::attr;
-use syntax::codemap::Span;
-use syntax::visit;
-use syntax::visit::Visitor;
-use util::ppaux::Repr;
-
-#[deriving(Clone)]
-struct Context {
-    safe_stack: bool
-}
-
-struct StackCheckVisitor {
-    tcx: ty::ctxt,
-}
-
-impl Visitor<Context> for StackCheckVisitor {
-    fn visit_item(&mut self, i:@ast::item, e:Context) {
-        stack_check_item(self, i, e);
-    }
-    fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
-                b:&ast::Block, s:Span, n:ast::NodeId, e:Context) {
-        stack_check_fn(self, fk, fd, b, s, n, e);
-    }
-    fn visit_expr(&mut self, ex:@ast::Expr, e:Context) {
-        stack_check_expr(self, ex, e);
-    }
-}
-
-pub fn stack_check_crate(tcx: ty::ctxt,
-                         crate: &ast::Crate) {
-    let new_cx = Context { safe_stack: false };
-    let mut visitor = StackCheckVisitor { tcx: tcx };
-    visit::walk_crate(&mut visitor, crate, new_cx);
-}
-
-fn stack_check_item(v: &mut StackCheckVisitor,
-                    item: @ast::item,
-                    in_cx: Context) {
-    match item.node {
-        ast::item_fn(_, ast::extern_fn, _, _, _) => {
-            // an extern fn is already being called from C code...
-            let new_cx = Context {safe_stack: true};
-            visit::walk_item(v, item, new_cx);
-        }
-        ast::item_fn(*) => {
-            let safe_stack = fixed_stack_segment(item.attrs);
-            let new_cx = Context {safe_stack: safe_stack};
-            visit::walk_item(v, item, new_cx);
-        }
-        ast::item_impl(_, _, _, ref methods) => {
-            // visit_method() would make this nicer
-            for &method in methods.iter() {
-                let safe_stack = fixed_stack_segment(method.attrs);
-                let new_cx = Context {safe_stack: safe_stack};
-                visit::walk_method_helper(v, method, new_cx);
-            }
-        }
-        ast::item_trait(_, _, ref methods) => {
-            for method in methods.iter() {
-                match *method {
-                    ast::provided(@ref method) => {
-                        let safe_stack = fixed_stack_segment(method.attrs);
-                        let new_cx = Context {safe_stack: safe_stack};
-                        visit::walk_method_helper(v, method, new_cx);
-                    }
-                    ast::required(*) => ()
-                }
-            }
-        }
-        _ => {
-            visit::walk_item(v, item, in_cx);
-        }
-    }
-
-    fn fixed_stack_segment(attrs: &[ast::Attribute]) -> bool {
-        attr::contains_name(attrs, "fixed_stack_segment")
-    }
-}
-
-fn stack_check_fn<'a>(v: &mut StackCheckVisitor,
-                      fk: &visit::fn_kind,
-                      decl: &ast::fn_decl,
-                      body: &ast::Block,
-                      sp: Span,
-                      id: ast::NodeId,
-                      in_cx: Context) {
-    let safe_stack = match *fk {
-        visit::fk_method(*) | visit::fk_item_fn(*) => {
-            in_cx.safe_stack // see stack_check_item above
-        }
-        visit::fk_anon(*) | visit::fk_fn_block => {
-            match ty::get(ty::node_id_to_type(v.tcx, id)).sty {
-                ty::ty_bare_fn(*) |
-                ty::ty_closure(ty::ClosureTy {sigil: ast::OwnedSigil, _}) => {
-                    false
-                }
-                _ => {
-                    in_cx.safe_stack
-                }
-            }
-        }
-    };
-    let new_cx = Context {safe_stack: safe_stack};
-    debug!("stack_check_fn(safe_stack={}, id={:?})", safe_stack, id);
-    visit::walk_fn(v, fk, decl, body, sp, id, new_cx);
-}
-
-fn stack_check_expr<'a>(v: &mut StackCheckVisitor,
-                        expr: @ast::Expr,
-                        cx: Context) {
-    debug!("stack_check_expr(safe_stack={}, expr={})",
-           cx.safe_stack, expr.repr(v.tcx));
-    if !cx.safe_stack {
-        match expr.node {
-            ast::ExprCall(callee, _, _) => {
-                let callee_ty = ty::expr_ty(v.tcx, callee);
-                debug!("callee_ty={}", callee_ty.repr(v.tcx));
-                match ty::get(callee_ty).sty {
-                    ty::ty_bare_fn(ref fty) => {
-                        if !fty.abis.is_rust() && !fty.abis.is_intrinsic() {
-                            call_to_extern_fn(v, callee);
-                        }
-                    }
-                    _ => {}
-                }
-            }
-            _ => {}
-        }
-    }
-    visit::walk_expr(v, expr, cx);
-}
-
-fn call_to_extern_fn(v: &mut StackCheckVisitor, callee: @ast::Expr) {
-    // Permit direct calls to extern fns that are annotated with
-    // #[rust_stack]. This is naturally a horrible pain to achieve.
-    match callee.node {
-        ast::ExprPath(*) => {
-            match v.tcx.def_map.find(&callee.id) {
-                Some(&ast::DefFn(id, _)) if id.crate == ast::LOCAL_CRATE => {
-                    match v.tcx.items.find(&id.node) {
-                        Some(&ast_map::node_foreign_item(item, _, _, _)) => {
-                            if attr::contains_name(item.attrs, "rust_stack") {
-                                return;
-                            }
-                        }
-                        _ => {}
-                    }
-                }
-                _ => {}
-            }
-        }
-        _ => {}
-    }
-
-    v.tcx.sess.add_lint(lint::cstack,
-                         callee.id,
-                         callee.span,
-                         format!("invoking non-Rust fn in fn without \
-                              \\#[fixed_stack_segment]"));
-}
index 8c9cc3b8e13924c1bf617a26eb5c8f2c8cb6310d..c6b663634f30341d37959389cee008e8169abcc4 100644 (file)
@@ -495,12 +495,6 @@ pub fn set_always_inline(f: ValueRef) {
     lib::llvm::SetFunctionAttribute(f, lib::llvm::AlwaysInlineAttribute)
 }
 
-pub fn set_fixed_stack_segment(f: ValueRef) {
-    do "fixed-stack-segment".with_c_str |buf| {
-        unsafe { llvm::LLVMAddFunctionAttrString(f, buf); }
-    }
-}
-
 pub fn set_no_split_stack(f: ValueRef) {
     do "no-split-stack".with_c_str |buf| {
         unsafe { llvm::LLVMAddFunctionAttrString(f, buf); }
@@ -1889,7 +1883,7 @@ pub fn trans_closure(ccx: @mut CrateContext,
                      self_arg: self_arg,
                      param_substs: Option<@param_substs>,
                      id: ast::NodeId,
-                     attributes: &[ast::Attribute],
+                     _attributes: &[ast::Attribute],
                      output_type: ty::t,
                      maybe_load_env: &fn(@mut FunctionContext)) {
     ccx.stats.n_closures += 1;
@@ -1919,12 +1913,6 @@ pub fn trans_closure(ccx: @mut CrateContext,
     let arg_tys = ty::ty_fn_args(node_id_type(bcx, id));
     let raw_llargs = create_llargs_for_fn_args(fcx, self_arg, decl.inputs);
 
-    // Set the fixed stack segment flag if necessary.
-    if attr::contains_name(attributes, "fixed_stack_segment") {
-        set_no_inline(fcx.llfn);
-        set_fixed_stack_segment(fcx.llfn);
-    }
-
     bcx = copy_args_to_allocas(fcx, bcx, decl.inputs, raw_llargs, arg_tys);
 
     maybe_load_env(fcx);
index a7af10b491ee6d9443035178f5996ec16572cb10..38bffd4f6e51593f5ca29e037fbf9fe82049b71b 100644 (file)
@@ -25,7 +25,6 @@
 use middle::ty;
 use syntax::ast;
 use syntax::ast_map;
-use syntax::attr;
 use util::ppaux::ty_to_str;
 use middle::trans::machine::llsize_of;
 use middle::trans::type_::Type;
@@ -35,7 +34,7 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
                        item: &ast::foreign_item,
                        path: ast_map::path,
                        substs: @param_substs,
-                       attributes: &[ast::Attribute],
+                       _attributes: &[ast::Attribute],
                        ref_id: Option<ast::NodeId>) {
     debug!("trans_intrinsic(item.ident={})", ccx.sess.str_of(item.ident));
 
@@ -149,11 +148,6 @@ fn count_zeros_intrinsic(bcx: @mut Block, name: &'static str) {
 
     set_always_inline(fcx.llfn);
 
-    // Set the fixed stack segment flag if necessary.
-    if attr::contains_name(attributes, "fixed_stack_segment") {
-        set_fixed_stack_segment(fcx.llfn);
-    }
-
     let mut bcx = fcx.entry_bcx.unwrap();
     let first_real_arg = fcx.arg_pos(0u);
 
index fbe7a965615359dd3a5abdf61aeba16c16cd36c0..cb9ced6b19d5b68269165b00dcaac0d8c10f9163 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[allow(cstack)]; // each rendering task runs on a fixed stack segment.
-
 //! Markdown formatting for rustdoc
 //!
 //! This module implements markdown formatting through the sundown C-library
index 0efc52bbe4a676332075f017af341449b541dc03..4b6092abb48e01f763d13736e32d85bcd0e9b04f 100644 (file)
@@ -717,7 +717,6 @@ fn worker(cache: RWArc<Cache>,
                       port: &SharedPort<Work>,
                       chan: &SharedChan<Work>,
                       prog_chan: &SharedChan<Progress>) {
-                #[fixed_stack_segment]; // we hit markdown FFI *a lot*
                 local_data::set(cache_key, cache);
 
                 loop {
index 949efacaa1196f7e9c53317fc0f2d70611ba231d..56cf073cbdf63800e173f49e4f156a9c5cb672e8 100644 (file)
@@ -462,7 +462,6 @@ pub fn versionize(p: &Path, v: &Version) -> Path {
 
 #[cfg(target_os = "win32")]
 pub fn chmod_read_only(p: &Path) -> bool {
-    #[fixed_stack_segment];
     unsafe {
         do p.with_c_str |src_buf| {
             libc::chmod(src_buf, S_IRUSR as libc::c_int) == 0 as libc::c_int
@@ -472,7 +471,6 @@ pub fn chmod_read_only(p: &Path) -> bool {
 
 #[cfg(not(target_os = "win32"))]
 pub fn chmod_read_only(p: &Path) -> bool {
-    #[fixed_stack_segment];
     unsafe {
         do p.with_c_str |src_buf| {
             libc::chmod(src_buf, S_IRUSR as libc::mode_t) == 0
index 4460d1701b54a3dbe9aee78bcbf05b0d9743ff5a..b65e1b7ba0286b5a91f1d061fabd57ca0cb2bbec 100644 (file)
@@ -2319,7 +2319,7 @@ fn test_c_dependency_ok() {
     let dir = dir.path();
     writeFile(&dir.join_many(["src", "cdep-0.1", "main.rs"]),
               "#[link_args = \"-lfoo\"]\nextern { fn f(); } \
-              \n#[fixed_stack_segment]\nfn main() { unsafe { f(); } }");
+              \nfn main() { unsafe { f(); } }");
     writeFile(&dir.join_many(["src", "cdep-0.1", "foo.c"]), "void f() {}");
 
     debug!("dir = {}", dir.display());
@@ -2340,7 +2340,7 @@ fn test_c_dependency_no_rebuilding() {
     let dir = dir.path();
     writeFile(&dir.join_many(["src", "cdep-0.1", "main.rs"]),
               "#[link_args = \"-lfoo\"]\nextern { fn f(); } \
-              \n#[fixed_stack_segment]\nfn main() { unsafe { f(); } }");
+              \nfn main() { unsafe { f(); } }");
     writeFile(&dir.join_many(["src", "cdep-0.1", "foo.c"]), "void f() {}");
 
     debug!("dir = {}", dir.display());
@@ -2371,7 +2371,7 @@ fn test_c_dependency_yes_rebuilding() {
     let dir = dir.path();
     writeFile(&dir.join_many(["src", "cdep-0.1", "main.rs"]),
               "#[link_args = \"-lfoo\"]\nextern { fn f(); } \
-              \n#[fixed_stack_segment]\nfn main() { unsafe { f(); } }");
+              \nfn main() { unsafe { f(); } }");
     let c_file_name = dir.join_many(["src", "cdep-0.1", "foo.c"]);
     writeFile(&c_file_name, "void f() {}");
 
index a5848194d05bbb0ff1fe9923bc52feb3777e8205..67fa424af1ae444859d1697e44dff3e95b6ed699 100644 (file)
@@ -361,7 +361,6 @@ fn base_write(&mut self, buf: &[u8], offset: i64) -> Result<(), IoError> {
     }
     fn seek_common(&mut self, pos: i64, whence: c_int) ->
         Result<u64, IoError>{
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             match libc::lseek(self.fd, pos as libc::off_t, whence) {
                 -1 => {
index edb1953b9b1c39b2716f2e980c55ea69f83a908c..599cd01c46096b276e5dbb2068b7ce5322b4ad3e 100644 (file)
@@ -44,6 +44,8 @@
 #[crate_type = "lib"];
 
 #[feature(macro_rules, globs)];
+#[allow(unrecognized_lint)]; // NOTE: remove after the next snapshot
+#[allow(cstack)]; // NOTE: remove after the next snapshot.
 
 use std::cast::transmute;
 use std::cast;
index 32c9b6c3d172999f6efffb262b81ca3624840784..8e649bbc17abfb61188870a76be236e35c2c3bba 100644 (file)
@@ -35,7 +35,6 @@
 /// Generic functions related to dealing with sockaddr things
 ////////////////////////////////////////////////////////////////////////////////
 
-#[fixed_stack_segment]
 fn socket_addr_as_sockaddr<T>(addr: SocketAddr, f: &fn(*sockaddr) -> T) -> T {
     let malloc = match addr.ip {
         Ipv4Addr(*) => uvll::rust_malloc_ip4_addr,
@@ -51,7 +50,6 @@ fn socket_addr_as_sockaddr<T>(addr: SocketAddr, f: &fn(*sockaddr) -> T) -> T {
     }
 }
 
-#[fixed_stack_segment]
 pub fn sockaddr_to_socket_addr(addr: *sockaddr) -> SocketAddr {
     unsafe {
         let ip_size = if uvll::rust_is_ipv4_sockaddr(addr) == 1 {
@@ -112,7 +110,6 @@ enum SocketNameKind {
     Udp
 }
 
-#[fixed_stack_segment]
 fn socket_name(sk: SocketNameKind, handle: *c_void) -> Result<SocketAddr, IoError> {
     unsafe {
         let getsockname = match sk {
index c76d03bfe6c33a6985ef182f9b020646b7c1c2ff..c802803251090deecd82751909d825b101ffadc0 100644 (file)
@@ -364,8 +364,6 @@ pub enum uv_membership {
 }
 
 pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     assert!(handle != UV_UNKNOWN_HANDLE && handle != UV_HANDLE_TYPE_MAX);
     let size = uv_handle_size(handle);
     let p = malloc(size);
@@ -374,14 +372,10 @@ pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
 }
 
 pub unsafe fn free_handle(v: *c_void) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     free(v)
 }
 
 pub unsafe fn malloc_req(req: uv_req_type) -> *c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     assert!(req != UV_UNKNOWN_REQ && req != UV_REQ_TYPE_MAX);
     let size = uv_req_size(req);
     let p = malloc(size);
@@ -390,14 +384,11 @@ pub unsafe fn malloc_req(req: uv_req_type) -> *c_void {
 }
 
 pub unsafe fn free_req(v: *c_void) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     free(v)
 }
 
 #[test]
 fn handle_sanity_check() {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         assert_eq!(UV_HANDLE_TYPE_MAX as uint, rust_uv_handle_type_max());
     }
@@ -405,7 +396,6 @@ fn handle_sanity_check() {
 
 #[test]
 fn request_sanity_check() {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         assert_eq!(UV_REQ_TYPE_MAX as uint, rust_uv_req_type_max());
     }
@@ -413,132 +403,113 @@ fn request_sanity_check() {
 
 // XXX Event loops ignore SIGPIPE by default.
 pub unsafe fn loop_new() -> *c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     return rust_uv_loop_new();
 }
 
-pub unsafe fn get_udp_handle_from_send_req(send_req: *uv_udp_send_t) -> *uv_udp_t {
-    #[fixed_stack_segment]; #[inline(never)];
-
-    return rust_uv_get_udp_handle_from_send_req(send_req);
-}
-
 pub unsafe fn uv_write(req: *uv_write_t,
                        stream: *uv_stream_t,
                        buf_in: &[uv_buf_t],
                        cb: uv_write_cb) -> c_int {
-    externfn!(fn uv_write(req: *uv_write_t, stream: *uv_stream_t,
-                          buf_in: *uv_buf_t, buf_cnt: c_int,
-                          cb: uv_write_cb) -> c_int)
+    extern {
+        fn uv_write(req: *uv_write_t, stream: *uv_stream_t,
+                    buf_in: *uv_buf_t, buf_cnt: c_int,
+                    cb: uv_write_cb) -> c_int;
+    }
 
     let buf_ptr = vec::raw::to_ptr(buf_in);
     let buf_cnt = buf_in.len() as i32;
     return uv_write(req, stream, buf_ptr, buf_cnt, cb);
 }
 
+pub unsafe fn uv_udp_send(req: *uv_udp_send_t,
+                          handle: *uv_udp_t,
+                          buf_in: &[uv_buf_t],
+                          addr: *sockaddr,
+                          cb: uv_udp_send_cb) -> c_int {
+    extern {
+        fn uv_udp_send(req: *uv_write_t, stream: *uv_stream_t,
+                       buf_in: *uv_buf_t, buf_cnt: c_int, addr: *sockaddr,
+                       cb: uv_udp_send_cb) -> c_int;
+    }
+
+    let buf_ptr = vec::raw::to_ptr(buf_in);
+    let buf_cnt = buf_in.len() as i32;
+    return uv_udp_send(req, handle, buf_ptr, buf_cnt, addr, cb);
+}
+
+pub unsafe fn get_udp_handle_from_send_req(send_req: *uv_udp_send_t) -> *uv_udp_t {
+    return rust_uv_get_udp_handle_from_send_req(send_req);
+}
+
 pub unsafe fn process_pid(p: *uv_process_t) -> c_int {
-    #[fixed_stack_segment]; #[inline(never)];
+
     return rust_uv_process_pid(p);
 }
 
 pub unsafe fn set_stdio_container_flags(c: *uv_stdio_container_t,
                                         flags: libc::c_int) {
-    #[fixed_stack_segment]; #[inline(never)];
+
     rust_set_stdio_container_flags(c, flags);
 }
 
 pub unsafe fn set_stdio_container_fd(c: *uv_stdio_container_t,
                                      fd: libc::c_int) {
-    #[fixed_stack_segment]; #[inline(never)];
+
     rust_set_stdio_container_fd(c, fd);
 }
 
 pub unsafe fn set_stdio_container_stream(c: *uv_stdio_container_t,
                                          stream: *uv_stream_t) {
-    #[fixed_stack_segment]; #[inline(never)];
     rust_set_stdio_container_stream(c, stream);
 }
 
 // data access helpers
 pub unsafe fn get_result_from_fs_req(req: *uv_fs_t) -> c_int {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_get_result_from_fs_req(req)
 }
 pub unsafe fn get_ptr_from_fs_req(req: *uv_fs_t) -> *libc::c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_get_ptr_from_fs_req(req)
 }
 pub unsafe fn get_path_from_fs_req(req: *uv_fs_t) -> *c_char {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_get_path_from_fs_req(req)
 }
 pub unsafe fn get_loop_from_fs_req(req: *uv_fs_t) -> *uv_loop_t {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_get_loop_from_fs_req(req)
 }
 pub unsafe fn get_loop_from_getaddrinfo_req(req: *uv_getaddrinfo_t) -> *uv_loop_t {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_get_loop_from_getaddrinfo_req(req)
 }
 pub unsafe fn get_loop_for_uv_handle<T>(handle: *T) -> *c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     return rust_uv_get_loop_for_uv_handle(handle as *c_void);
 }
 pub unsafe fn get_stream_handle_from_connect_req(connect: *uv_connect_t) -> *uv_stream_t {
-    #[fixed_stack_segment]; #[inline(never)];
-
     return rust_uv_get_stream_handle_from_connect_req(connect);
 }
 pub unsafe fn get_stream_handle_from_write_req(write_req: *uv_write_t) -> *uv_stream_t {
-    #[fixed_stack_segment]; #[inline(never)];
-
     return rust_uv_get_stream_handle_from_write_req(write_req);
 }
 pub unsafe fn get_data_for_uv_loop(loop_ptr: *c_void) -> *c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_get_data_for_uv_loop(loop_ptr)
 }
 pub unsafe fn set_data_for_uv_loop(loop_ptr: *c_void, data: *c_void) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_set_data_for_uv_loop(loop_ptr, data);
 }
 pub unsafe fn get_data_for_uv_handle<T>(handle: *T) -> *c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     return rust_uv_get_data_for_uv_handle(handle as *c_void);
 }
 pub unsafe fn set_data_for_uv_handle<T, U>(handle: *T, data: *U) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_set_data_for_uv_handle(handle as *c_void, data as *c_void);
 }
 pub unsafe fn get_data_for_req<T>(req: *T) -> *c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     return rust_uv_get_data_for_req(req as *c_void);
 }
 pub unsafe fn set_data_for_req<T, U>(req: *T, data: *U) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_set_data_for_req(req as *c_void, data as *c_void);
 }
 pub unsafe fn populate_stat(req_in: *uv_fs_t, stat_out: *uv_stat_t) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_populate_uv_stat(req_in, stat_out)
 }
 pub unsafe fn guess_handle(handle: c_int) -> c_int {
-    #[fixed_stack_segment]; #[inline(never)];
-
     rust_uv_guess_handle(handle)
 }
 
@@ -594,172 +565,158 @@ fn rust_set_stdio_container_stream(c: *uv_stdio_container_t,
                                        stream: *uv_stream_t);
     fn rust_uv_process_pid(p: *uv_process_t) -> c_int;
     fn rust_uv_guess_handle(fd: c_int) -> c_int;
-}
-
-// generic uv functions
-externfn!(fn uv_loop_delete(l: *uv_loop_t))
-externfn!(fn uv_handle_size(ty: uv_handle_type) -> size_t)
-externfn!(fn uv_req_size(ty: uv_req_type) -> size_t)
-externfn!(fn uv_run(l: *uv_loop_t, mode: uv_run_mode) -> c_int)
-externfn!(fn uv_close(h: *uv_handle_t, cb: uv_close_cb))
-externfn!(fn uv_walk(l: *uv_loop_t, cb: uv_walk_cb, arg: *c_void))
-externfn!(fn uv_buf_init(base: *c_char, len: c_uint) -> uv_buf_t)
-externfn!(fn uv_strerror(err: c_int) -> *c_char)
-externfn!(fn uv_err_name(err: c_int) -> *c_char)
-externfn!(fn uv_listen(s: *uv_stream_t, backlog: c_int,
-                       cb: uv_connection_cb) -> c_int)
-externfn!(fn uv_accept(server: *uv_stream_t, client: *uv_stream_t) -> c_int)
-externfn!(fn uv_read_start(stream: *uv_stream_t,
-                           on_alloc: uv_alloc_cb,
-                           on_read: uv_read_cb) -> c_int)
-externfn!(fn uv_read_stop(stream: *uv_stream_t) -> c_int)
-
-// idle bindings
-externfn!(fn uv_idle_init(l: *uv_loop_t, i: *uv_idle_t) -> c_int)
-externfn!(fn uv_idle_start(i: *uv_idle_t, cb: uv_idle_cb) -> c_int)
-externfn!(fn uv_idle_stop(i: *uv_idle_t) -> c_int)
-
-// async bindings
-externfn!(fn uv_async_init(l: *uv_loop_t, a: *uv_async_t,
-                           cb: uv_async_cb) -> c_int)
-externfn!(fn uv_async_send(a: *uv_async_t))
-
-// tcp bindings
-externfn!(fn uv_tcp_init(l: *uv_loop_t, h: *uv_tcp_t) -> c_int)
-externfn!(fn uv_tcp_connect(c: *uv_connect_t, h: *uv_tcp_t,
-                            addr: *sockaddr, cb: uv_connect_cb) -> c_int)
-externfn!(fn uv_tcp_bind(t: *uv_tcp_t, addr: *sockaddr) -> c_int)
-externfn!(fn uv_ip4_name(src: *sockaddr, dst: *c_char,
-                         size: size_t) -> c_int)
-externfn!(fn uv_ip6_name(src: *sockaddr, dst: *c_char,
-                         size: size_t) -> c_int)
-externfn!(fn uv_tcp_nodelay(h: *uv_tcp_t, enable: c_int) -> c_int)
-externfn!(fn uv_tcp_keepalive(h: *uv_tcp_t, enable: c_int,
-                              delay: c_uint) -> c_int)
-externfn!(fn uv_tcp_simultaneous_accepts(h: *uv_tcp_t, enable: c_int) -> c_int)
-externfn!(fn uv_tcp_getsockname(h: *uv_tcp_t, name: *sockaddr,
-                                len: *mut c_int) -> c_int)
-externfn!(fn uv_tcp_getpeername(h: *uv_tcp_t, name: *sockaddr,
-                                len: *mut c_int) -> c_int)
-externfn!(fn uv_ip4_addr(ip: *c_char, port: c_int, addr: *sockaddr) -> c_int)
-externfn!(fn uv_ip6_addr(ip: *c_char, port: c_int, addr: *sockaddr) -> c_int)
-
-// udp bindings
-externfn!(fn uv_udp_init(l: *uv_loop_t, h: *uv_udp_t) -> c_int)
-externfn!(fn uv_udp_bind(h: *uv_udp_t, addr: *sockaddr, flags: c_uint) -> c_int)
-externfn!(fn uv_udp_recv_start(server: *uv_udp_t,
-                               on_alloc: uv_alloc_cb,
-                               on_recv: uv_udp_recv_cb) -> c_int)
-externfn!(fn uv_udp_set_membership(handle: *uv_udp_t, multicast_addr: *c_char,
-                                   interface_addr: *c_char,
-                                   membership: uv_membership) -> c_int)
-externfn!(fn uv_udp_recv_stop(server: *uv_udp_t) -> c_int)
-externfn!(fn uv_udp_set_multicast_loop(handle: *uv_udp_t, on: c_int) -> c_int)
-externfn!(fn uv_udp_set_multicast_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int)
-externfn!(fn uv_udp_set_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int)
-externfn!(fn uv_udp_set_broadcast(handle: *uv_udp_t, on: c_int) -> c_int)
-externfn!(fn uv_udp_getsockname(h: *uv_udp_t, name: *sockaddr,
-                                len: *mut c_int) -> c_int)
-
-pub unsafe fn uv_udp_send(req: *uv_udp_send_t,
-                          handle: *uv_udp_t,
-                          buf_in: &[uv_buf_t],
-                          addr: *sockaddr,
-                          cb: uv_udp_send_cb) -> c_int {
-    externfn!(fn uv_udp_send(req: *uv_write_t, stream: *uv_stream_t,
-                             buf_in: *uv_buf_t, buf_cnt: c_int, addr: *sockaddr,
-                             cb: uv_udp_send_cb) -> c_int)
 
-    let buf_ptr = vec::raw::to_ptr(buf_in);
-    let buf_cnt = buf_in.len() as i32;
-    return uv_udp_send(req, handle, buf_ptr, buf_cnt, addr, cb);
+    // generic uv functions
+    pub fn uv_loop_delete(l: *uv_loop_t);
+    pub fn uv_handle_size(ty: uv_handle_type) -> size_t;
+    pub fn uv_req_size(ty: uv_req_type) -> size_t;
+    pub fn uv_run(l: *uv_loop_t, mode: uv_run_mode) -> c_int;
+    pub fn uv_close(h: *uv_handle_t, cb: uv_close_cb);
+    pub fn uv_walk(l: *uv_loop_t, cb: uv_walk_cb, arg: *c_void);
+    pub fn uv_buf_init(base: *c_char, len: c_uint) -> uv_buf_t;
+    pub fn uv_strerror(err: c_int) -> *c_char;
+    pub fn uv_err_name(err: c_int) -> *c_char;
+    pub fn uv_listen(s: *uv_stream_t, backlog: c_int,
+                     cb: uv_connection_cb) -> c_int;
+    pub fn uv_accept(server: *uv_stream_t, client: *uv_stream_t) -> c_int;
+    pub fn uv_read_start(stream: *uv_stream_t,
+                         on_alloc: uv_alloc_cb,
+                         on_read: uv_read_cb) -> c_int;
+    pub fn uv_read_stop(stream: *uv_stream_t) -> c_int;
+
+    // idle bindings
+    pub fn uv_idle_init(l: *uv_loop_t, i: *uv_idle_t) -> c_int;
+    pub fn uv_idle_start(i: *uv_idle_t, cb: uv_idle_cb) -> c_int;
+    pub fn uv_idle_stop(i: *uv_idle_t) -> c_int;
+
+    // async bindings
+    pub fn uv_async_init(l: *uv_loop_t, a: *uv_async_t,
+                         cb: uv_async_cb) -> c_int;
+    pub fn uv_async_send(a: *uv_async_t);
+
+    // tcp bindings
+    pub fn uv_tcp_init(l: *uv_loop_t, h: *uv_tcp_t) -> c_int;
+    pub fn uv_tcp_connect(c: *uv_connect_t, h: *uv_tcp_t,
+                          addr: *sockaddr, cb: uv_connect_cb) -> c_int;
+    pub fn uv_tcp_bind(t: *uv_tcp_t, addr: *sockaddr) -> c_int;
+    pub fn uv_ip4_name(src: *sockaddr, dst: *c_char,
+                       size: size_t) -> c_int;
+    pub fn uv_ip6_name(src: *sockaddr, dst: *c_char,
+                       size: size_t) -> c_int;
+    pub fn uv_tcp_nodelay(h: *uv_tcp_t, enable: c_int) -> c_int;
+    pub fn uv_tcp_keepalive(h: *uv_tcp_t, enable: c_int,
+                            delay: c_uint) -> c_int;
+    pub fn uv_tcp_simultaneous_accepts(h: *uv_tcp_t, enable: c_int) -> c_int;
+    pub fn uv_tcp_getsockname(h: *uv_tcp_t, name: *sockaddr,
+                              len: *mut c_int) -> c_int;
+    pub fn uv_tcp_getpeername(h: *uv_tcp_t, name: *sockaddr,
+                              len: *mut c_int) -> c_int;
+    pub fn uv_ip4_addr(ip: *c_char, port: c_int, addr: *sockaddr) -> c_int;
+    pub fn uv_ip6_addr(ip: *c_char, port: c_int, addr: *sockaddr) -> c_int;
+
+    // udp bindings
+    pub fn uv_udp_init(l: *uv_loop_t, h: *uv_udp_t) -> c_int;
+    pub fn uv_udp_bind(h: *uv_udp_t, addr: *sockaddr, flags: c_uint) -> c_int;
+    pub fn uv_udp_recv_start(server: *uv_udp_t,
+                             on_alloc: uv_alloc_cb,
+                             on_recv: uv_udp_recv_cb) -> c_int;
+    pub fn uv_udp_set_membership(handle: *uv_udp_t, multicast_addr: *c_char,
+                                 interface_addr: *c_char,
+                                 membership: uv_membership) -> c_int;
+    pub fn uv_udp_recv_stop(server: *uv_udp_t) -> c_int;
+    pub fn uv_udp_set_multicast_loop(handle: *uv_udp_t, on: c_int) -> c_int;
+    pub fn uv_udp_set_multicast_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
+    pub fn uv_udp_set_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
+    pub fn uv_udp_set_broadcast(handle: *uv_udp_t, on: c_int) -> c_int;
+    pub fn uv_udp_getsockname(h: *uv_udp_t, name: *sockaddr,
+                              len: *mut c_int) -> c_int;
+
+    // timer bindings
+    pub fn uv_timer_init(l: *uv_loop_t, t: *uv_timer_t) -> c_int;
+    pub fn uv_timer_start(t: *uv_timer_t, cb: uv_timer_cb,
+                          timeout: libc::uint64_t,
+                          repeat: libc::uint64_t) -> c_int;
+    pub fn uv_timer_stop(handle: *uv_timer_t) -> c_int;
+
+    // fs operations
+    pub fn uv_fs_open(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+                      flags: c_int, mode: c_int, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_unlink(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+                        cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_write(l: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
+                       len: size_t, offset: i64, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
+                      len: size_t, offset: i64, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_close(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
+                       cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_stat(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+                      cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_fstat(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
+                       cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_mkdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+                       mode: c_int, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_rmdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+                       cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_readdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+                         flags: c_int, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_req_cleanup(req: *uv_fs_t);
+    pub fn uv_fs_fsync(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
+                       cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_fdatasync(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
+                           cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_ftruncate(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
+                           offset: i64, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_readlink(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
+                          cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_symlink(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
+                         dst: *c_char, flags: c_int, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_rename(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
+                        dst: *c_char, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_utime(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+                       atime: c_double, mtime: c_double,
+                       cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_link(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
+                      dst: *c_char, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_chown(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
+                       uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_chmod(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
+                       mode: c_int, cb: uv_fs_cb) -> c_int;
+    pub fn uv_fs_lstat(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
+                       cb: uv_fs_cb) -> c_int;
+
+    // getaddrinfo
+    pub fn uv_getaddrinfo(loop_: *uv_loop_t, req: *uv_getaddrinfo_t,
+                          getaddrinfo_cb: uv_getaddrinfo_cb,
+                          node: *c_char, service: *c_char,
+                          hints: *addrinfo) -> c_int;
+    pub fn uv_freeaddrinfo(ai: *addrinfo);
+
+    // process spawning
+    pub fn uv_spawn(loop_ptr: *uv_loop_t, outptr: *uv_process_t,
+                    options: *uv_process_options_t) -> c_int;
+    pub fn uv_process_kill(p: *uv_process_t, signum: c_int) -> c_int;
+
+    // pipes
+    pub fn uv_pipe_init(l: *uv_loop_t, p: *uv_pipe_t, ipc: c_int) -> c_int;
+    pub fn uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
+    pub fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
+    pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
+                           name: *c_char, cb: uv_connect_cb);
+
+    // tty
+    pub fn uv_tty_init(l: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
+                       readable: c_int) -> c_int;
+    pub fn uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
+    pub fn uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
+                              height: *c_int) -> c_int;
+
+    // signals
+    pub fn uv_signal_init(loop_: *uv_loop_t, handle: *uv_signal_t) -> c_int;
+    pub fn uv_signal_start(h: *uv_signal_t, cb: uv_signal_cb,
+                           signum: c_int) -> c_int;
+    pub fn uv_signal_stop(handle: *uv_signal_t) -> c_int;
 }
 
-// timer bindings
-externfn!(fn uv_timer_init(l: *uv_loop_t, t: *uv_timer_t) -> c_int)
-externfn!(fn uv_timer_start(t: *uv_timer_t, cb: uv_timer_cb,
-                            timeout: libc::uint64_t,
-                            repeat: libc::uint64_t) -> c_int)
-externfn!(fn uv_timer_stop(handle: *uv_timer_t) -> c_int)
-
-// fs operations
-externfn!(fn uv_fs_open(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                        flags: c_int, mode: c_int, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_unlink(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                          cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_write(l: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
-                         len: size_t, offset: i64, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
-                        len: size_t, offset: i64, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_close(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
-                         cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_stat(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                        cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_fstat(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
-                         cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_mkdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                         mode: c_int, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_rmdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                         cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_readdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                           flags: c_int, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_req_cleanup(req: *uv_fs_t))
-externfn!(fn uv_fs_fsync(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
-                         cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_fdatasync(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
-                             cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_ftruncate(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
-                             offset: i64, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_readlink(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
-                            cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_symlink(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
-                           dst: *c_char, flags: c_int, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_rename(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
-                          dst: *c_char, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_utime(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                         atime: c_double, mtime: c_double,
-                         cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_link(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
-                        dst: *c_char, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_chown(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
-                         uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_chmod(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
-                         mode: c_int, cb: uv_fs_cb) -> c_int)
-externfn!(fn uv_fs_lstat(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
-                         cb: uv_fs_cb) -> c_int)
-
-// getaddrinfo
-externfn!(fn uv_getaddrinfo(loop_: *uv_loop_t, req: *uv_getaddrinfo_t,
-                            getaddrinfo_cb: uv_getaddrinfo_cb,
-                            node: *c_char, service: *c_char,
-                            hints: *addrinfo) -> c_int)
-externfn!(fn uv_freeaddrinfo(ai: *addrinfo))
-
-// process spawning
-externfn!(fn uv_spawn(loop_ptr: *uv_loop_t, outptr: *uv_process_t,
-                      options: *uv_process_options_t) -> c_int)
-externfn!(fn uv_process_kill(p: *uv_process_t, signum: c_int) -> c_int)
-
-// pipes
-externfn!(fn uv_pipe_init(l: *uv_loop_t, p: *uv_pipe_t, ipc: c_int) -> c_int)
-externfn!(fn uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int)
-externfn!(fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int)
-externfn!(fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
-                             name: *c_char, cb: uv_connect_cb))
-
-// tty
-externfn!(fn uv_tty_init(l: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
-                         readable: c_int) -> c_int)
-externfn!(fn uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int)
-externfn!(fn uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
-                                height: *c_int) -> c_int)
-
-// signals
-externfn!(fn uv_signal_init(loop_: *uv_loop_t, handle: *uv_signal_t) -> c_int)
-externfn!(fn uv_signal_start(h: *uv_signal_t, cb: uv_signal_cb,
-                             signum: c_int) -> c_int)
-externfn!(fn uv_signal_stop(handle: *uv_signal_t) -> c_int)
-
 // libuv requires various system libraries to successfully link on some
 // platforms
 #[cfg(target_os = "linux")]
index 6166bbaaaa3f4398467cda1b3f92780350760305..4d5c68ab7177b943e0aa499ff26fb7c4a985d609 100644 (file)
@@ -40,7 +40,9 @@
 
 ```rust
 use std::libc;
-externfn!(fn puts(s: *libc::c_char))
+extern {
+    fn puts(s: *libc::c_char);
+}
 
 let my_string = "Hello, world!";
 
@@ -179,7 +181,6 @@ pub fn iter<'a>(&'a self) -> CStringIterator<'a> {
 
 impl Drop for CString {
     fn drop(&mut self) {
-        #[fixed_stack_segment]; #[inline(never)];
         if self.owns_buffer_ {
             unsafe {
                 libc::free(self.buf as *libc::c_void)
@@ -260,7 +261,6 @@ unsafe fn with_c_str_unchecked<T>(&self, f: &fn(*libc::c_char) -> T) -> T {
 
 impl<'self> ToCStr for &'self [u8] {
     fn to_c_str(&self) -> CString {
-        #[fixed_stack_segment]; #[inline(never)];
         let mut cs = unsafe { self.to_c_str_unchecked() };
         do cs.with_mut_ref |buf| {
             check_for_null(*self, buf);
@@ -269,7 +269,6 @@ fn to_c_str(&self) -> CString {
     }
 
     unsafe fn to_c_str_unchecked(&self) -> CString {
-        #[fixed_stack_segment]; #[inline(never)];
         do self.as_imm_buf |self_buf, self_len| {
             let buf = libc::malloc(self_len as libc::size_t + 1) as *mut u8;
             if buf.is_null() {
@@ -460,16 +459,12 @@ fn test_is_null() {
 
     #[test]
     fn test_unwrap() {
-        #[fixed_stack_segment]; #[inline(never)];
-
         let c_str = "hello".to_c_str();
         unsafe { libc::free(c_str.unwrap() as *libc::c_void) }
     }
 
     #[test]
     fn test_with_ref() {
-        #[fixed_stack_segment]; #[inline(never)];
-
         let c_str = "hello".to_c_str();
         let len = unsafe { c_str.with_ref(|buf| libc::strlen(buf)) };
         assert!(!c_str.is_null());
index 008f9b27a12e1d19db0f2a5ae4f72a4009175f7b..967aee9135d8ca12e22a56f48dbfdfaa8b09afe0 100644 (file)
@@ -64,6 +64,8 @@
 
 #[deny(non_camel_case_types)];
 #[deny(missing_doc)];
+#[allow(unrecognized_lint)]; // NOTE: remove after the next snapshot
+#[allow(cstack)]; // NOTE: remove after the next snapshot.
 
 // When testing libstd, bring in libuv as the I/O backend so tests can print
 // things and all of the std::rt::io tests have an I/O interface to run on top
index e68018e6b51b782da3bd5e4b1b7d0205e50600fa..190f6a7c86f7b06d30df414a18fa837dc3c0cdd4 100644 (file)
@@ -2857,11 +2857,7 @@ pub fn strncpy(dst: *c_char, src: *c_char, n: size_t)
 
                 // These are fine to execute on the Rust stack. They must be,
                 // in fact, because LLVM generates calls to them!
-                #[rust_stack]
-                #[inline]
                 pub fn memcmp(cx: *c_void, ct: *c_void, n: size_t) -> c_int;
-                #[rust_stack]
-                #[inline]
                 pub fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void;
             }
         }
@@ -3059,11 +3055,9 @@ pub mod dirent {
             // doesn't link it correctly on i686, so we're going
             // through a C function that mysteriously does work.
             pub unsafe fn opendir(dirname: *c_char) -> *DIR {
-                #[fixed_stack_segment]; #[inline(never)];
                 rust_opendir(dirname)
             }
             pub unsafe fn readdir(dirp: *DIR) -> *dirent_t {
-                #[fixed_stack_segment]; #[inline(never)];
                 rust_readdir(dirp)
             }
 
index 30175d6609b93167243c9f7ebc9731ab2c7d7ba3..684fb9c76d941989b88cbd2e148ec7be01fcb7a0 100644 (file)
@@ -277,7 +277,6 @@ fn get_with<T: 'static, U>(key: Key<T>,
 }
 
 fn abort() -> ! {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe { libc::abort() }
 }
 
index d6de4f25f6eefe7af2be00775bdb464cfb8ceb1b..a0dddffd85184faeb1663230ef187cdcfdeaee54 100644 (file)
@@ -41,7 +41,7 @@ mod delegated {
             use unstable::intrinsics;
 
             $(
-                #[inline] #[fixed_stack_segment] #[inline(never)]
+                #[inline]
                 pub fn $name($( $arg : $arg_ty ),*) -> $rv {
                     unsafe {
                         $bound_name($( $arg ),*)
index 5feab20ba81d3a9a48fd960ccfb0ec05ec0b9dcf..8cb7fa180018646958da64909d3bcae7fde04695 100644 (file)
@@ -43,7 +43,7 @@ mod delegated {
             use unstable::intrinsics;
 
             $(
-                #[inline] #[fixed_stack_segment] #[inline(never)]
+                #[inline]
                 pub fn $name($( $arg : $arg_ty ),*) -> $rv {
                     unsafe {
                         $bound_name($( $arg ),*)
index de4fb54be958b5caef799dca72add2209075303b..ff24c35d4e641123ba9792ce2bc66054b132175a 100644 (file)
@@ -47,7 +47,6 @@
 
 /// Delegates to the libc close() function, returning the same return value.
 pub fn close(fd: c_int) -> c_int {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         libc::close(fd)
     }
@@ -58,7 +57,6 @@ pub fn close(fd: c_int) -> c_int {
 
 #[cfg(unix)]
 pub fn getcwd() -> Path {
-    #[fixed_stack_segment]; #[inline(never)];
     let mut buf = [0 as libc::c_char, ..BUF_BYTES];
     do buf.as_mut_buf |buf, len| {
         unsafe {
@@ -73,7 +71,6 @@ pub fn getcwd() -> Path {
 
 #[cfg(windows)]
 pub fn getcwd() -> Path {
-    #[fixed_stack_segment]; #[inline(never)];
     use libc::DWORD;
     use libc::GetCurrentDirectoryW;
     let mut buf = [0 as u16, ..BUF_BYTES];
@@ -99,7 +96,6 @@ pub mod win32 {
 
     pub fn fill_utf16_buf_and_decode(f: &fn(*mut u16, DWORD) -> DWORD)
         -> Option<~str> {
-        #[fixed_stack_segment]; #[inline(never)];
 
         unsafe {
             let mut n = TMPBUF_SZ as DWORD;
@@ -153,8 +149,10 @@ fn with_env_lock<T>(f: &fn() -> T) -> T {
         };
     }
 
-    externfn!(fn rust_take_env_lock());
-    externfn!(fn rust_drop_env_lock());
+    extern {
+        fn rust_take_env_lock();
+        fn rust_drop_env_lock();
+    }
 }
 
 /// Returns a vector of (variable, value) pairs for all the environment
@@ -163,7 +161,6 @@ pub fn env() -> ~[(~str,~str)] {
     unsafe {
         #[cfg(windows)]
         unsafe fn get_env_pairs() -> ~[~str] {
-            #[fixed_stack_segment]; #[inline(never)];
             use c_str;
             use str::StrSlice;
 
@@ -185,8 +182,6 @@ unsafe fn get_env_pairs() -> ~[~str] {
         }
         #[cfg(unix)]
         unsafe fn get_env_pairs() -> ~[~str] {
-            #[fixed_stack_segment]; #[inline(never)];
-
             extern {
                 fn rust_env_pairs() -> **libc::c_char;
             }
@@ -225,7 +220,6 @@ fn env_convert(input: ~[~str]) -> ~[(~str, ~str)] {
 /// Fetches the environment variable `n` from the current process, returning
 /// None if the variable isn't set.
 pub fn getenv(n: &str) -> Option<~str> {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         do with_env_lock {
             let s = do n.with_c_str |buf| {
@@ -244,8 +238,6 @@ pub fn getenv(n: &str) -> Option<~str> {
 /// Fetches the environment variable `n` from the current process, returning
 /// None if the variable isn't set.
 pub fn getenv(n: &str) -> Option<~str> {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         do with_env_lock {
             use os::win32::{as_utf16_p, fill_utf16_buf_and_decode};
@@ -263,7 +255,6 @@ pub fn getenv(n: &str) -> Option<~str> {
 /// Sets the environment variable `n` to the value `v` for the currently running
 /// process
 pub fn setenv(n: &str, v: &str) {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         do with_env_lock {
             do n.with_c_str |nbuf| {
@@ -280,8 +271,6 @@ pub fn setenv(n: &str, v: &str) {
 /// Sets the environment variable `n` to the value `v` for the currently running
 /// process
 pub fn setenv(n: &str, v: &str) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         do with_env_lock {
             use os::win32::as_utf16_p;
@@ -298,7 +287,6 @@ pub fn setenv(n: &str, v: &str) {
 pub fn unsetenv(n: &str) {
     #[cfg(unix)]
     fn _unsetenv(n: &str) {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             do with_env_lock {
                 do n.with_c_str |nbuf| {
@@ -309,7 +297,6 @@ fn _unsetenv(n: &str) {
     }
     #[cfg(windows)]
     fn _unsetenv(n: &str) {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             do with_env_lock {
                 use os::win32::as_utf16_p;
@@ -330,7 +317,6 @@ pub struct Pipe {
 
 #[cfg(unix)]
 pub fn pipe() -> Pipe {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         let mut fds = Pipe {input: 0 as c_int,
                             out: 0 as c_int };
@@ -341,7 +327,6 @@ pub fn pipe() -> Pipe {
 
 #[cfg(windows)]
 pub fn pipe() -> Pipe {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         // Windows pipes work subtly differently than unix pipes, and their
         // inheritance has to be handled in a different way that I do not
@@ -360,7 +345,6 @@ pub fn pipe() -> Pipe {
 }
 
 fn dup2(src: c_int, dst: c_int) -> c_int {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         libc::dup2(src, dst)
     }
@@ -377,7 +361,6 @@ pub fn self_exe_path() -> Option<Path> {
 
     #[cfg(target_os = "freebsd")]
     fn load_self() -> Option<~[u8]> {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             use libc::funcs::bsd44::*;
             use libc::consts::os::extra::*;
@@ -415,7 +398,6 @@ fn load_self() -> Option<~[u8]> {
 
     #[cfg(target_os = "macos")]
     fn load_self() -> Option<~[u8]> {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             use libc::funcs::extra::_NSGetExecutablePath;
             use vec;
@@ -434,7 +416,6 @@ fn load_self() -> Option<~[u8]> {
 
     #[cfg(windows)]
     fn load_self() -> Option<~[u8]> {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             use os::win32::fill_utf16_buf_and_decode;
             do fill_utf16_buf_and_decode() |buf, sz| {
@@ -555,7 +536,6 @@ pub fn change_dir(p: &Path) -> bool {
 
     #[cfg(windows)]
     fn chdir(p: &Path) -> bool {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             use os::win32::as_utf16_p;
             return do as_utf16_p(p.as_str().unwrap()) |buf| {
@@ -566,7 +546,6 @@ fn chdir(p: &Path) -> bool {
 
     #[cfg(unix)]
     fn chdir(p: &Path) -> bool {
-        #[fixed_stack_segment]; #[inline(never)];
         do p.with_c_str |buf| {
             unsafe {
                 libc::chdir(buf) == (0 as c_int)
@@ -581,7 +560,6 @@ pub fn errno() -> int {
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "freebsd")]
     fn errno_location() -> *c_int {
-        #[fixed_stack_segment]; #[inline(never)];
         #[nolink]
         extern {
             fn __error() -> *c_int;
@@ -594,7 +572,6 @@ fn errno_location() -> *c_int {
     #[cfg(target_os = "linux")]
     #[cfg(target_os = "android")]
     fn errno_location() -> *c_int {
-        #[fixed_stack_segment]; #[inline(never)];
         #[nolink]
         extern {
             fn __errno_location() -> *c_int;
@@ -612,7 +589,6 @@ fn errno_location() -> *c_int {
 #[cfg(windows)]
 /// Returns the platform-specific value of errno
 pub fn errno() -> uint {
-    #[fixed_stack_segment]; #[inline(never)];
     use libc::types::os::arch::extra::DWORD;
 
     #[link_name = "kernel32"]
@@ -634,8 +610,6 @@ fn strerror() -> ~str {
         #[cfg(target_os = "freebsd")]
         fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t)
                       -> c_int {
-            #[fixed_stack_segment]; #[inline(never)];
-
             #[nolink]
             extern {
                 fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t)
@@ -651,7 +625,6 @@ fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t)
         // So we just use __xpg_strerror_r which is always POSIX compliant
         #[cfg(target_os = "linux")]
         fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int {
-            #[fixed_stack_segment]; #[inline(never)];
             #[nolink]
             extern {
                 fn __xpg_strerror_r(errnum: c_int,
@@ -679,8 +652,6 @@ fn __xpg_strerror_r(errnum: c_int,
 
     #[cfg(windows)]
     fn strerror() -> ~str {
-        #[fixed_stack_segment]; #[inline(never)];
-
         use libc::types::os::arch::extra::DWORD;
         use libc::types::os::arch::extra::LPWSTR;
         use libc::types::os::arch::extra::LPVOID;
@@ -758,8 +729,6 @@ unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] {
  */
 #[cfg(target_os = "macos")]
 fn real_args() -> ~[~str] {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         let (argc, argv) = (*_NSGetArgc() as c_int,
                             *_NSGetArgv() as **c_char);
@@ -781,7 +750,6 @@ fn real_args() -> ~[~str] {
 
 #[cfg(windows)]
 fn real_args() -> ~[~str] {
-    #[fixed_stack_segment]; #[inline(never)];
     use vec;
 
     let mut nArgs: c_int = 0;
@@ -858,8 +826,6 @@ fn round_up(from: uint, to: uint) -> uint {
 
 #[cfg(unix)]
 pub fn page_size() -> uint {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         libc::sysconf(libc::_SC_PAGESIZE) as uint
     }
@@ -867,8 +833,6 @@ pub fn page_size() -> uint {
 
 #[cfg(windows)]
 pub fn page_size() -> uint {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         let mut info = libc::SYSTEM_INFO::new();
         libc::GetSystemInfo(&mut info);
@@ -979,8 +943,6 @@ fn to_str(&self) -> ~str {
 impl MemoryMap {
     /// Create a new mapping with the given `options`, at least `min_len` bytes long.
     pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> {
-        #[fixed_stack_segment]; #[inline(never)];
-
         use libc::off_t;
 
         let mut addr: *c_void = ptr::null();
@@ -1043,8 +1005,6 @@ pub fn granularity() -> uint {
 impl Drop for MemoryMap {
     /// Unmap the mapping. Fails the task if `munmap` fails.
     fn drop(&mut self) {
-        #[fixed_stack_segment]; #[inline(never)];
-
         unsafe {
             match libc::munmap(self.data as *c_void, self.len) {
                 0 => (),
@@ -1062,8 +1022,6 @@ fn drop(&mut self) {
 impl MemoryMap {
     /// Create a new mapping with the given `options`, at least `min_len` bytes long.
     pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> {
-        #[fixed_stack_segment]; #[inline(never)];
-
         use libc::types::os::arch::extra::{LPVOID, DWORD, SIZE_T, HANDLE};
 
         let mut lpAddress: LPVOID = ptr::mut_null();
@@ -1156,8 +1114,6 @@ pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError>
     /// Granularity of MapAddr() and MapOffset() parameter values.
     /// This may be greater than the value returned by page_size().
     pub fn granularity() -> uint {
-        #[fixed_stack_segment]; #[inline(never)];
-
         unsafe {
             let mut info = libc::SYSTEM_INFO::new();
             libc::GetSystemInfo(&mut info);
@@ -1172,8 +1128,6 @@ impl Drop for MemoryMap {
     /// Unmap the mapping. Fails the task if any of `VirtualFree`, `UnmapViewOfFile`, or
     /// `CloseHandle` fail.
     fn drop(&mut self) {
-        #[fixed_stack_segment]; #[inline(never)];
-
         use libc::types::os::arch::extra::{LPCVOID, HANDLE};
         use libc::consts::os::extra::FALSE;
 
@@ -1490,8 +1444,6 @@ fn memory_map_rw() {
 
     #[test]
     fn memory_map_file() {
-        #[fixed_stack_segment]; #[inline(never)];
-
         use result::{Ok, Err};
         use os::*;
         use libc::*;
@@ -1499,16 +1451,12 @@ fn memory_map_file() {
         use rt::io::fs;
 
         #[cfg(unix)]
-        #[fixed_stack_segment]
-        #[inline(never)]
         fn lseek_(fd: c_int, size: uint) {
             unsafe {
                 assert!(lseek(fd, size as off_t, SEEK_SET) == size as off_t);
             }
         }
         #[cfg(windows)]
-        #[fixed_stack_segment]
-        #[inline(never)]
         fn lseek_(fd: c_int, size: uint) {
            unsafe {
                assert!(lseek(fd, size as c_long, SEEK_SET) == size as c_long);
index a6d05ea307cdb9bb0351de8b2c14aaf1abc4ea43..73d5c72a728863b2b38d10e4ad07a26ec0346c86 100644 (file)
@@ -71,7 +71,7 @@ pub fn new() -> OSRng {
     /// Create a new `OSRng`.
     #[cfg(windows)]
     pub fn new() -> OSRng {
-        externfn!(fn rust_win32_rand_acquire(phProv: *mut HCRYPTPROV))
+        extern { fn rust_win32_rand_acquire(phProv: *mut HCRYPTPROV); }
 
         let mut hcp = 0;
         unsafe {rust_win32_rand_acquire(&mut hcp)};
@@ -106,7 +106,10 @@ fn next_u64(&mut self) -> u64 {
         unsafe { cast::transmute(v) }
     }
     fn fill_bytes(&mut self, v: &mut [u8]) {
-        externfn!(fn rust_win32_rand_gen(hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: *mut BYTE))
+        extern {
+            fn rust_win32_rand_gen(hProv: HCRYPTPROV, dwLen: DWORD,
+                                   pbBuffer: *mut BYTE);
+        }
 
         do v.as_mut_buf |ptr, len| {
             unsafe {rust_win32_rand_gen(self.hcryptprov, len as DWORD, ptr)}
@@ -123,7 +126,7 @@ fn drop(&mut self) {
 
     #[cfg(windows)]
     fn drop(&mut self) {
-        externfn!(fn rust_win32_rand_release(hProv: HCRYPTPROV))
+        extern { fn rust_win32_rand_release(hProv: HCRYPTPROV); }
 
         unsafe {rust_win32_rand_release(self.hcryptprov)}
     }
index 24143ba040ba74e3f4a48d00af93ecf310750cdf..48e588790268586d9acbfe5364269ac6614bd93b 100644 (file)
@@ -117,9 +117,11 @@ unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> ~[~str] {
         }
     }
 
-    externfn!(fn rust_take_global_args_lock())
-    externfn!(fn rust_drop_global_args_lock())
-    externfn!(fn rust_get_global_args_ptr() -> *mut Option<~~[~str]>)
+    extern {
+        fn rust_take_global_args_lock();
+        fn rust_drop_global_args_lock();
+        fn rust_get_global_args_ptr() -> *mut Option<~~[~str]>;
+    }
 
     #[cfg(test)]
     mod tests {
index 322c58bc2b807539e657a65e73f08987d53f5ec0..a8f762c4c8fc127934b027eac2d22127cf1ddcb4 100644 (file)
@@ -236,7 +236,6 @@ fn drop(&mut self) {
 }
 
 fn time() -> Time {
-    #[fixed_stack_segment]; #[inline(never)];
     extern {
         fn get_time(sec: &mut i64, nsec: &mut i32);
     }
index b86dbfd6fb05f8345def93da97b85677cee145e4..fcc30ded9542a620f0c63566cc5257a4b903489c 100644 (file)
@@ -119,7 +119,6 @@ pub fn swap(out_context: &mut Context, in_context: &Context) {
 }
 
 extern {
-    #[rust_stack]
     fn swap_registers(out_regs: *mut Registers, in_regs: *Registers);
 }
 
@@ -376,7 +375,6 @@ unsafe fn target_record_sp_limit(limit: uint) {
     unsafe fn target_record_sp_limit(limit: uint) {
         return record_sp_limit(limit as *c_void);
         extern {
-            #[rust_stack]
             fn record_sp_limit(limit: *c_void);
         }
     }
@@ -450,7 +448,6 @@ unsafe fn target_get_sp_limit() -> uint {
     unsafe fn target_get_sp_limit() -> uint {
         return get_sp_limit() as uint;
         extern {
-            #[rust_stack]
             fn get_sp_limit() -> *c_void;
         }
     }
index a7a5b0084a275681e4271659f6d68b6e0e577270..8decaea1f4725358fc77ed847f3de577afb1e9ea 100644 (file)
@@ -49,8 +49,6 @@ pub fn get_crate_map() -> Option<&'static CrateMap<'static>> {
 }
 
 #[cfg(windows)]
-#[fixed_stack_segment]
-#[inline(never)]
 pub fn get_crate_map() -> Option<&'static CrateMap<'static>> {
     use cast::transmute;
     use c_str::ToCStr;
index 4964db8f1c1db2de6ea8380c2bffad5b43ef4dc8..c6e2724b0f2027918a1f4035de2936b40ea428a1 100644 (file)
@@ -14,7 +14,6 @@
 use mem::size_of;
 
 extern {
-    #[rust_stack]
     fn abort();
 }
 
@@ -36,8 +35,6 @@ fn align_to(size: uint, align: uint) -> uint {
 
 /// A wrapper around libc::malloc, aborting on out-of-memory
 pub unsafe fn malloc_raw(size: uint) -> *c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     let p = malloc(size as size_t);
     if p.is_null() {
         // we need a non-allocating way to print an error here
@@ -48,8 +45,6 @@ pub unsafe fn malloc_raw(size: uint) -> *c_void {
 
 /// A wrapper around libc::realloc, aborting on out-of-memory
 pub unsafe fn realloc_raw(ptr: *mut c_void, size: uint) -> *mut c_void {
-    #[fixed_stack_segment]; #[inline(never)];
-
     let p = realloc(ptr, size as size_t);
     if p.is_null() {
         // we need a non-allocating way to print an error here
@@ -100,8 +95,6 @@ pub unsafe fn exchange_free_(ptr: *c_char) {
 }
 
 pub unsafe fn exchange_free(ptr: *c_char) {
-    #[fixed_stack_segment]; #[inline(never)];
-
     free(ptr as *c_void);
 }
 
index 6d4f29182dda6cf19b6fc1e079a9f25f98aa541b..69d1159bf91a003d6ce3bb903cc42db8d88114bb 100644 (file)
@@ -98,7 +98,6 @@ pub fn new(fd: fd_t, close_on_drop: bool) -> FileDesc {
 }
 
 impl Reader for FileDesc {
-    #[fixed_stack_segment] #[inline(never)]
     fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
         #[cfg(windows)] type rlen = libc::c_uint;
         #[cfg(not(windows))] type rlen = libc::size_t;
@@ -121,7 +120,6 @@ fn eof(&mut self) -> bool { false }
 }
 
 impl Writer for FileDesc {
-    #[fixed_stack_segment] #[inline(never)]
     fn write(&mut self, buf: &[u8]) {
         #[cfg(windows)] type wlen = libc::c_uint;
         #[cfg(not(windows))] type wlen = libc::size_t;
@@ -137,7 +135,6 @@ fn write(&mut self, buf: &[u8]) {
 }
 
 impl Drop for FileDesc {
-    #[fixed_stack_segment] #[inline(never)]
     fn drop(&mut self) {
         if self.close_on_drop {
             unsafe { libc::close(self.fd); }
@@ -158,7 +155,6 @@ pub fn new(file: *libc::FILE) -> CFile { CFile { file: file } }
 }
 
 impl Reader for CFile {
-    #[fixed_stack_segment] #[inline(never)]
     fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
         let ret = do keep_going(buf) |buf, len| {
             unsafe {
@@ -176,14 +172,12 @@ fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
         }
     }
 
-    #[fixed_stack_segment] #[inline(never)]
     fn eof(&mut self) -> bool {
         unsafe { libc::feof(self.file) != 0 }
     }
 }
 
 impl Writer for CFile {
-    #[fixed_stack_segment] #[inline(never)]
     fn write(&mut self, buf: &[u8]) {
         let ret = do keep_going(buf) |buf, len| {
             unsafe {
@@ -196,7 +190,6 @@ fn write(&mut self, buf: &[u8]) {
         }
     }
 
-    #[fixed_stack_segment] #[inline(never)]
     fn flush(&mut self) {
         if unsafe { libc::fflush(self.file) } < 0 {
             raise_error();
@@ -205,7 +198,6 @@ fn flush(&mut self) {
 }
 
 impl Seek for CFile {
-    #[fixed_stack_segment] #[inline(never)]
     fn tell(&self) -> u64 {
         let ret = unsafe { libc::ftell(self.file) };
         if ret < 0 {
@@ -214,7 +206,6 @@ fn tell(&self) -> u64 {
         return ret as u64;
     }
 
-    #[fixed_stack_segment] #[inline(never)]
     fn seek(&mut self, pos: i64, style: SeekStyle) {
         let whence = match style {
             SeekSet => libc::SEEK_SET,
@@ -228,7 +219,6 @@ fn seek(&mut self, pos: i64, style: SeekStyle) {
 }
 
 impl Drop for CFile {
-    #[fixed_stack_segment] #[inline(never)]
     fn drop(&mut self) {
         unsafe { libc::fclose(self.file); }
     }
@@ -242,7 +232,6 @@ mod tests {
     use rt::io::{io_error, SeekSet};
     use super::*;
 
-    #[test] #[fixed_stack_segment]
     #[ignore(cfg(target_os = "freebsd"))] // hmm, maybe pipes have a tiny buffer
     fn test_file_desc() {
         // Run this test with some pipes so we don't have to mess around with
@@ -278,7 +267,6 @@ fn test_file_desc() {
         }
     }
 
-    #[test] #[fixed_stack_segment]
     #[ignore(cfg(windows))] // apparently windows doesn't like tmpfile
     fn test_cfile() {
         unsafe {
@@ -358,7 +346,6 @@ pub fn walk_dir(p: &Path, f: &fn(&Path) -> bool) -> bool {
     #[cfg(unix)]
     /// Indicates whether a path represents a directory
     pub fn path_is_dir(p: &Path) -> bool {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             do p.with_c_str |buf| {
                 rustrt::rust_path_is_dir(buf) != 0 as c_int
@@ -369,7 +356,6 @@ pub fn path_is_dir(p: &Path) -> bool {
 
     #[cfg(windows)]
     pub fn path_is_dir(p: &Path) -> bool {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             do os::win32::as_utf16_p(p.as_str().unwrap()) |buf| {
                 rustrt::rust_path_is_dir_u16(buf) != 0 as c_int
@@ -380,7 +366,6 @@ pub fn path_is_dir(p: &Path) -> bool {
     #[cfg(unix)]
     /// Indicates whether a path exists
     pub fn path_exists(p: &Path) -> bool {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             do p.with_c_str |buf| {
                 rustrt::rust_path_exists(buf) != 0 as c_int
@@ -390,7 +375,6 @@ pub fn path_exists(p: &Path) -> bool {
 
     #[cfg(windows)]
     pub fn path_exists(p: &Path) -> bool {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             do os::win32::as_utf16_p(p.as_str().unwrap()) |buf| {
                 rustrt::rust_path_exists_u16(buf) != 0 as c_int
@@ -404,7 +388,6 @@ pub fn make_dir(p: &Path, mode: c_int) -> bool {
 
         #[cfg(windows)]
         fn mkdir(p: &Path, _mode: c_int) -> bool {
-            #[fixed_stack_segment]; #[inline(never)];
             unsafe {
                 use os::win32::as_utf16_p;
                 // FIXME: turn mode into something useful? #2623
@@ -417,7 +400,6 @@ fn mkdir(p: &Path, _mode: c_int) -> bool {
 
         #[cfg(unix)]
         fn mkdir(p: &Path, mode: c_int) -> bool {
-            #[fixed_stack_segment]; #[inline(never)];
             do p.with_c_str |buf| {
                 unsafe {
                     libc::mkdir(buf, mode as libc::mode_t) == (0 as c_int)
@@ -457,7 +439,6 @@ pub fn list_dir(p: &Path) -> ~[Path] {
             #[cfg(target_os = "freebsd")]
             #[cfg(target_os = "macos")]
             unsafe fn get_list(p: &Path) -> ~[Path] {
-                #[fixed_stack_segment]; #[inline(never)];
                 use libc::{dirent_t};
                 use libc::{opendir, readdir, closedir};
                 extern {
@@ -488,7 +469,6 @@ unsafe fn get_list(p: &Path) -> ~[Path] {
             }
             #[cfg(windows)]
             unsafe fn get_list(p: &Path) -> ~[Path] {
-                #[fixed_stack_segment]; #[inline(never)];
                 use libc::consts::os::extra::INVALID_HANDLE_VALUE;
                 use libc::{wcslen, free};
                 use libc::funcs::extra::kernel32::{
@@ -568,7 +548,6 @@ pub fn remove_dir(p: &Path) -> bool {
 
         #[cfg(windows)]
         fn rmdir(p: &Path) -> bool {
-            #[fixed_stack_segment]; #[inline(never)];
             unsafe {
                 use os::win32::as_utf16_p;
                 return do as_utf16_p(p.as_str().unwrap()) |buf| {
@@ -579,7 +558,6 @@ fn rmdir(p: &Path) -> bool {
 
         #[cfg(unix)]
         fn rmdir(p: &Path) -> bool {
-            #[fixed_stack_segment]; #[inline(never)];
             do p.with_c_str |buf| {
                 unsafe {
                     libc::rmdir(buf) == (0 as c_int)
@@ -594,7 +572,6 @@ pub fn remove_file(p: &Path) -> bool {
 
         #[cfg(windows)]
         fn unlink(p: &Path) -> bool {
-            #[fixed_stack_segment]; #[inline(never)];
             unsafe {
                 use os::win32::as_utf16_p;
                 return do as_utf16_p(p.as_str().unwrap()) |buf| {
@@ -605,7 +582,6 @@ fn unlink(p: &Path) -> bool {
 
         #[cfg(unix)]
         fn unlink(p: &Path) -> bool {
-            #[fixed_stack_segment]; #[inline(never)];
             unsafe {
                 do p.with_c_str |buf| {
                     libc::unlink(buf) == (0 as c_int)
@@ -616,7 +592,6 @@ fn unlink(p: &Path) -> bool {
 
     /// Renames an existing file or directory
     pub fn rename_file(old: &Path, new: &Path) -> bool {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
            do old.with_c_str |old_buf| {
                 do new.with_c_str |new_buf| {
@@ -632,7 +607,6 @@ pub fn copy_file(from: &Path, to: &Path) -> bool {
 
         #[cfg(windows)]
         fn do_copy_file(from: &Path, to: &Path) -> bool {
-            #[fixed_stack_segment]; #[inline(never)];
             unsafe {
                 use os::win32::as_utf16_p;
                 return do as_utf16_p(from.as_str().unwrap()) |fromp| {
@@ -646,7 +620,6 @@ fn do_copy_file(from: &Path, to: &Path) -> bool {
 
         #[cfg(unix)]
         fn do_copy_file(from: &Path, to: &Path) -> bool {
-            #[fixed_stack_segment]; #[inline(never)];
             unsafe {
                 let istream = do from.with_c_str |fromp| {
                     do "rb".with_c_str |modebuf| {
index f5c39de1bf44ecfd76e69f5bf274fea4193990a2..9bf0ed63e8c4ba0b3474c467f0bab2b3665f3f78 100644 (file)
@@ -69,8 +69,6 @@ pub fn new(prog: &str, args: &[~str], env: Option<~[(~str, ~str)]>,
                stdin: Option<file::fd_t>,
                stdout: Option<file::fd_t>,
                stderr: Option<file::fd_t>) -> Process {
-        #[fixed_stack_segment]; #[inline(never)];
-
         let (in_pipe, in_fd) = match stdin {
             None => {
                 let pipe = os::pipe();
@@ -208,7 +206,6 @@ pub fn signal(&mut self, signum: int) -> Result<(), io::IoError> {
 
         #[cfg(windows)]
         unsafe fn killpid(pid: pid_t, signal: int) -> Result<(), io::IoError> {
-            #[fixed_stack_segment]; #[inline(never)];
             match signal {
                 io::process::PleaseExitSignal |
                 io::process::MustDieSignal => {
@@ -226,7 +223,6 @@ unsafe fn killpid(pid: pid_t, signal: int) -> Result<(), io::IoError> {
 
         #[cfg(not(windows))]
         unsafe fn killpid(pid: pid_t, signal: int) -> Result<(), io::IoError> {
-            #[fixed_stack_segment]; #[inline(never)];
             libc::funcs::posix88::signal::kill(pid, signal as c_int);
             Ok(())
         }
@@ -254,8 +250,6 @@ fn spawn_process_os(prog: &str, args: &[~str],
                     env: Option<~[(~str, ~str)]>,
                     dir: Option<&Path>,
                     in_fd: c_int, out_fd: c_int, err_fd: c_int) -> SpawnProcessResult {
-    #[fixed_stack_segment]; #[inline(never)];
-
     use libc::types::os::arch::extra::{DWORD, HANDLE, STARTUPINFO};
     use libc::consts::os::extra::{
         TRUE, FALSE,
@@ -439,8 +433,6 @@ fn spawn_process_os(prog: &str, args: &[~str],
                     env: Option<~[(~str, ~str)]>,
                     dir: Option<&Path>,
                     in_fd: c_int, out_fd: c_int, err_fd: c_int) -> SpawnProcessResult {
-    #[fixed_stack_segment]; #[inline(never)];
-
     use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp};
     use libc::funcs::bsd44::getdtablesize;
 
@@ -455,7 +447,7 @@ mod rustrt {
     unsafe fn set_environ(_envp: *c_void) {}
     #[cfg(target_os = "macos")]
     unsafe fn set_environ(envp: *c_void) {
-        externfn!(fn _NSGetEnviron() -> *mut *c_void);
+        extern { fn _NSGetEnviron() -> *mut *c_void; }
 
         *_NSGetEnviron() = envp;
     }
@@ -603,7 +595,6 @@ fn with_dirp<T>(d: Option<&Path>, cb: &fn(*libc::c_char) -> T) -> T {
 
 #[cfg(windows)]
 fn free_handle(handle: *()) {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe {
         libc::funcs::extra::kernel32::CloseHandle(cast::transmute(handle));
     }
@@ -629,8 +620,6 @@ fn waitpid(pid: pid_t) -> int {
 
     #[cfg(windows)]
     fn waitpid_os(pid: pid_t) -> int {
-        #[fixed_stack_segment]; #[inline(never)];
-
         use libc::types::os::arch::extra::DWORD;
         use libc::consts::os::extra::{
             SYNCHRONIZE,
@@ -676,8 +665,6 @@ fn waitpid_os(pid: pid_t) -> int {
 
     #[cfg(unix)]
     fn waitpid_os(pid: pid_t) -> int {
-        #[fixed_stack_segment]; #[inline(never)];
-
         use libc::funcs::posix01::wait::*;
 
         #[cfg(target_os = "linux")]
index 9fe8cb3ed90b420e1bfd509fcca68919f6d0ab1b..3f013d5cac9fbac32e83ca517a48d97513582aa5 100644 (file)
@@ -154,7 +154,6 @@ mod test {
 
     // kill is only available on Unixes
     #[cfg(unix)]
-    #[fixed_stack_segment]
     fn sigint() {
         unsafe {
             libc::funcs::posix88::signal::kill(libc::getpid(), libc::SIGINT);
index acc2e11f067e6fff714c74ec4facfe3b50a34497..e829c77cec131dc5a1606701d550b12cabf87d5a 100644 (file)
@@ -69,7 +69,6 @@ enum StdSource {
     File(~RtioFileStream),
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn src<T>(fd: libc::c_int, readable: bool, f: &fn(StdSource) -> T) -> T {
     do with_local_io |io| {
         let fd = unsafe { libc::dup(fd) };
@@ -91,7 +90,6 @@ fn src<T>(fd: libc::c_int, readable: bool, f: &fn(StdSource) -> T) -> T {
 /// Creates a new non-blocking handle to the stdin of the current process.
 ///
 /// See `stdout()` for notes about this function.
-#[fixed_stack_segment] #[inline(never)]
 pub fn stdin() -> StdReader {
     do src(libc::STDIN_FILENO, true) |src| { StdReader { inner: src } }
 }
index c9534413c53e40c4f93af85858da4a38d1b98193..f35b657d9ddce00b06ac197031ff0a5d2afb0464 100644 (file)
@@ -26,8 +26,6 @@
 static mut RT_TLS_KEY: tls::Key = -1;
 
 /// Initialize the TLS key. Other ops will fail if this isn't executed first.
-#[fixed_stack_segment]
-#[inline(never)]
 pub fn init_tls_key() {
     unsafe {
         rust_initialize_rt_tls_key(&mut RT_TLS_KEY);
index c37195a7b1553a8002387c5898c6524d17822b0c..f346380ff7a479edeb9ba6617f6f706da1750e06 100644 (file)
@@ -135,7 +135,6 @@ fn update_entry(dirs: &[LogDirective], entry: &ModEntry) -> u32 {
     if longest_match >= 0 { return 1; } else { return 0; }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 /// Set log level for every entry in crate_map according to the sepecification
 /// in settings
 fn update_log_settings(crate_map: &CrateMap, settings: ~str) {
index a5c0d3be044c95d7a55fd46aa1a3bff8d0f75197..f18b4dc4234ec9ba627d6dae2b255992baadaf83 100644 (file)
@@ -463,8 +463,6 @@ pub fn in_green_task_context() -> bool {
 }
 
 pub fn new_event_loop() -> ~rtio::EventLoop {
-    #[fixed_stack_segment]; #[allow(cstack)];
-
     match crate_map::get_crate_map() {
         None => {}
         Some(map) => {
index c2e665f4903073cda371dbb09d452d5542ab4969..f4e5811acd31290d9acb8e2874287954698eb04d 100644 (file)
@@ -853,7 +853,6 @@ fn new_sched_rng() -> XorShiftRng {
     XorShiftRng::new()
 }
 #[cfg(unix)]
-#[fixed_stack_segment] #[inline(never)]
 fn new_sched_rng() -> XorShiftRng {
     use libc;
     use mem;
index 55bd4b0732a6f3d16cbed7d898dcb061b6296851..4358390da9f710be8201bf4659892716d3144224 100644 (file)
@@ -21,8 +21,6 @@ pub struct StackSegment {
 
 impl StackSegment {
     pub fn new(size: uint) -> StackSegment {
-        #[fixed_stack_segment]; #[inline(never)];
-
         unsafe {
             // Crate a block of uninitialized values
             let mut stack = vec::with_capacity(size);
@@ -54,8 +52,6 @@ pub fn end(&self) -> *uint {
 
 impl Drop for StackSegment {
     fn drop(&mut self) {
-        #[fixed_stack_segment]; #[inline(never)];
-
         unsafe {
             // XXX: Using the FFI to call a C macro. Slow
             rust_valgrind_stack_deregister(self.valgrind_id);
index 7e374fc602138c832fe3347216c21fa4f224463d..7620a4371c14bfc11bf4dd90630a30e51ab0a055 100644 (file)
@@ -509,7 +509,6 @@ pub fn try(&mut self, f: &fn()) {
         }
 
         extern {
-            #[rust_stack]
             fn rust_try(f: extern "C" fn(*c_void, *c_void),
                         code: *c_void,
                         data: *c_void) -> uintptr_t;
@@ -517,8 +516,6 @@ fn rust_try(f: extern "C" fn(*c_void, *c_void),
     }
 
     pub fn begin_unwind(&mut self, cause: ~Any) -> ! {
-        #[fixed_stack_segment]; #[inline(never)];
-
         self.unwinding = true;
         self.cause = Some(cause);
         unsafe {
@@ -537,9 +534,8 @@ pub fn begin_unwind(&mut self, cause: ~Any) -> ! {
 /// truly consider it to be stack overflow rather than allocating a new stack.
 #[no_mangle]      // - this is called from C code
 #[no_split_stack] // - it would be sad for this function to trigger __morestack
-#[doc(hidden)] // XXX: this function shouldn't have to be `pub` to get exported
-               //      so it can be linked against, we should have a better way
-               //      of specifying that.
+#[doc(hidden)]    // - Function must be `pub` to get exported, but it's
+                  //   irrelevant for documentation purposes.
 pub extern "C" fn rust_stack_exhausted() {
     use rt::in_green_task_context;
     use rt::task::Task;
index aa680cddf2a04b35a870ed6501c2e564c6b20f6e..3db9c049eb2df6ecad9e0871c85d29585e99565c 100644 (file)
@@ -143,8 +143,6 @@ fn sysctl(name: *mut libc::c_int, namelen: libc::c_uint,
     static RLIMIT_NOFILE: libc::c_int = 8;
 
     pub unsafe fn raise_fd_limit() {
-        #[fixed_stack_segment]; #[inline(never)];
-
         // The strategy here is to fetch the current resource limits, read the kern.maxfilesperproc
         // sysctl value, and bump the soft resource limit for maxfiles up to the sysctl value.
         use ptr::{to_unsafe_ptr, to_mut_unsafe_ptr, mut_null};
@@ -362,7 +360,6 @@ pub fn cleanup_task(mut task: ~Task) {
 }
 
 /// Get a port number, starting at 9600, for use in tests
-#[fixed_stack_segment] #[inline(never)]
 pub fn next_test_port() -> u16 {
     unsafe {
         return rust_dbg_next_port(base_port() as libc::uintptr_t) as u16;
@@ -373,7 +370,6 @@ pub fn next_test_port() -> u16 {
 }
 
 /// Get a temporary path which could be the location of a unix socket
-#[fixed_stack_segment] #[inline(never)]
 pub fn next_test_unix() -> Path {
     if cfg!(unix) {
         os::tmpdir().join(rand::task_rng().gen_ascii_str(20))
index b21a8f5981db4546a6f3fae338edeaf6d54e9525..5e535d994f9ef4cbc27576c1c6728b73579d7774 100644 (file)
@@ -68,8 +68,6 @@ pub fn join(mut self) {
 #[cfg(windows)]
 fn native_thread_create(thread_start: extern "C" fn(*libc::c_void) -> rust_thread_return,
                         tramp: ~~fn()) -> rust_thread {
-    #[fixed_stack_segment];
-
     unsafe {
         let ptr: *mut libc::c_void = cast::transmute(tramp);
         CreateThread(ptr::mut_null(), DEFAULT_STACK_SIZE, thread_start, ptr, 0, ptr::mut_null())
@@ -78,7 +76,6 @@ fn native_thread_create(thread_start: extern "C" fn(*libc::c_void) -> rust_threa
 
 #[cfg(windows)]
 fn native_thread_join(native: rust_thread) {
-    #[fixed_stack_segment];
     use libc::consts::os::extra::INFINITE;
     unsafe { WaitForSingleObject(native, INFINITE); }
 }
@@ -86,8 +83,6 @@ fn native_thread_join(native: rust_thread) {
 #[cfg(unix)]
 fn native_thread_create(thread_start: extern "C" fn(*libc::c_void) -> rust_thread_return,
                         tramp: ~~fn()) -> rust_thread {
-    #[fixed_stack_segment];
-
     use unstable::intrinsics;
     let mut native: libc::pthread_t = unsafe { intrinsics::uninit() };
 
@@ -107,13 +102,11 @@ fn native_thread_create(thread_start: extern "C" fn(*libc::c_void) -> rust_threa
 
 #[cfg(unix)]
 fn native_thread_join(native: rust_thread) {
-    #[fixed_stack_segment];
     unsafe { assert!(pthread_join(native, ptr::null()) == 0) }
 }
 
 impl Drop for Thread {
     fn drop(&mut self) {
-        #[fixed_stack_segment]; #[inline(never)];
         assert!(self.joined);
     }
 }
index 4ae1fe59a37d74e544dae5d0e69987c53edb7bdf..8fa64852846a836bee4ec75e9354c2dbedb2980c 100644 (file)
@@ -20,8 +20,6 @@
 pub type Key = pthread_key_t;
 
 #[cfg(unix)]
-#[fixed_stack_segment]
-#[inline(never)]
 pub unsafe fn create(key: &mut Key) {
     assert_eq!(0, pthread_key_create(key, null()));
 }
@@ -49,20 +47,7 @@ pub unsafe fn get(key: Key) -> *mut c_void {
 #[cfg(unix)]
 extern {
     fn pthread_key_create(key: *mut pthread_key_t, dtor: *u8) -> c_int;
-
-    // This function is a very cheap operation on both osx and unix. On osx, it
-    // turns out it's just three instructions, and on unix it's a cheap function
-    // which only uses a very small amount of stack.
-    //
-    // This is not marked as such because we think it has a small stack, but
-    // rather we would like to be able to fetch information from
-    // thread-local-storage when a task is running very low on its stack budget.
-    // For example, this is invoked whenever stack overflow is detected, and we
-    // obviously have very little budget to deal with (certainly not anything
-    // close to a fixed_stack_segment)
-    #[rust_stack]
     fn pthread_getspecific(key: pthread_key_t) -> *mut c_void;
-    #[rust_stack]
     fn pthread_setspecific(key: pthread_key_t, value: *mut c_void) -> c_int;
 }
 
@@ -70,8 +55,6 @@ pub unsafe fn get(key: Key) -> *mut c_void {
 pub type Key = DWORD;
 
 #[cfg(windows)]
-#[fixed_stack_segment]
-#[inline(never)]
 pub unsafe fn create(key: &mut Key) {
     static TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF;
     *key = TlsAlloc();
@@ -91,13 +74,7 @@ pub unsafe fn get(key: Key) -> *mut c_void {
 #[cfg(windows)]
 extern "system" {
     fn TlsAlloc() -> DWORD;
-
-    // See the reasoning in pthread_getspecific as to why this has the
-    // 'rust_stack' attribute, as this function was also verified to only
-    // require a small amount of stack.
-    #[rust_stack]
     fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID;
-    #[rust_stack]
     fn TlsSetValue(dwTlsIndex: DWORD, lpTlsvalue: LPVOID) -> BOOL;
 }
 
index 070985fb0a5cf79a9ac36454fdab630f74ccf67d..50f73becef2b8b84f5ecdb17298e1954346aa24f 100644 (file)
@@ -24,8 +24,6 @@
 
 /// Get the number of cores available
 pub fn num_cpus() -> uint {
-    #[fixed_stack_segment]; #[inline(never)];
-
     unsafe {
         return rust_get_num_cpus();
     }
@@ -146,7 +144,6 @@ pub fn abort(msg: &str) -> ! {
     abort();
 
     fn abort() -> ! {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe { libc::abort() }
     }
 }
index ec0e0f5c932105daaaaa3b716c5390e39435caa5..844f61dda0ba5be63213f529b87a9f0cf0478d82 100644 (file)
@@ -296,7 +296,6 @@ pub fn force_destroy(&mut self) {
  *
  * The process's exit code
  */
-#[fixed_stack_segment] #[inline(never)]
 pub fn process_status(prog: &str, args: &[~str]) -> int {
     let mut prog = Process::new(prog, args, ProcessOptions {
         env: None,
index e75f8f6237fe2bb50013545b4f4ba9e9be06c31d..51c11b69972fbd2238ccd1598a5335ab37f54f3b 100644 (file)
@@ -1145,12 +1145,14 @@ fn test_spawn_sched_childs_on_default_sched() {
 mod testrt {
     use libc;
 
-    externfn!(fn rust_dbg_lock_create() -> *libc::c_void)
-    externfn!(fn rust_dbg_lock_destroy(lock: *libc::c_void))
-    externfn!(fn rust_dbg_lock_lock(lock: *libc::c_void))
-    externfn!(fn rust_dbg_lock_unlock(lock: *libc::c_void))
-    externfn!(fn rust_dbg_lock_wait(lock: *libc::c_void))
-    externfn!(fn rust_dbg_lock_signal(lock: *libc::c_void))
+    extern {
+        pub fn rust_dbg_lock_create() -> *libc::c_void;
+        pub fn rust_dbg_lock_destroy(lock: *libc::c_void);
+        pub fn rust_dbg_lock_lock(lock: *libc::c_void);
+        pub fn rust_dbg_lock_unlock(lock: *libc::c_void);
+        pub fn rust_dbg_lock_wait(lock: *libc::c_void);
+        pub fn rust_dbg_lock_signal(lock: *libc::c_void);
+    }
 }
 
 #[test]
index d3c43e692a904614e91341874356f00c6990ee5f..1ce228250c971ba0a6af4ce70226a182bfa10bf8 100644 (file)
@@ -144,21 +144,16 @@ pub mod dl {
     use result::*;
 
     pub unsafe fn open_external(filename: &path::Path) -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
         do filename.with_c_str |raw_name| {
             dlopen(raw_name, Lazy as libc::c_int)
         }
     }
 
     pub unsafe fn open_internal() -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
-
         dlopen(ptr::null(), Lazy as libc::c_int)
     }
 
     pub fn check_for_errors_in<T>(f: &fn()->T) -> Result<T, ~str> {
-        #[fixed_stack_segment]; #[inline(never)];
-
         unsafe {
             // dlerror isn't thread safe, so we need to lock around this entire
             // sequence. `atomically` asserts that we don't do anything that
@@ -184,13 +179,9 @@ pub fn check_for_errors_in<T>(f: &fn()->T) -> Result<T, ~str> {
     }
 
     pub unsafe fn symbol(handle: *libc::c_void, symbol: *libc::c_char) -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
-
         dlsym(handle, symbol)
     }
     pub unsafe fn close(handle: *libc::c_void) {
-        #[fixed_stack_segment]; #[inline(never)];
-
         dlclose(handle); ()
     }
 
@@ -225,21 +216,18 @@ pub mod dl {
     use result::*;
 
     pub unsafe fn open_external(filename: &path::Path) -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
         do os::win32::as_utf16_p(filename.as_str().unwrap()) |raw_name| {
             LoadLibraryW(raw_name)
         }
     }
 
     pub unsafe fn open_internal() -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
         let handle = ptr::null();
         GetModuleHandleExW(0 as libc::DWORD, ptr::null(), &handle as **libc::c_void);
         handle
     }
 
     pub fn check_for_errors_in<T>(f: &fn()->T) -> Result<T, ~str> {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             do atomically {
                 SetLastError(0);
@@ -257,11 +245,9 @@ pub fn check_for_errors_in<T>(f: &fn()->T) -> Result<T, ~str> {
     }
 
     pub unsafe fn symbol(handle: *libc::c_void, symbol: *libc::c_char) -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
         GetProcAddress(handle, symbol)
     }
     pub unsafe fn close(handle: *libc::c_void) {
-        #[fixed_stack_segment]; #[inline(never)];
         FreeLibrary(handle); ()
     }
 
index 59d1740acc09d3b89b8ed7c440220a177ca2939e..f0b94c10fdce73528ec66d728d1e9cd22ffed42f 100644 (file)
@@ -369,28 +369,16 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     pub fn powif32(a: f32, x: i32) -> f32;
     pub fn powif64(a: f64, x: i32) -> f64;
 
-    // the following kill the stack canary without
-    // `fixed_stack_segment`. This possibly only affects the f64
-    // variants, but it's hard to be sure since it seems to only
-    // occur with fairly specific arguments.
-    #[fixed_stack_segment]
     pub fn sinf32(x: f32) -> f32;
-    #[fixed_stack_segment]
     pub fn sinf64(x: f64) -> f64;
 
-    #[fixed_stack_segment]
     pub fn cosf32(x: f32) -> f32;
-    #[fixed_stack_segment]
     pub fn cosf64(x: f64) -> f64;
 
-    #[fixed_stack_segment]
     pub fn powf32(a: f32, x: f32) -> f32;
-    #[fixed_stack_segment]
     pub fn powf64(a: f64, x: f64) -> f64;
 
-    #[fixed_stack_segment]
     pub fn expf32(x: f32) -> f32;
-    #[fixed_stack_segment]
     pub fn expf64(x: f64) -> f64;
 
     pub fn exp2f32(x: f32) -> f32;
index 484ddde6d3ccd226b6dcebee2b6ec900f2e6cc8d..ea03ea6f551c2a2dece7c1ff0bfb5047c5cd4ddf 100644 (file)
@@ -72,7 +72,6 @@ fn test_run_in_bare_thread_exchange() {
 /// can't run correctly un-altered. Valgrind is there to help
 /// you notice weirdness in normal, un-doctored code paths!
 pub fn running_on_valgrind() -> bool {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe { rust_running_on_valgrind() != 0 }
 }
 
index 1c412791d05e33b4e6b1a38d702fd150a2a69434..a08b914ca314ac883e5c53ae1a3533ab5501bcc6 100644 (file)
@@ -475,12 +475,14 @@ pub fn unwrap(self) -> T {
     }
 }
 
-externfn!(fn rust_create_little_lock() -> rust_little_lock)
-externfn!(fn rust_destroy_little_lock(lock: rust_little_lock))
-externfn!(fn rust_lock_little_lock(lock: rust_little_lock))
-externfn!(fn rust_unlock_little_lock(lock: rust_little_lock))
-externfn!(fn rust_signal_little_lock(lock: rust_little_lock))
-externfn!(fn rust_wait_little_lock(lock: rust_little_lock))
+extern {
+    fn rust_create_little_lock() -> rust_little_lock;
+    fn rust_destroy_little_lock(lock: rust_little_lock);
+    fn rust_lock_little_lock(lock: rust_little_lock);
+    fn rust_unlock_little_lock(lock: rust_little_lock);
+    fn rust_signal_little_lock(lock: rust_little_lock);
+    fn rust_wait_little_lock(lock: rust_little_lock);
+}
 
 #[cfg(test)]
 mod tests {
index 736f92910af204e3fa6737fc051fd53f5280c92a..838ce4a630948590238cf2d40af7a223f3a60c59 100644 (file)
@@ -201,7 +201,6 @@ fn print_maybe_styled(msg: &str, color: term::attr::Attr) {
 
     let stderr = @mut io::stderr() as @mut io::Writer;
     fn is_stderr_screen() -> bool {
-        #[fixed_stack_segment];
         use std::libc;
         unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }
     }
index b74349da2a9fa6b80e7e88cb75a26001d38d2115..f8155ae2e6bc33242955de69bbc5ee4753286b91 100644 (file)
@@ -959,84 +959,6 @@ macro_rules! local_data_key (
             pub static $name: ::std::local_data::Key<$ty> = &::std::local_data::Key;
         )
     )
-
-    /// externfn! declares a wrapper for an external function.
-    /// It is intended to be used like:
-    ///
-    /// externfn!(#[nolink]
-    ///           fn memcmp(cx: *u8, ct: *u8, n: u32) -> u32)
-    ///
-    /// Due to limitations in the macro parser, this pattern must be
-    /// implemented with 4 distinct patterns (with attrs / without
-    /// attrs CROSS with args / without ARGS).
-    ///
-    /// Also, this macro grammar allows for any number of return types
-    /// because I couldn't figure out the syntax to specify at most one.
-    macro_rules! externfn(
-        (fn $name:ident () $(-> $ret_ty:ty),*) => (
-            pub unsafe fn $name() $(-> $ret_ty),* {
-                // Note: to avoid obscure bug in macros, keep these
-                // attributes *internal* to the fn
-                #[fixed_stack_segment];
-                #[inline(never)];
-                #[allow(missing_doc)];
-
-                return $name();
-
-                extern {
-                    fn $name() $(-> $ret_ty),*;
-                }
-            }
-        );
-        (fn $name:ident ($($arg_name:ident : $arg_ty:ty),*) $(-> $ret_ty:ty),*) => (
-            pub unsafe fn $name($($arg_name : $arg_ty),*) $(-> $ret_ty),* {
-                // Note: to avoid obscure bug in macros, keep these
-                // attributes *internal* to the fn
-                #[fixed_stack_segment];
-                #[inline(never)];
-                #[allow(missing_doc)];
-
-                return $name($($arg_name),*);
-
-                extern {
-                    fn $name($($arg_name : $arg_ty),*) $(-> $ret_ty),*;
-                }
-            }
-        );
-        ($($attrs:attr)* fn $name:ident () $(-> $ret_ty:ty),*) => (
-            pub unsafe fn $name() $(-> $ret_ty),* {
-                // Note: to avoid obscure bug in macros, keep these
-                // attributes *internal* to the fn
-                #[fixed_stack_segment];
-                #[inline(never)];
-                #[allow(missing_doc)];
-
-                return $name();
-
-                $($attrs)*
-                extern {
-                    fn $name() $(-> $ret_ty),*;
-                }
-            }
-        );
-        ($($attrs:attr)* fn $name:ident ($($arg_name:ident : $arg_ty:ty),*) $(-> $ret_ty:ty),*) => (
-            pub unsafe fn $name($($arg_name : $arg_ty),*) $(-> $ret_ty),* {
-                // Note: to avoid obscure bug in macros, keep these
-                // attributes *internal* to the fn
-                #[fixed_stack_segment];
-                #[inline(never)];
-                #[allow(missing_doc)];
-
-                return $name($($arg_name),*);
-
-                $($attrs)*
-                extern {
-                    fn $name($($arg_name : $arg_ty),*) $(-> $ret_ty),*;
-                }
-            }
-        )
-    )
-
 }"#
 }
 
index 3673d3719ad5f9e8152da2266de3fad8297e1e9d..247be194b90feb88e95cfca6d8ff064e3d266d3c 100644 (file)
@@ -22,6 +22,8 @@
 #[crate_type = "lib"];
 
 #[feature(macro_rules, globs, managed_boxes)];
+#[allow(unrecognized_lint)]; // NOTE: remove after the next snapshot
+#[allow(cstack)]; // NOTE: remove after the next snapshot.
 
 extern mod extra;
 
index 0f762039746f78cd178ae0bbd546a2a4a11c0cb6..e77efce7f5876497169769a30fa7b43681d255cd 100644 (file)
@@ -25,7 +25,6 @@ pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn fact(n: uint) -> uint {
     unsafe {
         info!("n = {}", n);
index f91327b6a6521262d12d14be8938fea305a8e2c6..37efa5768af7cd819dc7b2fc159448cc10281832 100644 (file)
@@ -91,7 +91,6 @@ fn vector<M: MutableMap<uint, uint>>(map: &mut M, n_keys: uint, dist: &[uint]) {
     }
 }
 
-#[fixed_stack_segment]
 fn main() {
     let args = os::args();
     let n_keys = {
index f93ce2e93b94a3446aa5129de49088df6ffb2e07..079ec7c50bbc22617df011a35eb5bd948487d813 100644 (file)
@@ -91,7 +91,6 @@ fn fannkuch_redux(n: i32) -> i32 {
     }
 }
 
-#[fixed_stack_segment]
 fn main() {
     let n: i32 = FromStr::from_str(os::args()[1]).unwrap();
     println!("Pfannkuchen({}) = {}", n as int, fannkuch_redux(n) as int);
index 1f1ce86404b69347896cee3050b49d0be120a2e2..11274905a4ea6e2adf0fd30f73364ed01bbd4f57 100644 (file)
@@ -184,7 +184,6 @@ fn make(&mut self, n: uint) {
     }
 }
 
-#[fixed_stack_segment]
 fn main() {
     let n: uint = FromStr::from_str(os::args()[1]).unwrap();
 
index 5c2176e30ffb649b6c45dfe7aed187f97ec24ea8..f2ba0d40ebc69290bce9292ab197ca6058177a66 100644 (file)
@@ -243,8 +243,6 @@ fn read_stdin() -> ~[u8] {
     }
 }
 
-#[inline(never)]
-#[fixed_stack_segment]
 fn generate_frequencies(frequencies: &mut Table,
                         mut input: &[u8],
                         frame: i32) {
@@ -264,8 +262,6 @@ fn generate_frequencies(frequencies: &mut Table,
     }
 }
 
-#[inline(never)]
-#[fixed_stack_segment]
 fn print_frequencies(frequencies: &Table, frame: i32) {
     let mut vector = ~[];
     for frequencies.each |entry| {
@@ -289,7 +285,6 @@ fn print_occurrences(frequencies: &mut Table, occurrence: &'static str) {
     frequencies.lookup(Code::pack(occurrence), PrintCallback(occurrence))
 }
 
-#[fixed_stack_segment]
 fn main() {
     let input = read_stdin();
 
index 83ffa058b3280db1e5aef20ecc4a0efc36ce75d7..6af0e04a8dd4efab591e10ecb580f5f1327186d7 100644 (file)
@@ -8,7 +8,6 @@
 static ITER: uint = 50;
 static LIMIT: f64 = 2.0;
 
-#[fixed_stack_segment]
 fn main() {
     unsafe {
         let w: i32 = FromStr::from_str(os::args()[1]).unwrap();
index d56fb98cab033894d97a05ca9be366da8d73a31f..355adc39c7177492b208f5164abe58ea47fe5de5 100644 (file)
@@ -161,7 +161,6 @@ fn pidigits(n: u32) {
     }
 }
 
-#[fixed_stack_segment]
 fn main() {
     let n: u32 = FromStr::from_str(os::args()[1]).get();
     pidigits(n);
index d7a7fe00185ba5054fefa4b6be124249831e3fec..d0e13865347d80149a8c0b9cc921c04c1ac98fe3 100644 (file)
@@ -90,7 +90,6 @@
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 ];
 
-#[fixed_stack_segment]
 fn main() {
     unsafe {
         let mode = "r";
index 105972591f33076a538ecc4f94702eec6b8d3b60..6a9837fb832ca6593271ad742c150b9705524941 100644 (file)
@@ -52,7 +52,6 @@ fn mult_AtAv(v: &mut [f64], out: &mut [f64], tmp: &mut [f64]) {
     mult_Atv(tmp, out);
 }
 
-#[fixed_stack_segment]
 fn main() {
     let n: uint = FromStr::from_str(os::args()[1]).unwrap();
     let mut u = vec::from_elem(n, 1f64);
diff --git a/src/test/compile-fail/extern-cstack-lint.rs b/src/test/compile-fail/extern-cstack-lint.rs
deleted file mode 100644 (file)
index 8ccd923..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern fn f() {
-}
-
-extern fn call1() {
-    f(); // OK from another extern fn!
-}
-
-fn call2() {
-    f(); //~ ERROR invoking non-Rust fn
-}
-
-
-fn main() {}
diff --git a/src/test/compile-fail/lint-cstack.rs b/src/test/compile-fail/lint-cstack.rs
deleted file mode 100644 (file)
index 11fe02e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern {
-    fn rust_get_test_int() -> std::libc::intptr_t;
-}
-
-trait A {
-    fn foo() {
-        unsafe {
-            rust_get_test_int(); //~ ERROR invoking non-Rust fn
-        }
-    }
-}
-
-fn main() {
-}
index 6f0c2f1de1ab45b1bb7f4cf7992a2e1e329d2cb3..50cc9ceb94e91a1f9c69470c6222ccee50057d0d 100644 (file)
@@ -10,7 +10,6 @@
 
 // Exercise the unused_unsafe attribute in some positive and negative cases
 
-#[allow(cstack)];
 #[deny(unused_unsafe)];
 
 mod foo {
index 4133f008cbfbab617ee792946bad394686aead10..3156cd9af3276ef8fba39523b1bf8c4217158cd0 100644 (file)
@@ -18,7 +18,6 @@
 
 extern "C" fn bar(f: int, x: u8) {}
 
-#[fixed_stack_segment]
 fn main() {
     unsafe {
         foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied
index 45e544cef8c8a21c74e2bd8577eb345d7d69e855..a9c6141c18b46fe72515f0eae2c343ca27042068 100644 (file)
@@ -14,7 +14,6 @@
 
 use anonexternmod::rust_get_test_int;
 
-#[fixed_stack_segment]
 pub fn main() {
     unsafe {
         rust_get_test_int();
index 343e9b9b8ad1f103018198a25b0650b2ae5304cb..3323aa4e2cde6dbc689dcce78aebd79f20d4ae10 100644 (file)
@@ -15,7 +15,6 @@
     fn rust_get_test_int() -> libc::intptr_t;
 }
 
-#[fixed_stack_segment]
 pub fn main() {
     unsafe {
         let _ = rust_get_test_int();
index 866dd6b67053dfb583f211a58f3e2fa359b89d21..940f62789bbc388be712fd0c76fd0236d4cf6fef 100644 (file)
@@ -18,12 +18,10 @@ mod libc {
     }
 }
 
-#[fixed_stack_segment]
 fn atol(s: ~str) -> int {
     s.with_c_str(|x| unsafe { libc::atol(x) as int })
 }
 
-#[fixed_stack_segment]
 fn atoll(s: ~str) -> i64 {
     s.with_c_str(|x| unsafe { libc::atoll(x) as i64 })
 }
index 8a7a44d7f30224c9a2bd9465ce2f6e104df5bfa7..e9cd860bd226eacc01894b6cd4f6f674a2b552a9 100644 (file)
@@ -60,8 +60,6 @@ fn process_exists(pid: libc::pid_t) -> bool {
 
     #[cfg(windows)]
     fn process_exists(pid: libc::pid_t) -> bool {
-        #[fixed_stack_segment];
-
         use std::libc::types::os::arch::extra::DWORD;
         use std::libc::funcs::extra::kernel32::{CloseHandle, GetExitCodeProcess, OpenProcess};
         use std::libc::consts::os::extra::{FALSE, PROCESS_QUERY_INFORMATION, STILL_ACTIVE };
index 86922f5dc25e3de1b554731cbd9bf7fb49ebb1bf..f55be369b57df546b81aba970579a6bc579c413d 100644 (file)
@@ -28,7 +28,6 @@ pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
     }
 }
 
-#[fixed_stack_segment]
 fn count(n: uint) -> uint {
     unsafe {
         info!("n = {}", n);
index bbff0edfffd8fb5eae0fd457f338a2e667f377e3..5bda762a68bcf1249726832fe6b2b354d33f8996 100644 (file)
@@ -29,7 +29,6 @@ pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn count(n: uint) -> uint {
     unsafe {
         info!("n = {}", n);
index 925ec8e7ff72040253e863e6e3bb57947af3e7cb..34d2b577f202c0210ccc5033437acc996e6e216f 100644 (file)
@@ -13,8 +13,6 @@
 extern fn f(x: uint) -> uint { x * 2 }
 
 pub fn main() {
-    #[fixed_stack_segment];
-
     let x = f(22);
     assert_eq!(x, 44);
 }
index bea937fa9c9a720b53658e7c4f60d43a8209eea2..6222b681dc994a1448af99ea8110250d8ebd3a85 100644 (file)
@@ -28,7 +28,6 @@ pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn fact(n: uint) -> uint {
     unsafe {
         info!("n = {}", n);
index 8a54b9bfc3481c06700d3e8c223ff9fb142f874d..548336962f5100124b8dfaac9d4ceca87c1b72be 100644 (file)
@@ -33,7 +33,6 @@ pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn count(n: uint) -> uint {
     unsafe {
         info!("n = {}", n);
index a2b42134b55ba88cf02717edfa129a75f2fcace3..f1255c7e8f1ef743fe9fe5f7fa2b0ba3be7f8dd2 100644 (file)
@@ -13,7 +13,6 @@
 
 extern mod externcallback(vers = "0.1");
 
-#[fixed_stack_segment] #[inline(never)]
 fn fact(n: uint) -> uint {
     unsafe {
         info!("n = {}", n);
index eadb01d854c729ab5ecd23f2bec86042417f3e8d..bb6a68dfda407880bf2bbd290bdee5dc1e515764 100644 (file)
@@ -22,7 +22,6 @@ struct TwoU16s {
     pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let x = TwoU16s {one: 22, two: 23};
index 147db0c0b2b0d9eb1c33ccf6b16b67c2ce3d6245..3389c56c83bf00afd777789a2f270c409f0a8721 100644 (file)
@@ -20,7 +20,6 @@ struct TwoU32s {
     pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let x = TwoU32s {one: 22, two: 23};
index ed9871b5edb2d025f89f7c38f1147d12e58dea4f..caba29a26679022865ed5e1a576a0632a4903a8d 100644 (file)
@@ -20,7 +20,6 @@ struct TwoU64s {
     pub fn rust_dbg_extern_identity_TwoU64s(u: TwoU64s) -> TwoU64s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let x = TwoU64s {one: 22, two: 23};
index 772970ce8a3376ced5c8aa7018eb6d0847364807..1b5e661ed8e8396b58f447188ade413ffd52eb95 100644 (file)
@@ -25,7 +25,6 @@ struct TwoU64s {
     pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let x = TwoU64s {one: 22, two: 23};
index 868c40d642d457135beda9dadbd154e654813245..8757f9593f77074b413435c572e617e18c0596ef 100644 (file)
@@ -22,7 +22,6 @@ struct TwoU8s {
     pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let x = TwoU8s {one: 22, two: 23};
index f255746b75a8f683ca6ae60449866660904a0fcd..0cdfaf29a0582a44e9934eb12c26fa256ab508c8 100644 (file)
@@ -14,7 +14,6 @@
     pub fn rust_dbg_extern_identity_u8(v: u8) -> u8;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         assert_eq!(22_u8, rust_dbg_extern_identity_u8(22_u8));
index c80a0cd502fd351905a863140af3f5b765a2b702..cb0a061a7abd831e2d42e185b43e5c3bf1834e50 100644 (file)
@@ -12,7 +12,6 @@
     pub fn rust_dbg_extern_identity_double(v: f64) -> f64;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         assert_eq!(22.0_f64, rust_dbg_extern_identity_double(22.0_f64));
index c6fdabeab3dea0bbf4ee0f39903531bd6426966f..aa54f014046127c735d695d8d74b1fec1177af95 100644 (file)
@@ -14,7 +14,6 @@
     pub fn rust_dbg_extern_identity_u32(v: u32) -> u32;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         assert_eq!(22_u32, rust_dbg_extern_identity_u32(22_u32));
index 09babc1109f8c3166bbd9058201c5b909fb8ec10..7c39080a5689732dc778d8554e015c0e12a31eee 100644 (file)
@@ -14,7 +14,6 @@
     pub fn rust_dbg_extern_identity_u64(v: u64) -> u64;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         assert_eq!(22_u64, rust_dbg_extern_identity_u64(22_u64));
index 2b9f99ca0105cb06a620c519252e4d0139275b33..ba671a1c4949f3bf82ea231708f881591fcbcd9b 100644 (file)
@@ -16,7 +16,6 @@ struct TwoU16s {
     pub fn rust_dbg_extern_return_TwoU16s() -> TwoU16s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let y = rust_dbg_extern_return_TwoU16s();
index f93a15bd80806c601aab3e1612346e939aff138c..90562f0f6b1cec5419f334d707acc5a6b9fdfbc7 100644 (file)
@@ -16,7 +16,6 @@ struct TwoU32s {
     pub fn rust_dbg_extern_return_TwoU32s() -> TwoU32s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let y = rust_dbg_extern_return_TwoU32s();
index 7fcbe3670fc0a3ce313eb16982613688e59de9ff..a28795b93e0bb402bdf3a2cf0398862cd82aaece 100644 (file)
@@ -18,7 +18,6 @@ struct TwoU64s {
     pub fn rust_dbg_extern_return_TwoU64s() -> TwoU64s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let y = rust_dbg_extern_return_TwoU64s();
index aae8b8a8587d0d7d91addae7f5b4fd24135d47f1..5d2fd14075844f46379e416535bd9445d590e38f 100644 (file)
@@ -16,7 +16,6 @@ struct TwoU8s {
     pub fn rust_dbg_extern_return_TwoU8s() -> TwoU8s;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let y = rust_dbg_extern_return_TwoU8s();
index 2323567ccce4360385bdd5447cdb54d93775d129..21706848c81cf8328a5d9495bf123a510f5fd928 100644 (file)
@@ -33,7 +33,6 @@ pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn count(n: uint) -> uint {
     unsafe {
         rustrt::rust_dbg_call(cb, n)
index 3ce0dbe30e2066199c54671e3bb12f8af4c6a247..45841e22896d77da1ef7859e34fbdd25f2945210 100644 (file)
@@ -29,7 +29,6 @@ pub fn rust_dbg_call(cb: extern "C" fn (libc::uintptr_t) -> libc::uintptr_t,
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn count(n: uint) -> uint {
     unsafe {
         task::deschedule();
index 2fa4f191ed14d759c8f67e9b6d0ead54dd69ac4c..283efa2ac7c6f31345a4716a59daafc3100a45fa 100644 (file)
@@ -2,8 +2,10 @@
 use std::libc;
 use std::unstable::run_in_bare_thread;
 
-externfn!(fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t),
-                           data: libc::uintptr_t) -> libc::uintptr_t)
+extern {
+    fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t),
+                     data: libc::uintptr_t) -> libc::uintptr_t;
+}
 
 pub fn main() {
     unsafe {
index 9f1ca435c739cecc43340375485624d1511655ed..66d3bda30e6f210b68b06ad6d17e082f9306304d 100644 (file)
@@ -29,7 +29,6 @@ mod rustrt2 {
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         rustrt1::rust_get_test_int();
index 3c6d33c637cdfe5540dba4d38ca07dc8880b6a32..d05680651f7dde5663daf7f2e8a3ce896893cc5e 100644 (file)
@@ -20,7 +20,6 @@ mod libc {
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn strlen(str: ~str) -> uint {
     // C string is terminated with a zero
     do str.with_c_str |buf| {
index 6a7ee7101efcf1beb5c975ed2471810c1473a555..0702d49cfc11200486261ce4e80345e70654dafd 100644 (file)
@@ -18,7 +18,6 @@ mod rustrt {
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         rustrt::rust_get_test_int();
index 1736428affb36cc0844152bba85fa5ff4d47b008..7e79311c5ad1f28da6f295538752b967e01634a1 100644 (file)
@@ -17,7 +17,6 @@
 
 extern mod foreign_lib;
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         let _foo = foreign_lib::rustrt::rust_get_test_int();
index 9eebf662843836b794c0a095714be6d6b7850d7f..5bbbe323722b9323adeeb62d8b4ac74a7f0d8e33 100644 (file)
@@ -19,7 +19,6 @@ fn to_c_int(v: &mut int) -> &mut c_int {
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn lgamma(n: c_double, value: &mut int) -> c_double {
     unsafe {
         return m::lgamma(n, to_c_int(value));
index a16108452bc9a863d1f7ec95605aa428476b58b9..860b23849c6ffcd203be9f094bb3ac9de31f3b57 100644 (file)
@@ -14,7 +14,6 @@ pub struct Foo {
     }
 
     extern {
-        #[rust_stack]
         pub fn foo(v: *Foo) -> Foo;
     }
 }
index 80901475c04b542ef7b2a3bd0a1468fb560ca8b9..5d89a2d5b3c8dc288733e58ecfd4e954ec80205c 100644 (file)
@@ -15,7 +15,6 @@
 }
 
 trait A {
-    #[fixed_stack_segment]
     fn foo() {
         unsafe {
             rust_get_test_int();
index 37b9b5fe068379e8963708895017a2ae5ad3eec1..ba3b40867bb9ba5218e2caa2dd027d0979501948 100644 (file)
@@ -4,7 +4,6 @@
 pub struct Fd(c_int);
 
 impl Drop for Fd {
-    #[fixed_stack_segment] #[inline(never)]
     fn drop(&mut self) {
         unsafe {
             libc::close(**self);
index e4e260ab36ec093669f248b5b4720c0f4fd74608..c5d631336337a6499a713fffe89d0a3b029d200f 100644 (file)
@@ -6,7 +6,6 @@ mod a {
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 pub fn main() {
     unsafe {
         a::free(transmute(0));
index 6740230728c6c9692fc7007603cca8fdcc0fb5b9..2446fb2a94a964062b04a53f22fa0ab9ee7870e6 100644 (file)
@@ -27,7 +27,6 @@ struct Ccx {
     x: int
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn alloc<'a>(_bcx : &'a arena) -> &'a Bcx<'a> {
     unsafe {
         cast::transmute(libc::malloc(mem::size_of::<Bcx<'a>>()
@@ -39,7 +38,6 @@ fn h<'a>(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> {
     return alloc(bcx.fcx.arena);
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn g(fcx : &Fcx) {
     let bcx = Bcx { fcx: fcx };
     let bcx2 = h(&bcx);
index fcb57152daa5faf39aa6feee4b6778e9719b7516..bdadcbdb72958eec1c4998ec4bc405dc04f8f806 100644 (file)
@@ -21,7 +21,6 @@
 use std::rt::io::fs;
 
 fn rename_directory() {
-    #[fixed_stack_segment];
     unsafe {
         static U_RWX: i32 = (libc::S_IRUSR | libc::S_IWUSR | libc::S_IXUSR) as i32;
 
index 0d042d002a144211f0b0c1e1a89de87dab6192bd..bdfc747c8bc77339e0f3f44228acec4ea97bb0ed 100644 (file)
@@ -26,7 +26,6 @@ fn static_bound_set(a: &'static mut libc::c_int) {
     *a = 3;
 }
 
-#[fixed_stack_segment] #[inline(never)]
 unsafe fn run() {
     assert!(rust_dbg_static_mut == 3);
     rust_dbg_static_mut = 4;
index 8b22b4c9ac10cc23f86212ae20999df6ebfe9ee9..7edaad3748ae7225d0a0985a5eb591eac2f1bee2 100644 (file)
@@ -23,7 +23,6 @@ mod rustrt {
     }
 }
 
-#[fixed_stack_segment] #[inline(never)]
 fn test1() {
     unsafe {
         let q = Quad { a: 0xaaaa_aaaa_aaaa_aaaa_u64,
@@ -43,8 +42,6 @@ fn test1() {
 }
 
 #[cfg(target_arch = "x86_64")]
-#[fixed_stack_segment]
-#[inline(never)]
 fn test2() {
     unsafe {
         let f = Floats { a: 1.234567890e-15_f64,
index 6f8867afef324f079222c568ac3a2a1f1ccd9ca2..d82e2890ae8d3c95206c3378753f05e4085fac2f 100644 (file)
@@ -22,7 +22,6 @@ unsafe fn check<T>(expected: &str, f: &fn(*mut c_char) -> T) {
     assert_eq!(expected, res.as_str().unwrap());
 }
 
-#[fixed_stack_segment]
 pub fn main() {
 
     unsafe {
@@ -43,8 +42,6 @@ pub fn main() {
 
         // A function that takes a function pointer
         unsafe fn call(p: extern "C" unsafe fn(*mut c_char, *c_char, ...) -> c_int) {
-            #[fixed_stack_segment];
-
             // Call with just the named parameter via fn pointer
             do "Hello World\n".with_c_str |c| {
                 check("Hello World\n", |s| p(s, c));
index 9eb6f14256e6392140cea49f6d65d4810f7ba7ca..522e5fd978ead309168c71dc427caeea76e74dd7 100644 (file)
@@ -28,7 +28,6 @@ pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
 
 
 #[cfg(windows)]
-#[fixed_stack_segment]
 pub fn main() {
     let heap = unsafe { kernel32::GetProcessHeap() };
     let mem = unsafe { kernel32::HeapAlloc(heap, 0u32, 100u32) };