[cfe-commits] [PATCH] clang: fix compilation on Linux

Saleem Abdulrasool compnerd at compnerd.org
Tue Jan 22 11:10:54 PST 2013


Hi doug.gregor,

PATH_MAX is defined in linux/limits.h.  However, because this is a system header (provided by the kernel), we need to wrap the inclusion in a __linux__ check.

http://llvm-reviews.chandlerc.com/D320

Files:
  lib/Lex/HeaderSearch.cpp
  lib/Lex/ModuleMap.cpp

Index: lib/Lex/HeaderSearch.cpp
===================================================================
--- lib/Lex/HeaderSearch.cpp
+++ lib/Lex/HeaderSearch.cpp
@@ -23,6 +23,11 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include <cstdio>
+#if defined(LLVM_ON_UNIX)
+#if defined(__linux__)
+#include <linux/limits.h>
+#endif
+#endif
 using namespace clang;
 
 const IdentifierInfo *
Index: lib/Lex/ModuleMap.cpp
===================================================================
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -28,6 +28,11 @@
 #include "llvm/Support/PathV2.h"
 #include "llvm/Support/raw_ostream.h"
 #include <stdlib.h>
+#if defined(LLVM_ON_UNIX)
+#if defined(__linux__)
+#include <linux/limits.h>
+#endif
+#endif
 using namespace clang;
 
 Module::ExportDecl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D320.1.patch
Type: text/x-patch
Size: 813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130122/5c237fa2/attachment.bin>


More information about the cfe-commits mailing list