[PATCH] D66487: Fix -Wimplicit-fallthrough warnings in regcomp.c

Nathan Huckleberry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 15:06:16 PDT 2019


Nathan-Huckleberry added a comment.

> In D66487#1639946 <https://reviews.llvm.org/D66487#1639946>, @Nathan-Huckleberry wrote:
> 
>> Maybe replace __has_cpp_attribute with something like this?
>>
>>   #ifndef has_cpp_attribute
>>   #ifdef __cplusplus
>>   # define has_cpp_attribute(x) __has_cpp_attribute(x)
>>   #else
>>   # define has_cpp_attribute(x) 0
>>   #endif
>>   #endif
>>
> 
> 
> That will run into the same issue -- you'll use `has_cpp_attribute(clang::something)` and in non-C++ mode, the `::` will cause an error. You need to hide the `::` behind the `__cplusplus` check.

Shouldn't the preprocessor take care of that? `has_cpp_attribute(clang::something)` just gets replaced by 0? I tested locally and it appears to work.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66487/new/

https://reviews.llvm.org/D66487





More information about the llvm-commits mailing list