pytorch/c10/core/impl
cyy e9e1aacef8 Enable -Wunused on torch targets (#150077)
For GCC, ``-Wunused`` contains:
```
-Wunused-function
Warn whenever a static function is declared but not defined or a non\-inline static function is unused.

-Wunused-label
Warn whenever a label is declared but not used.
To suppress this warning use the unused attribute.

-Wunused-parameter
Warn whenever a function parameter is unused aside from its declaration.
To suppress this warning use the unused attribute.

-Wunused-variable
Warn whenever a local variable or non-constant static variable is unused aside from its declaration
To suppress this warning use the unused attribute.
```
For Clang, some of the diagnostics controlled by ``-Wunused`` are enabled by default:
```
Controls [-Wunused-argument](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-argument),
[-Wunused-but-set-variable](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-but-set-variable),
[-Wunused-function](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-function),
[-Wunused-label](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-label), [-Wunused-lambda-capture](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-lambda-capture),
[-Wunused-local-typedef](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-local-typedef),
[-Wunused-private-field](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-private-field),
[-Wunused-property-ivar](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-property-ivar),
[-Wunused-value](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-value), [-Wunused-variable](https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-variable).
```
These checks are all usefull. This PR aims to enable ``-Wunused`` without breaking code.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/150077
Approved by: https://github.com/zou3519, https://github.com/wdvr
2025-05-02 07:14:19 +00:00
..
alloc_cpu.cpp Enable -Wunused on torch targets (#150077) 2025-05-02 07:14:19 +00:00
alloc_cpu.h [sigmoid] memory planner C10 deps (#151275) 2025-04-24 01:46:32 +00:00
COW.cpp Disallow {FakeTensor,FunctionalTensor}.data_ptr (#122514) 2024-03-26 23:55:42 +00:00
COW.h [2/N] Fix Wextra-semi warnings (#139142) 2024-10-29 08:14:37 +00:00
COWDeleter.cpp Add function to materialize COW storages (#117053) 2024-01-10 15:34:16 +00:00
COWDeleter.h Add function to materialize COW storages (#117053) 2024-01-10 15:34:16 +00:00
DeviceGuardImplInterface.cpp [1/N] Remove usage of C array (#139567) 2024-11-04 04:52:46 +00:00
DeviceGuardImplInterface.h Fix torch.accelerator api abort when passing invaild device (#143550) 2024-12-23 03:44:22 +00:00
FakeGuardImpl.h Enable -Wunused on torch targets (#150077) 2025-05-02 07:14:19 +00:00
GPUTrace.cpp [3/N] Remove unnecessary once flag usage (#145672) 2025-01-28 04:28:18 +00:00
GPUTrace.h Enable nested namespace check in clang-tidy (#118506) 2024-01-31 00:32:35 +00:00
HermeticPyObjectTLS.cpp Enable misc-use-internal-linkage check and apply fixes (#148948) 2025-03-12 14:22:56 +00:00
HermeticPyObjectTLS.h [8/N] Fixes clang-tidy warnings in c10/{core,util}/*.h (#116082) 2023-12-20 12:22:21 +00:00
InlineDeviceGuard.h [1/N] Enable cppcoreguidelines-special-member-functions (#137405) 2024-10-23 00:16:53 +00:00
InlineEvent.h [Easy] Add more check for elapsedTime of torch.xxx.Event and torch.Event (#151404) 2025-04-25 20:15:04 +00:00
InlineStreamGuard.h [1/N] Enable cppcoreguidelines-special-member-functions (#137405) 2024-10-23 00:16:53 +00:00
LocalDispatchKeySet.cpp Enable nested namespace check in clang-tidy (#118506) 2024-01-31 00:32:35 +00:00
LocalDispatchKeySet.h [1/N] Enable cppcoreguidelines-special-member-functions (#137405) 2024-10-23 00:16:53 +00:00
PyInterpreter.cpp Enable -Wunused on torch targets (#150077) 2025-05-02 07:14:19 +00:00
PyInterpreter.h Fix Wextra-semi warnings (#139000) 2024-10-28 21:48:51 +00:00
PyObjectSlot.cpp Enable nested namespace check in clang-tidy (#118506) 2024-01-31 00:32:35 +00:00
PyObjectSlot.h Remove unneeded std::make_optional (#141567) 2024-11-28 00:05:21 +00:00
PythonDispatcherTLS.cpp Enable misc-use-internal-linkage check and apply fixes (#148948) 2025-03-12 14:22:56 +00:00
PythonDispatcherTLS.h Enable cppcoreguidelines-special-member-functions (#139132) 2024-11-06 13:42:20 +00:00
README-cow.md Add function to materialize COW storages (#117053) 2024-01-10 15:34:16 +00:00
README.md fix the readme link (#56269) 2021-04-16 13:35:53 -07:00
SizesAndStrides.cpp Enable nested namespace check in clang-tidy (#118506) 2024-01-31 00:32:35 +00:00
SizesAndStrides.h [c10] helpers for runtime c10::alias re-use (#151361) 2025-04-17 20:27:17 +00:00
TorchDispatchModeTLS.cpp Enable misc-use-internal-linkage check and apply fixes (#148948) 2025-03-12 14:22:56 +00:00
TorchDispatchModeTLS.h [codemod] c10:optional -> std::optional (#126135) 2024-05-14 19:35:51 +00:00
VirtualGuardImpl.h Fix torch.accelerator api abort when passing invaild device (#143550) 2024-12-23 03:44:22 +00:00

c10/core/impl provides headers for functionality that is only needed in very specific use-cases (e.g., you are defining a new device type), which are generally only needed by C10 or PyTorch code. If you are an ordinary end-user, you should not use headers in this folder. We permanently give NO backwards-compatibility guarantees for implementations in this folder.

Compare with c10/util, which provides functionality that is not directly related to being a deep learning library (e.g., C++20 polyfills), but may still be generally useful and visible to users.

(We don't call this c10/detail, because the detail namespace convention is for header private details. However, c10::impl may be utilized from external headers; it simply indicates that the functionality is not for end users.)