From 109ea4599ce89a2b30933ec15935a9fc0090458a Mon Sep 17 00:00:00 2001 From: yanyir Date: Sat, 27 Jul 2024 05:39:51 +0800 Subject: [PATCH] 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.") (cherry picked from commit 094d97d932c365af11760a3737ace387f576e5bd) --- ...m-constexpr-conversion-in-enum-flags.patch | 85 +++++++++++++++++++ crash.spec | 7 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 0005-gdb-ignore-Wenum-constexpr-conversion-in-enum-flags.patch diff --git a/0005-gdb-ignore-Wenum-constexpr-conversion-in-enum-flags.patch b/0005-gdb-ignore-Wenum-constexpr-conversion-in-enum-flags.patch new file mode 100644 index 0000000..3f647e2 --- /dev/null +++ b/0005-gdb-ignore-Wenum-constexpr-conversion-in-enum-flags.patch @@ -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 ++ struct enum_underlying_type ++ { +++ DIAGNOSTIC_PUSH +++ DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION ++ typedef typename ++ integer_for_size(T (-1) < T (0))>::type ++ type; +++ DIAGNOSTIC_POP ++ }; ++ ++ template ++ ++--- 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 + diff --git a/crash.spec b/crash.spec index 5782204..85ea4cb 100644 --- a/crash.spec +++ b/crash.spec @@ -1,6 +1,6 @@ Name: crash Version: 8.0.4 -Release: 4 +Release: 5 Summary: Linux kernel crash utility. License: GPLv3 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 Patch3: 0003-crash-8.0.4-add-support-for-loongarch64.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: gcc gcc-c++ bison m4 @@ -52,6 +53,7 @@ created by manufacturer-specific firmware. %patch3 -p1 %patch4 -p1 %endif +%patch5 -p1 %build cp %{SOURCE1} . @@ -86,6 +88,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h %{_mandir}/man8/crash.8* %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 - 8.0.4-4 - Fix crash parsing vmcore file failed for loongarch64 -- Gitee