Patch: Add -Wno-error=nonnull for test/cpp/api/

This commit is contained in:
desert-sailor 2024-01-11 11:26:05 +08:00
parent d6248b2bf0
commit f52b9f2daa
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From 367387bab836c73c23719f97d929572c8b4e0fad Mon Sep 17 00:00:00 2001
From: Nick Rossenbach <rossenbach@cs.rwth-aachen.de>
Date: Tue, 18 Apr 2023 23:31:51 +0200
Subject: [PATCH] Add -Wno-error=nonnull for test/cpp/api/
On some platforms the build might fail due to the nonnull error
being triggered by different compiler behavior.
Fix for #99278.
---
test/cpp/api/CMakeLists.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/test/cpp/api/CMakeLists.txt b/test/cpp/api/CMakeLists.txt
index 6b801a073182794..181139b01360c30 100644
--- a/test/cpp/api/CMakeLists.txt
+++ b/test/cpp/api/CMakeLists.txt
@@ -80,6 +80,11 @@ if(NOT MSVC)
target_compile_options_if_supported(test_api "-Wno-maybe-uninitialized")
# gcc gives nonsensical warnings about variadic.h
target_compile_options_if_supported(test_api "-Wno-unused-but-set-parameter")
+ # the nonnull check might trigger for some build configurations,
+ # probably happening due to different code optimization
+ # (see e.g. https://rkoucha.fr/tech_corner/nonnull_gcc_attribute.html)
+ # this happened for a riscv build: https://github.com/pytorch/pytorch/issues/99278
+ target_compile_options_if_supported(test_api "-Wno-error=nonnull")
endif()
if(INSTALL_TEST)

View File

@ -1,12 +1,13 @@
%global _empty_manifest_terminate_build 0
Name: pytorch
Version: 2.1.2
Release: 1
Release: 2
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
License: BSD-3-Clause
URL: https://pytorch.org/
Source0: https://github.com/pytorch/pytorch/releases/download/v%{version}/pytorch-v%{version}.tar.gz
Patch1: 0001-add-Wno-error-nonnull-for-test-cpp-api.patch
BuildRequires: g++
Requires: python3-future
Requires: python3-numpy
@ -85,6 +86,9 @@ mv %{buildroot}/doclist.lst .
%{_docdir}/*
%changelog
* Thu Jan 11 2024 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 2.1.2-2
- Patch: Add -Wno-error=nonnull for test/cpp/api/
* Thu Dec 28 2023 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 2.1.2-1
- upgrade to 2.1.2