[PATCH] D66487: Fix -Wimplicit-fallthrough warnings in regcomp.c
    Aaron Ballman via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Aug 21 13:55:18 PDT 2019
    
    
  
aaron.ballman added a comment.
In D66487#1640019 <https://reviews.llvm.org/D66487#1640019>, @lebedev.ri wrote:
> Is this only about `lib/Support/regcomp.c`? Can that source simply be switched to C++?
We have other C files that may wish to use attributes, so I don't see that as a long-term solution.
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.
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