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

Saleem Abdulrasool compnerd at compnerd.org
Tue Jan 22 12:55:51 PST 2013


On Tue, Jan 22, 2013 at 12:21 PM, Joerg Sonnenberger
<joerg at britannica.bec.de> wrote:
> On Tue, Jan 22, 2013 at 11:10:54AM -0800, Saleem Abdulrasool wrote:
>> PATH_MAX is defined in linux/limits.h.
>
> Why not just use limits.h? Checking for LLVM_ON_UNIX first and __linux__
> next is redundant.

I would prefer to use limits.h (and was the first thing that I tried).
 However, with glibc at least, linux/limits.h is not included (and
that makes sense, limits.h is platform agnostic).  The alternative is
perhaps sys/param.h, but, Im not certain about its availability on all
unicies.

I agree that checking LLVM_ON_UNIX and then checking __linux__ is
redundant.  But, that was on purpose.  The usage of PATH_MAX is is
within a LLVM_ON_UNIX block.  However, Linux is not the only Unix'ish
platform (BSDs are UNIXish as well) and so you need to actually check
explicitly for Linux in this inclusion.  The hope is that if the block
below is removed or changed, the person doing the removal would scan
for the preprocessor guards and remove this along with it.

Im certainly open to suggestions to performing this in a less convoluted manner.

> Joerg

--
Saleem Abdulrasool
compnerd (at) compnerd (dot) org



More information about the cfe-commits mailing list