Fix build with glibc 2.34, SIGSTKSZ not a constant

Signed-off-by: Stewart Smith <trawets@amazon.com>
This commit is contained in:
Stewart Smith 2021-09-20 21:32:53 +00:00
parent 6f85fa2223
commit bc59f9d7ae
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,29 @@
From 8869ee3554f19ce63892891a697378d8b745414b Mon Sep 17 00:00:00 2001
From: Lauri Nurmi <lanurmi@iki.fi>
Date: Wed, 4 Aug 2021 08:45:50 +0300
Subject: [PATCH] Fix compilation with recent glibc where SIGSTKSZ is not
constant. (#3378)
---
cli/cppcheckexecutor.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp
index 5066ff3d3..f3e6b11fe 100644
--- a/cli/cppcheckexecutor.cpp
+++ b/cli/cppcheckexecutor.cpp
@@ -335,7 +335,11 @@ static void print_stacktrace(FILE* output, bool demangling, int maxdepth, bool l
#endif
}
+#ifdef __USE_DYNAMIC_STACK_SIZE
+static const size_t MYSTACKSIZE = 16*1024+32768; // wild guess about a reasonable buffer
+#else
static const size_t MYSTACKSIZE = 16*1024+SIGSTKSZ; // wild guess about a reasonable buffer
+#endif
static char mytstack[MYSTACKSIZE]= {0}; // alternative stack for signal handler
static bool bStackBelowHeap=false; // lame attempt to locate heap vs. stack address space. See CppCheckExecutor::check_wrapper()
--
2.33.0

View File

@ -18,6 +18,7 @@ Patch2: cppcheck-2.5-disable-test-testexprengine-array7.patch
# Fix Failed to load translation for English (#1983599)
# https://github.com/danmar/cppcheck/commit/8d5249e3b6cd892b283eba0369b33ec302c8fbe0
Patch3: cppcheck-2.5-fix_failed_to_load_translation_for_English.patch
Patch4: cppcheck-2.5-SIGSTKSZ.patch
BuildRequires: gcc-c++
BuildRequires: pcre-devel
@ -66,6 +67,7 @@ from xml files first generated using cppcheck.
%patch1 -p1 -b .python3
%patch2 -p1 -b .array7
%patch3 -p1 -b .en
%patch4 -p1 -b .SIGSTKSZ
# Make sure bundled tinyxml2 is not used
rm -r externals/tinyxml2
# Generate the Qt online-help file