This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Hide the caret for -Wstack-usage


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.


-- 
Eric Botcazou
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;
     }
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]