Add gdbsupport ignore Wenum-constexpr-conversion in enum-flags.h to fix clang build error

A backported patch from gdb (commit ID:8cbde735 "gdbsupport: ignore -Wenum-constexpr-conversion in enum-flags.")
This commit is contained in:
yanyir 2024-07-27 05:39:51 +08:00 committed by yanying
parent f8188d0c30
commit 094d97d932
2 changed files with 91 additions and 1 deletions

View File

@ -0,0 +1,85 @@
From a860b55b77720be43d4c30efea94d2cad55941cb Mon Sep 17 00:00:00 2001
From: yanying <201250106@smail.nju.edu.cn>
Date: Sat, 7 Sep 2024 00:10:53 +0800
Subject: [PATCH] hh
---
gdb-10.2.patch | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
index d81030d..ea2d705 100644
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -3187,3 +3187,68 @@ exit 0
result = stringtab + symbol_entry->_n._n_n._n_offset;
}
else
+--- gdb-10.2/gdbsupport/enum-flags.h.orig
++++ gdb-10.2/gdbsupport/enum-flags.h
+@@ -81,9 +81,12 @@
+ template<typename T>
+ struct enum_underlying_type
+ {
++ DIAGNOSTIC_PUSH
++ DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION
+ typedef typename
+ integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
+ type;
++ DIAGNOSTIC_POP
+ };
+
+ template <typename E>
+
+--- gdb-10.2/include/diagnostics.h.orig
++++ gdb-10.2/include/diagnostics.h
+@@ -61,6 +61,24 @@
+ # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
+ DIAGNOSTIC_IGNORE ("-Wformat-nonliteral")
+
++# if __has_warning ("-Wuser-defined-warnings")
++# define DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS \
++ DIAGNOSTIC_IGNORE ("-Wuser-defined-warnings")
++# endif
++
++# if __has_warning ("-Wunused-but-set-variable")
++# define DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE \
++ DIAGNOSTIC_IGNORE ("-Wunused-but-set-variable")
++# endif
++
++# define DIAGNOSTIC_ERROR_SWITCH \
++ DIAGNOSTIC_ERROR ("-Wswitch")
++
++# if __has_warning ("-Wenum-constexpr-conversion")
++# define DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION \
++ DIAGNOSTIC_IGNORE ("-Wenum-constexpr-conversion")
++# endif
++
+ #elif defined (__GNUC__) /* GCC */
+
+ # if __GNUC__ >= 7
+@@ -100,4 +118,20 @@
+ # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
+ #endif
+
++#ifndef DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS
++# define DIAGNOSTIC_IGNORE_USER_DEFINED_WARNINGS
++#endif
++
++#ifndef DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE
++# define DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE
++#endif
++
++#ifndef DIAGNOSTIC_ERROR_SWITCH
++# define DIAGNOSTIC_ERROR_SWITCH
++#endif
++
++#ifndef DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION
++# define DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION
++#endif
++
+ #endif /* DIAGNOSTICS_H */
+
--
2.41.0.windows.1

View File

@ -1,6 +1,6 @@
Name: crash Name: crash
Version: 8.0.4 Version: 8.0.4
Release: 4 Release: 5
Summary: Linux kernel crash utility. Summary: Linux kernel crash utility.
License: GPLv3 License: GPLv3
URL: https://crash-utility.github.io URL: https://crash-utility.github.io
@ -12,6 +12,7 @@ Patch1: 0001-add-SDEI-stack-resolution.patch
Patch2: 0002-crash-8.0.2-sw.patch Patch2: 0002-crash-8.0.2-sw.patch
Patch3: 0003-crash-8.0.4-add-support-for-loongarch64.patch Patch3: 0003-crash-8.0.4-add-support-for-loongarch64.patch
Patch4: 0004-support-vmp_area_list-replaced-with-VMALLOC_START.patch Patch4: 0004-support-vmp_area_list-replaced-with-VMALLOC_START.patch
Patch5: 0005-gdb-ignore-Wenum-constexpr-conversion-in-enum-flags.patch
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel
BuildRequires: gcc gcc-c++ bison m4 BuildRequires: gcc gcc-c++ bison m4
@ -52,6 +53,7 @@ created by manufacturer-specific firmware.
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%endif %endif
%patch5 -p1
%build %build
cp %{SOURCE1} . cp %{SOURCE1} .
@ -86,6 +88,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
%{_mandir}/man8/crash.8* %{_mandir}/man8/crash.8*
%changelog %changelog
* Fri Sep 06 2024 yanying <201250106@smail.nju.edu.cn> - 8.0.4-5
- Add gdbsupport ignore Wenum-constexpr-conversion in enum-flags.h to fix clang build error
* Tue Jul 30 2024 zhangzikang <zhangzikang@kylinos.cn> - 8.0.4-4 * Tue Jul 30 2024 zhangzikang <zhangzikang@kylinos.cn> - 8.0.4-4
- Fix crash parsing vmcore file failed for loongarch64 - Fix crash parsing vmcore file failed for loongarch64