diff mbox

Hide the caret for -Wstack-usage

Message ID 2771802.rShREe2xKY@polaris
State New
Headers show

Commit Message

Eric Botcazou July 10, 2014, 10:51 a.m. UTC
Hi,

since displaying the caret was made the default, the -Wstack-usage warning has 
a strange-looking final part:

stack-usage-2.c: In function 'foo2':
stack-usage-2.c:16:1: warning: stack usage is 920 bytes [-Wstack-usage=]
 }
 ^

Tested on x86_64-suse-linux, OK for all active branches?


2014-07-10  Eric Botcazou  <ebotcazou@adacore.com>

	* toplev.c (output_stack_usage): Temporarily hide the caret.
diff mbox

Patch

Index: toplev.c
===================================================================
--- toplev.c	(revision 212420)
+++ toplev.c	(working copy)
@@ -1052,6 +1052,10 @@  output_stack_usage (void)
 
   if (warn_stack_usage >= 0)
     {
+      /* Avoid displaying the caret in a bogus position.  */
+      const bool saved_show_caret = global_dc->show_caret;
+      global_dc->show_caret = false;
+
       if (stack_usage_kind == DYNAMIC)
 	warning (OPT_Wstack_usage_, "stack usage might be unbounded");
       else if (stack_usage > warn_stack_usage)
@@ -1063,6 +1067,8 @@  output_stack_usage (void)
 	    warning (OPT_Wstack_usage_, "stack usage is %wd bytes",
 		     stack_usage);
 	}
+
+      global_dc->show_caret = saved_show_caret;
     }
 }