diff options
author | David Bolvansky <david.bolvansky@gmail.com> | 2019-09-24 14:01:14 +0000 |
---|---|---|
committer | David Bolvansky <david.bolvansky@gmail.com> | 2019-09-24 14:01:14 +0000 |
commit | c526fcaed193b72be76fb49a7e81be2271cda050 (patch) | |
tree | 279395285d6a9733183773aad5acda98df5db8e8 /lldb/packages/Python/lldbsuite/test/python_api/thread/main.cpp | |
parent | 82aaf17412134fcbf158b97ffec2f6344ee262ea (diff) | |
download | bcm5719-llvm-c526fcaed193b72be76fb49a7e81be2271cda050.tar.gz bcm5719-llvm-c526fcaed193b72be76fb49a7e81be2271cda050.zip |
[Compiler] Fix LLVM_NODISCARD for GCC
Summary:
This branch is currently dead since we don't use C++17.
#if __cplusplus > 201402L && LLVM_HAS_CPP_ATTRIBUTE(nodiscard)
#define LLVM_NODISCARD [[nodiscard]]
This branch is Clang-only.
#elif LLVM_HAS_CPP_ATTRIBUTE(clang::warn_unused_result)
#define LLVM_NODISCARD [[clang::warn_unused_result]]
While we could use gnu variant [[gnu::warn_unused_result]], it is not ideal because it works only on functions.
/home/xbolva00/LLVM/llvm/include/llvm/ADT/ArrayRef.h:41:24: warning: ‘warn_unused_result’ attribute only applies to function types [-Wattributes]
GCC (checked 5,6,7,8) seems to enable [[nodiscard]] even in C++14 mode and does not produce warnings that nodiscard is C++17 feature. but Clang does - but we do not reach it due the code above. So it affects only GCC and does what we want.
Reviewers: jfb, rsmith, echristo, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: MaskRay, dexonsmith
Differential Revision: https://reviews.llvm.org/D67663
llvm-svn: 372761
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/thread/main.cpp')
0 files changed, 0 insertions, 0 deletions