r279112 - Use __has_include rather than a configure-time macro to determine if
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 18 11:22:23 PDT 2016
Author: rsmith
Date: Thu Aug 18 13:22:22 2016
New Revision: 279112
URL: http://llvm.org/viewvc/llvm-project?rev=279112&view=rev
Log:
Use __has_include rather than a configure-time macro to determine if
<sys/resource.h> is available. This should fix out-of-tree builds, at the cost
of not providing the higher rlimits to stage 1 clang when built with an old
host compiler not implementing this feature yet (bootstrap builds should be
fine, though).
Modified:
cfe/trunk/tools/driver/cc1_main.cpp
Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=279112&r1=279111&r2=279112&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Thu Aug 18 13:22:22 2016
@@ -37,9 +37,14 @@
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdio>
-#if HAVE_SYS_RESOURCE_H
+
+#ifdef __has_include
+#if __has_include(<sys/resource.h>)
+#define HAVE_RLIMITS
#include <sys/resource.h>
#endif
+#endif
+
using namespace clang;
using namespace llvm::opt;
@@ -69,7 +74,7 @@ void initializePollyPasses(llvm::PassReg
}
#endif
-#if HAVE_SYS_RESOURCE_H && HAVE_GETRLIMIT && HAVE_SETRLIMIT
+#ifdef HAVE_RLIMITS
// The amount of stack we think is "sufficient". If less than this much is
// available, we may be unable to reach our template instantiation depth
// limit and other similar limits.
More information about the cfe-commits
mailing list