about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-11-10 06:56:30 +0000
committerbors <bors@rust-lang.org>2015-11-10 06:56:30 +0000
commit6aee7c5d2c3e5796844671cf072487f6fb04cb9b (patch)
tree955886bbc19c1ce0943377edf689ad4dd1842749 /src/libsyntax
parent2968dfa28597e50b748b641f9b881c7012b041c6 (diff)
parent3d28b8b98e6e4f55ef4ecd8babf0a050f48a3d11 (diff)
downloadrust-6aee7c5d2c3e5796844671cf072487f6fb04cb9b.tar.gz
rust-6aee7c5d2c3e5796844671cf072487f6fb04cb9b.zip
Auto merge of #29546 - alexcrichton:new-libc, r=brson
This commit replaces the in-tree liblibc with the [external clone](https://github.com/rust-lang-nursery/libc) which has no evolved beyond the in-tree version in light of its [recent redesign](https://github.com/rust-lang/rfcs/pull/1291).

The primary changes here are:

* `src/liblibc/lib.rs` was deleted
* `src/liblibc` is now a submodule pointing at the external repository
* `src/libstd/sys/unix/{c.rs,sync.rs}` were both deleted having all bindings folded into the external liblibc.
* Many ad-hoc `extern` blocks in the standard library were removed in favor of bindings now being in the external liblibc.
* Many functions/types were added to `src/libstd/sys/windows/c.rs`, and the scattered definitions throughout the standard library were consolidated here.

At the API level this commit is **not a breaking change**, although it is only very lightly tested on the *BSD variants and is probably going to break almost all of their builds! Follow-up commits to liblibc should in theory be all that's necessary to get the build working on the *BSDs again.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index 2b34db3f6ea..f1fd8be4728 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -21,7 +21,6 @@ use std::{cmp, error, fmt};
 use std::io::prelude::*;
 use std::io;
 use term::{self, WriterWrapper};
-use libc;
 
 /// maximum number of lines we will print for each error; arbitrary.
 const MAX_LINES: usize = 6;
@@ -767,15 +766,19 @@ impl EmitterWriter {
 
 #[cfg(unix)]
 fn stderr_isatty() -> bool {
+    use libc;
     unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }
 }
 #[cfg(windows)]
 fn stderr_isatty() -> bool {
-    const STD_ERROR_HANDLE: libc::DWORD = -12i32 as libc::DWORD;
+    type DWORD = u32;
+    type BOOL = i32;
+    type HANDLE = *mut u8;
+    const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
     extern "system" {
-        fn GetStdHandle(which: libc::DWORD) -> libc::HANDLE;
-        fn GetConsoleMode(hConsoleHandle: libc::HANDLE,
-                          lpMode: libc::LPDWORD) -> libc::BOOL;
+        fn GetStdHandle(which: DWORD) -> HANDLE;
+        fn GetConsoleMode(hConsoleHandle: HANDLE,
+                          lpMode: *mut DWORD) -> BOOL;
     }
     unsafe {
         let handle = GetStdHandle(STD_ERROR_HANDLE);