[llvm] r250923 - Include llvm/Config/config.h in FileSystem.h as it depends upon HAVE_SYS_STAT_H which is defined (or not) in config.h.

Yaron Keren via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 18:56:08 PDT 2015


So, when LLVM is installed on Unix, LLVM_ON_UNIX is defined from
llvm-config.h but HAVE_SYS_STAT_H is never defined, making FileSystem.h use
the Unix dev_t, ino_t *without* including <sys/stat.h>.
Since this had been working for a long time it means either <sys/stat.h> is
included indirectly or that dev_t, ino_t are defined some other way
(sys/types.h?). In any case, this include is incosistent with its usage.


2015-10-22 0:38 GMT+03:00 Reid Kleckner <rnk at google.com>:

> On Wed, Oct 21, 2015 at 11:44 AM, Yaron Keren <yaron.keren at gmail.com>
> wrote:
>
>> Reverted in r250924, thanks!
>>
>> Since llvm-config.h does not provide the HAVE_* defines, does it makes
>> sense for FileSystem.h to include the code
>>
>> #ifdef HAVE_SYS_STAT_H
>> #include <sys/stat.h>
>> #endif
>>
>> shouldn't this code go elsewhere? possibly in the code that needs it?
>>
>
> Ideally, yes, it shouldn't be here, but we need it because we use dev_t,
> ino_t, and other types from stat.h in file_status.
>
> Personally I think we should just make this #ifdef LLVM_ON_UNIX, because
> that matches the uses down below. If we find a system without sys/stat.h,
> we can deal with it then.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151022/e4edefc0/attachment.html>


More information about the llvm-commits mailing list