[PATCH] D60644: [compiler-rt][builtins][sanitizers] Guard test cases with macros with GLIBC* macros

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 17:59:17 PDT 2019


hubert.reinterpretcast added inline comments.


================
Comment at: compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cc:77
+  // that maybe related to _GLIBCXX_USE_CXX11_ABI and the string assigned.
+#if _GLIBCXX_USE_CXX11_ABI
   test<group>(&getgrnam, any_group.c_str());
----------------
amyk wrote:
> hubert.reinterpretcast wrote:
> > Both here and below, the test is skipped if `_GLIBCXX_USE_CXX11_ABI` is not defined at all (for example, if the C++ library is not libstdc++).
> Yes, you are right. Thank you for pointing that out. Does something like this make sense, and is more suitable?
> ```
> #if (defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI)) || \             
>     !defined(_GLIBCXX_USE_CXX11_ABI)                                               
>   test<group>(&getgrnam, any_group.c_str());                                       
> #endif
> ```
Yes. It seems verbose, but I guess the alternative would be a bit cryptic:
```
#if !defined(_GLIBCXX_USE_CXX11_ABI) || _GLIBCXX_USE_CXX11_ABI
```



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

https://reviews.llvm.org/D60644





More information about the llvm-commits mailing list