summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/Process.inc
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-05 20:45:04 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-05 20:45:04 +0000
commit91d3cfed785b46723ebbf8197f70aa0f854c05d7 (patch)
tree94f71306bb51cc3e1cadab7d71e0de2d51328b89 /llvm/lib/Support/Unix/Process.inc
parent27e95f7c7b22117e5f36d1ef874dac9b48555f18 (diff)
downloadbcm5719-llvm-91d3cfed785b46723ebbf8197f70aa0f854c05d7.tar.gz
bcm5719-llvm-91d3cfed785b46723ebbf8197f70aa0f854c05d7.zip
Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes."
This reverts commit r265454 since it broke the build. E.g.: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/ llvm-svn: 265459
Diffstat (limited to 'llvm/lib/Support/Unix/Process.inc')
-rw-r--r--llvm/lib/Support/Unix/Process.inc36
1 files changed, 9 insertions, 27 deletions
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index 350b145c28c..cad81f8074f 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -30,7 +30,9 @@
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
-#include <csignal>
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif
// DragonFlyBSD, OpenBSD, and Bitrig have deprecated <malloc.h> for
// <stdlib.h> instead. Unix.h includes this for us already.
#if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) && \
@@ -58,9 +60,7 @@
using namespace llvm;
using namespace sys;
-namespace {
-
-std::pair<TimeValue, TimeValue> getRUsageTimes() {
+static std::pair<TimeValue, TimeValue> getRUsageTimes() {
#if defined(HAVE_GETRUSAGE)
struct rusage RU;
::getrusage(RUSAGE_SELF, &RU);
@@ -79,8 +79,6 @@ std::pair<TimeValue, TimeValue> getRUsageTimes() {
#endif
}
-} // end anonymous namespace
-
// On Cygwin, getpagesize() returns 64k(AllocationGranularity) and
// offset in mmap(3) should be aligned to the AllocationGranularity.
unsigned Process::getPageSize() {
@@ -191,7 +189,6 @@ Process::GetArgumentVector(SmallVectorImpl<const char *> &ArgsOut,
}
namespace {
-
class FDCloser {
public:
FDCloser(int &FD) : FD(FD), KeepOpen(false) {}
@@ -208,8 +205,7 @@ private:
int &FD;
bool KeepOpen;
};
-
-} // end anonymous namespace
+}
std::error_code Process::FixupStandardFileDescriptors() {
int NullFD = -1;
@@ -304,9 +300,7 @@ bool Process::FileDescriptorIsDisplayed(int fd) {
#endif
}
-namespace {
-
-unsigned getColumns(int FileID) {
+static unsigned getColumns(int FileID) {
// If COLUMNS is defined in the environment, wrap to that many columns.
if (const char *ColumnsStr = std::getenv("COLUMNS")) {
int Columns = std::atoi(ColumnsStr);
@@ -326,8 +320,6 @@ unsigned getColumns(int FileID) {
return Columns;
}
-} // end anonymous namespace
-
unsigned Process::StandardOutColumns() {
if (!StandardOutIsDisplayed())
return 0;
@@ -352,13 +344,11 @@ extern "C" int del_curterm(struct term *termp);
extern "C" int tigetnum(char *capname);
#endif
-namespace {
-
#ifdef HAVE_TERMINFO
-ManagedStatic<sys::Mutex> TermColorMutex;
+static ManagedStatic<sys::Mutex> TermColorMutex;
#endif
-bool terminalHasColors(int fd) {
+static bool terminalHasColors(int fd) {
#ifdef HAVE_TERMINFO
// First, acquire a global lock because these C routines are thread hostile.
MutexGuard G(*TermColorMutex);
@@ -398,8 +388,6 @@ bool terminalHasColors(int fd) {
return false;
}
-} // end anonymous namespace
-
bool Process::FileDescriptorHasColors(int fd) {
// A file descriptor has colors if it is displayed and the terminal has
// colors.
@@ -440,10 +428,7 @@ const char *Process::ResetColor() {
}
#if !defined(HAVE_DECL_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM
-
-namespace {
-
-unsigned GetRandomNumberSeed() {
+static unsigned GetRandomNumberSeed() {
// Attempt to get the initial seed from /dev/urandom, if possible.
int urandomFD = open("/dev/urandom", O_RDONLY);
@@ -465,9 +450,6 @@ unsigned GetRandomNumberSeed() {
TimeValue Now = TimeValue::now();
return hash_combine(Now.seconds(), Now.nanoseconds(), ::getpid());
}
-
-} // end anonymous namespace
-
#endif
unsigned llvm::sys::Process::GetRandomNumber() {
OpenPOWER on IntegriCloud