Skip to content

Commit c2ccfd5

Browse files
IOBYTEdanmar
authored andcommitted
Increase Windows stack size to 8M (cppcheck-opensource#1998)
* Increase Windows stack size to 8M * try to add stack size cmake
1 parent af051a3 commit c2ccfd5

6 files changed

Lines changed: 48 additions & 6 deletions

File tree

cli/cli.vcxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@
177177
<SuppressStartupBanner>true</SuppressStartupBanner>
178178
<ProgramDatabaseFile>$(TargetDir)cli.pdb</ProgramDatabaseFile>
179179
<LargeAddressAware>true</LargeAddressAware>
180+
<StackReserveSize>8000000</StackReserveSize>
181+
<StackCommitSize>8000000</StackCommitSize>
180182
</Link>
181183
</ItemDefinitionGroup>
182184
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-PCRE|Win32'">
@@ -202,6 +204,8 @@
202204
<SubSystem>Console</SubSystem>
203205
<SuppressStartupBanner>true</SuppressStartupBanner>
204206
<LargeAddressAware>true</LargeAddressAware>
207+
<StackReserveSize>8000000</StackReserveSize>
208+
<StackCommitSize>8000000</StackCommitSize>
205209
</Link>
206210
</ItemDefinitionGroup>
207211
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -225,6 +229,8 @@
225229
<GenerateDebugInformation>true</GenerateDebugInformation>
226230
<SubSystem>Console</SubSystem>
227231
<SuppressStartupBanner>true</SuppressStartupBanner>
232+
<StackReserveSize>8000000</StackReserveSize>
233+
<StackCommitSize>8000000</StackCommitSize>
228234
</Link>
229235
</ItemDefinitionGroup>
230236
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-PCRE|x64'">
@@ -248,6 +254,8 @@
248254
<GenerateDebugInformation>true</GenerateDebugInformation>
249255
<SubSystem>Console</SubSystem>
250256
<SuppressStartupBanner>true</SuppressStartupBanner>
257+
<StackReserveSize>8000000</StackReserveSize>
258+
<StackCommitSize>8000000</StackCommitSize>
251259
</Link>
252260
</ItemDefinitionGroup>
253261
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -282,6 +290,8 @@
282290
<EnableCOMDATFolding>true</EnableCOMDATFolding>
283291
<SetChecksum>true</SetChecksum>
284292
<LargeAddressAware>true</LargeAddressAware>
293+
<StackReserveSize>8000000</StackReserveSize>
294+
<StackCommitSize>8000000</StackCommitSize>
285295
</Link>
286296
</ItemDefinitionGroup>
287297
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-PCRE|Win32'">
@@ -316,6 +326,8 @@
316326
<EnableCOMDATFolding>true</EnableCOMDATFolding>
317327
<SetChecksum>true</SetChecksum>
318328
<LargeAddressAware>true</LargeAddressAware>
329+
<StackReserveSize>8000000</StackReserveSize>
330+
<StackCommitSize>8000000</StackCommitSize>
319331
</Link>
320332
</ItemDefinitionGroup>
321333
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -350,6 +362,8 @@
350362
<OptimizeReferences>true</OptimizeReferences>
351363
<EnableCOMDATFolding>true</EnableCOMDATFolding>
352364
<SetChecksum>true</SetChecksum>
365+
<StackReserveSize>8000000</StackReserveSize>
366+
<StackCommitSize>8000000</StackCommitSize>
353367
</Link>
354368
</ItemDefinitionGroup>
355369
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-PCRE|x64'">
@@ -384,6 +398,8 @@
384398
<OptimizeReferences>true</OptimizeReferences>
385399
<EnableCOMDATFolding>true</EnableCOMDATFolding>
386400
<SetChecksum>true</SetChecksum>
401+
<StackReserveSize>8000000</StackReserveSize>
402+
<StackCommitSize>8000000</StackCommitSize>
387403
</Link>
388404
</ItemDefinitionGroup>
389405
<ItemGroup>

cmake/compileroptions.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND
121121
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -U_GLIBCXX_DEBUG")
122122
endif()
123123

124+
if (MSVC)
125+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:8000000")
126+
endif()
127+
124128
include(cmake/dynamic_analyzer_options.cmake REQUIRED)
125129

126130
# Add user supplied extra options (optimization, etc...)

lib/checkleakautovar.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,8 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken,
237237
std::set<unsigned int> notzero,
238238
unsigned int recursiveCount)
239239
{
240-
// The C++ standard suggests a minimum of 256 nested control statements
241-
// but MSVC has a limit of 100.
242-
if (++recursiveCount > 100)
243-
throw InternalError(startToken, "Internal limit: CheckLeakAutoVar::checkScope() Maximum recursive count of 100 reached.", InternalError::LIMIT);
240+
if (++recursiveCount > 1000) // maximum number of "else if ()"
241+
throw InternalError(startToken, "Internal limit: CheckLeakAutoVar::checkScope() Maximum recursive count of 1000 reached.", InternalError::LIMIT);
244242

245243
std::map<unsigned int, VarInfo::AllocInfo> &alloctype = varInfo->alloctype;
246244
std::map<unsigned int, std::string> &possibleUsage = varInfo->possibleUsage;

lib/cppcheck.vcxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@
295295
<SuppressStartupBanner>true</SuppressStartupBanner>
296296
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
297297
<LargeAddressAware>true</LargeAddressAware>
298+
<StackReserveSize>8000000</StackReserveSize>
299+
<StackCommitSize>8000000</StackCommitSize>
298300
</Link>
299301
<PostBuildEvent>
300302
<Command>xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y
@@ -323,6 +325,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y</Command>
323325
<GenerateDebugInformation>true</GenerateDebugInformation>
324326
<SuppressStartupBanner>true</SuppressStartupBanner>
325327
<LargeAddressAware>true</LargeAddressAware>
328+
<StackReserveSize>8000000</StackReserveSize>
329+
<StackCommitSize>8000000</StackCommitSize>
326330
</Link>
327331
<PostBuildEvent>
328332
<Command>xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y
@@ -349,6 +353,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y</Command>
349353
<AdditionalLibraryDirectories>../externals;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
350354
<GenerateDebugInformation>true</GenerateDebugInformation>
351355
<SuppressStartupBanner>true</SuppressStartupBanner>
356+
<StackReserveSize>8000000</StackReserveSize>
357+
<StackCommitSize>8000000</StackCommitSize>
352358
</Link>
353359
<PostBuildEvent>
354360
<Command>xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y
@@ -376,6 +382,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y</Command>
376382
<AdditionalLibraryDirectories>../externals;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
377383
<GenerateDebugInformation>true</GenerateDebugInformation>
378384
<SuppressStartupBanner>true</SuppressStartupBanner>
385+
<StackReserveSize>8000000</StackReserveSize>
386+
<StackCommitSize>8000000</StackCommitSize>
379387
</Link>
380388
<PostBuildEvent>
381389
<Command>xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y
@@ -414,6 +422,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y</Command>
414422
<EnableCOMDATFolding>true</EnableCOMDATFolding>
415423
<SetChecksum>true</SetChecksum>
416424
<LargeAddressAware>true</LargeAddressAware>
425+
<StackReserveSize>8000000</StackReserveSize>
426+
<StackCommitSize>8000000</StackCommitSize>
417427
</Link>
418428
<PostBuildEvent>
419429
<Command>xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y
@@ -453,6 +463,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y</Command>
453463
<EnableCOMDATFolding>true</EnableCOMDATFolding>
454464
<SetChecksum>true</SetChecksum>
455465
<LargeAddressAware>true</LargeAddressAware>
466+
<StackReserveSize>8000000</StackReserveSize>
467+
<StackCommitSize>8000000</StackCommitSize>
456468
</Link>
457469
<PostBuildEvent>
458470
<Command>xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y
@@ -490,6 +502,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y</Command>
490502
<OptimizeReferences>true</OptimizeReferences>
491503
<EnableCOMDATFolding>true</EnableCOMDATFolding>
492504
<SetChecksum>true</SetChecksum>
505+
<StackReserveSize>8000000</StackReserveSize>
506+
<StackCommitSize>8000000</StackCommitSize>
493507
</Link>
494508
<PostBuildEvent>
495509
<Command>xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y
@@ -528,6 +542,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y</Command>
528542
<OptimizeReferences>true</OptimizeReferences>
529543
<EnableCOMDATFolding>true</EnableCOMDATFolding>
530544
<SetChecksum>true</SetChecksum>
545+
<StackReserveSize>8000000</StackReserveSize>
546+
<StackCommitSize>8000000</StackCommitSize>
531547
</Link>
532548
<PostBuildEvent>
533549
<Command>xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y

test/testleakautovar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,15 +1823,15 @@ class TestLeakAutoVar : public TestFixture {
18231823
"#define THOU HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN\n"
18241824
"void foo() {\n"
18251825
" if (0) { }\n"
1826-
" THOU\n"
1826+
" THOU THOU\n"
18271827
"}"), InternalError);
18281828
ASSERT_NO_THROW(checkP("#define ONE if (0) { }\n"
18291829
"#define TEN ONE ONE ONE ONE ONE ONE ONE ONE ONE ONE\n"
18301830
"#define HUN TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN\n"
18311831
"#define THOU HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN\n"
18321832
"void foo() {\n"
18331833
" if (0) { }\n"
1834-
" THOU\n"
1834+
" THOU THOU\n"
18351835
"}"));
18361836
}
18371837

test/testrunner.vcxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@
195195
<SubSystem>Console</SubSystem>
196196
<SuppressStartupBanner>true</SuppressStartupBanner>
197197
<LargeAddressAware>true</LargeAddressAware>
198+
<StackReserveSize>8000000</StackReserveSize>
199+
<StackCommitSize>8000000</StackCommitSize>
198200
</Link>
199201
</ItemDefinitionGroup>
200202
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -221,6 +223,8 @@
221223
<GenerateDebugInformation>true</GenerateDebugInformation>
222224
<SubSystem>Console</SubSystem>
223225
<SuppressStartupBanner>true</SuppressStartupBanner>
226+
<StackReserveSize>8000000</StackReserveSize>
227+
<StackCommitSize>8000000</StackCommitSize>
224228
</Link>
225229
</ItemDefinitionGroup>
226230
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -259,6 +263,8 @@
259263
<EnableCOMDATFolding>true</EnableCOMDATFolding>
260264
<SetChecksum>true</SetChecksum>
261265
<LargeAddressAware>true</LargeAddressAware>
266+
<StackReserveSize>8000000</StackReserveSize>
267+
<StackCommitSize>8000000</StackCommitSize>
262268
</Link>
263269
</ItemDefinitionGroup>
264270
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -298,6 +304,8 @@
298304
<OptimizeReferences>true</OptimizeReferences>
299305
<EnableCOMDATFolding>true</EnableCOMDATFolding>
300306
<SetChecksum>true</SetChecksum>
307+
<StackReserveSize>8000000</StackReserveSize>
308+
<StackCommitSize>8000000</StackCommitSize>
301309
</Link>
302310
</ItemDefinitionGroup>
303311
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

0 commit comments

Comments
 (0)