about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-12-24 20:11:33 -0800
committerbors <bors@rust-lang.org>2013-12-24 20:11:33 -0800
commita1e68debb1b0054634ce071b98142c911a03e4d1 (patch)
tree97367523a6524c5bf7f02b371aa4eadef0b6c04b
parent32e730f122f06202eb48aefcc2cef6ee3e279a2f (diff)
parentf82246f56db34b52fac8466659ad454f1610280c (diff)
downloadrust-a1e68debb1b0054634ce071b98142c911a03e4d1.tar.gz
rust-a1e68debb1b0054634ce071b98142c911a03e4d1.zip
auto merge of #10961 : brson/rust/lessc, r=alexcrichton
-rw-r--r--src/rt/rust_builtin.c50
-rw-r--r--src/rt/rust_globals.h120
-rw-r--r--src/rt/rust_test_helpers.c3
-rw-r--r--src/rt/rust_upcall.c2
-rw-r--r--src/rt/rust_uv.c5
5 files changed, 37 insertions, 143 deletions
diff --git a/src/rt/rust_builtin.c b/src/rt/rust_builtin.c
index c50bdc7c2c6..f14554fd65b 100644
--- a/src/rt/rust_builtin.c
+++ b/src/rt/rust_builtin.c
@@ -10,28 +10,35 @@
 
 /* Foreign builtins. */
 
-#include "rust_globals.h"
 #include "vg/valgrind.h"
 
+#include <stdint.h>
 #include <time.h>
-
-#ifdef __APPLE__
-    #include <TargetConditionals.h>
-    #include <mach/mach_time.h>
-
-    #if (TARGET_OS_IPHONE)
-        extern char **environ;
-    #else
-        #include <crt_externs.h>
-    #endif
-#endif
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
 
 #if !defined(__WIN32__)
 #include <sys/time.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <signal.h>
+#include <unistd.h>
+#include <pthread.h>
+#else
+#include <windows.h>
+#include <wincrypt.h>
+#include <stdio.h>
+#include <tchar.h>
 #endif
 
-#ifdef __FreeBSD__
-extern char **environ;
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#include <mach/mach_time.h>
+
+#if !(TARGET_OS_IPHONE)
+#include <crt_externs.h>
+#endif
 #endif
 
 #ifdef __ANDROID__
@@ -57,6 +64,16 @@ timegm(struct tm *tm)
 }
 #endif
 
+#ifdef __APPLE__
+#if (TARGET_OS_IPHONE)
+extern char **environ;
+#endif
+#endif
+
+#if defined(__FreeBSD__) || defined(__linux__) || defined(__ANDROID__)
+extern char **environ;
+#endif
+
 #if defined(__WIN32__)
 char**
 rust_env_pairs() {
@@ -323,8 +340,6 @@ rust_mktime(rust_tm* timeptr) {
 }
 
 #ifndef _WIN32
-#include <sys/types.h>
-#include <dirent.h>
 
 DIR*
 rust_opendir(char *dirname) {
@@ -419,9 +434,6 @@ rust_unset_sigprocmask() {
 
 #else
 
-#include <signal.h>
-#include <unistd.h>
-
 void
 rust_unset_sigprocmask() {
     // this can't be safely converted to rust code because the
diff --git a/src/rt/rust_globals.h b/src/rt/rust_globals.h
deleted file mode 100644
index 317f8af237f..00000000000
--- a/src/rt/rust_globals.h
+++ /dev/null
@@ -1,120 +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.
-
-#ifndef RUST_GLOBALS_H
-#define RUST_GLOBALS_H
-
-#if defined(__cplusplus)
-#define INLINE inline
-#elif defined(_MSC_VER) || defined(__GNUC__)
-#define INLINE __inline__
-#else
-#define INLINE inline
-#endif
-
-#if defined(__GNUC__)
-#define ALWAYS_INLINE __attribute__((always_inline)) INLINE
-#elif defined(_MSC_VER)
-#define ALWAYS_INLINE __forceinline
-#else
-#define ALWAYS_INLINE INLINE
-#endif
-
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#ifndef __STDC_CONSTANT_MACROS
-#define __STDC_CONSTANT_MACROS 1
-#endif
-
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS 1
-#endif
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-
-#define ERROR 0
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <math.h>
-#include <assert.h>
-
-#if defined(__WIN32__)
-// Prevent unnecessary #include's from <windows.h>
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-// Prevent defining min and max macro
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-#if defined(__cplusplus)
-extern "C" {
-#endif
-#include <windows.h>
-#include <tchar.h>
-#include <wincrypt.h>
-#if defined(__cplusplus)
-}
-#endif
-#elif defined(__GNUC__)
-#include <unistd.h>
-#include <dlfcn.h>
-#include <pthread.h>
-#include <errno.h>
-#include <dirent.h>
-
-#define GCC_VERSION (__GNUC__ * 10000 \
-                     + __GNUC_MINOR__ * 100 \
-                     + __GNUC_PATCHLEVEL__)
-
-#else
-#error "Platform not supported."
-#endif
-
-#ifdef __i386__
-// 'cdecl' ABI only means anything on i386
-#ifdef __WIN32__
-#ifndef CDECL
-#define CDECL __cdecl
-#endif
-#ifndef FASTCALL
-#endif
-#else
-#define CDECL __attribute__((cdecl))
-#endif
-#else
-#define CDECL
-#endif
-
-#define CHECKED(call)                                               \
-    {                                                               \
-    int res = (call);                                               \
-        if(0 != res) {                                              \
-            fprintf(stderr,                                         \
-                    #call " failed in %s at line %d, result = %d "  \
-                    "(%s) \n",                                      \
-                    __FILE__, __LINE__, res, strerror(res));        \
-            abort();                                                \
-        }                                                           \
-    }
-
-#endif /* RUST_GLOBALS_H */
diff --git a/src/rt/rust_test_helpers.c b/src/rt/rust_test_helpers.c
index d2b69337e72..ee328e6cdb5 100644
--- a/src/rt/rust_test_helpers.c
+++ b/src/rt/rust_test_helpers.c
@@ -10,7 +10,8 @@
 
 // Helper functions used only in tests
 
-#include "rust_globals.h"
+#include <stdint.h>
+#include <assert.h>
 
 // These functions are used in the unit tests for C ABI calls.
 
diff --git a/src/rt/rust_upcall.c b/src/rt/rust_upcall.c
index daa46bab404..945ed2f8b55 100644
--- a/src/rt/rust_upcall.c
+++ b/src/rt/rust_upcall.c
@@ -19,7 +19,7 @@
   switch to the C stack.
  */
 
-#include "rust_globals.h"
+#include <stdint.h>
 
 //Unwinding ABI declarations.
 typedef int _Unwind_Reason_Code;
diff --git a/src/rt/rust_uv.c b/src/rt/rust_uv.c
index 9c9f7d14e5a..3156d2a1fd4 100644
--- a/src/rt/rust_uv.c
+++ b/src/rt/rust_uv.c
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#include <stdlib.h>
+#include <assert.h>
+
 #ifdef __WIN32__
 // For alloca
 #include <malloc.h>
@@ -20,8 +23,6 @@
 
 #include "uv.h"
 
-#include "rust_globals.h"
-
 void*
 rust_uv_loop_new() {
 // XXX libuv doesn't always ignore SIGPIPE even though we don't need it.