[PATCH] D34294: Rework libcxx strerror_r handling.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 16 15:26:36 PDT 2017

jyknight added a comment.

In https://reviews.llvm.org/D34294#782806, @krytarowski wrote:

> New one is harder to comprehend and less portable (usage of `__atribute__`).

I can't disagree more strongly.  This is fundamentally portable C++ code -- __attribute__((unused)) is simply warning suppression.
I used it directly, because I saw other .cpp files in libcxx already did so. If it needs to be conditioned, it could be.

> Or better:

> #elif __GLIBC__ || (__ANDROID_API__ - 0) >= 23
>  If I understand correctly, Android adopted GNU version.

No, we can't use that conditional, because android and glibc aren't the only ones to have adopted the GNU variant. As I mentioned, newlib uses it also.

We *may* be able to use a different conditional than what's there or what you suggested, but solving the problem once and for all by using the function type is certainly a better solution.


More information about the cfe-commits mailing list