From 36b0b3d91179be364b45acd1527dde8a51553f51 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 3 Dec 2018 20:04:41 +0100 Subject: Improve help and doc for --max-stack-alloc. --- doc/using/Simulation.rst | 2 +- src/grt/grt-lib.adb | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/using/Simulation.rst b/doc/using/Simulation.rst index 6b6ea6a1a..ba31c8d5c 100644 --- a/doc/using/Simulation.rst +++ b/doc/using/Simulation.rst @@ -85,7 +85,7 @@ all options available, including the debugging one. .. option:: --max-stack-alloc<=N> Emit an error message in case of allocation on the stack of an - object larger than `N` KB. + object larger than `N` KB. Use 0 to disable these checks. .. option:: --sdf<=PATH=FILENAME> diff --git a/src/grt/grt-lib.adb b/src/grt/grt-lib.adb index 0bb9c2e36..26491a7ad 100644 --- a/src/grt/grt-lib.adb +++ b/src/grt/grt-lib.adb @@ -279,10 +279,15 @@ package body Grt.Lib is is Bt : Backtrace_Addrs; begin - if Size >= Max_Stack_Allocation then + if Max_Stack_Allocation = 0 then + return; + end if; + if Size > Max_Stack_Allocation then Save_Backtrace (Bt, 1); Error_S ("declaration of a too large object ("); Diag_C (Natural (Size / 1024)); + Diag_C (" > --max-stack-alloc="); + Diag_C (Natural (Max_Stack_Allocation / 1024)); Diag_C (" KB)"); Error_E_Call_Stack (Bt); end if; -- cgit v1.2.3