pytorch/test/cpp
abhishek-fujitsu 63d6908da0 fix build error with gcc 12+ (#137092)
Fixes #127920

This commit addresses a build failure occurring with GCC 12 and above due to the -Werror=nonnull flag. The error manifests in the test_api target.

**Issue:**
When building with GCC 12+, the following error occurs:
```
error: argument 1 null where non-null expected [-Werror=nonnull]
  431 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

This change ensures that:
1. The flag is only added for GCC 12 or higher
2. The flag is only added if it's supported by the compiler
3. The flag is added specifically to the test_api target, not globally

By disabling this specific error, we allow the build to proceed while maintaining other compiler warnings.

**Test Plan:**
- Verified successful build with GCC 12 and above
- Ensured no regression in builds with earlier GCC versions and other compilers

Pull Request resolved: https://github.com/pytorch/pytorch/pull/137092
Approved by: https://github.com/malfet
2024-10-02 00:37:15 +00:00
..
aoti_abi_check [AOTI] Fix complex64 not defined (#132810) 2024-08-08 18:08:23 +00:00
aoti_inference [AOTI] Fix test_aoti_inference CPU build issue (#134675) 2024-08-28 17:42:19 +00:00
api fix build error with gcc 12+ (#137092) 2024-10-02 00:37:15 +00:00
c10d [TCPStore] Remove deprecated constructor (#136004) 2024-09-14 04:25:47 +00:00
common
dist_autograd
jit Revert "Fix clang-tidy warnings in Caffe2 code (#134935)" 2024-09-13 16:42:37 +00:00
lazy [9/N] Replace c10::optional with std::optional (#130674) 2024-07-15 00:48:43 +00:00
lite_interpreter_runtime Add None return type to init -- tests (#132352) 2024-08-01 15:44:51 +00:00
monitor
profiler [9/N] Replace c10::optional with std::optional (#130674) 2024-07-15 00:48:43 +00:00
rpc [structural binding][10/N] Replace std::tie with structural binding (#130784) 2024-07-16 10:28:14 +00:00
tensorexpr [11/N] Fix clang-tidy warnings in jit (#132131) 2024-07-31 03:45:52 +00:00
__init__.py