Add deprecated C10_UNUSED and C10_NODISCARD macros back (#138398)

For backwards compatibility. Disallow internal use.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/138398
Approved by: https://github.com/malfet
This commit is contained in:
Richard Barnes 2024-10-20 00:21:18 +00:00 committed by PyTorch MergeBot
parent d8279ad9d1
commit b1b7c714ed

View File

@ -118,6 +118,14 @@
#define C10_HAS_CPP_ATTRIBUTE(x) (0)
#endif
#ifndef FBCODE_CAFFE2
/// DEPRECATED: Warn if a type or return value is discarded.
#define C10_NODISCARD [[nodiscard]]
/// DEPRECATED: Suppress an unused variable.
#define C10_UNUSED [[maybe_unused]]
#endif
#if !defined(__has_attribute)
#define __has_attribute(x) 0
#endif