Bug 1699194 added a construct to use the <linux/stat.h> when available. However, due to the way __has_include is defined in C++, the macro wrapper is invalid and breaks some build environments. We should backport this upstream commit:
Author: Emilio Cobos Álvarez <email@example.com>
Date: Tue Nov 12 19:18:32 2019 +0100
Don't use a custom wrapper macro around __has_include (bug 25189).
This causes issues when using clang with -frewrite-includes to e.g.,
submit the translation unit to a distributed compiler.
In my case, I was building Firefox using sccache.
See  for a reduced test-case since I initially thought this was a
clang bug, and  for more context.
Apparently doing this is invalid C++ per [cpp.cond], which mentions :
> The #ifdef and #ifndef directives, and the defined conditional
> inclusion operator, shall treat __has_include and __has_cpp_attribute
> as if they were the names of defined macros. The identifiers
> __has_include and __has_cpp_attribute shall not appear in any context
> not mentioned in this subclause.
Verified, __has_include is not used inside another macro, statx.h is includable with -frewrite-includes.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.