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]

[google][RFA] add extra text to stack frame warnings (issue4479046)


Diego,

I know this is a truly horrible and broken way to do this, but alternatives
(e.g., NLS) don't really work for us.

bootstrapped without new configuration (x86-64 ubuntu lucid, didn't bother
to run tests), bootstrapped with option (x86-64 ubuntu lucid, with full
tests, no regressions).  Manually tested that the resulting warning
looks right, too.


OK for google/main?


chris
---
[gcc/ChangeLog.google-main]
2011-05-05  Chris Demetriou  <cgd@google.com>

        * doc/install.texi (--with-warn-frame-larger-than-extra-text): New.
	* configure.ac (--with-warn-frame-larger-than-extra-text): New.
        (WARN_FRAME_LARGER_THAN_EXTRA_TEXT): Define.
        * final.c (final_start_function): Use
        WARN_FRAME_LARGER_THAN_EXTRA_TEXT.
        * configure: Regenerate.
        * config.in: Regenerate.

Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 173353)
+++ gcc/doc/install.texi	(working copy)
@@ -1707,6 +1707,10 @@
 See @option{-canonical-prefixes} or @option{-no-canonical-prefixes} for
 more details, including how to override this configuration option when
 compiling.
+
+@item --with-warn-frame-larger-than-extra-text=@var{text}
+Append @samp{@var{text}} to frame size warnings generated by
+the @option{-Wframe-larger-than} warning flag.
 @end table
 
 @subheading Cross-Compiler-Specific Options
Index: gcc/final.c
===================================================================
--- gcc/final.c	(revision 173353)
+++ gcc/final.c	(working copy)
@@ -1576,9 +1576,13 @@
   if (warn_frame_larger_than
     && get_frame_size () > frame_larger_than_size)
   {
-      /* Issue a warning */
+      /* Issue a warning.  (WARN_FRAME_LARGER_THAN_EXTRA_TEXT is
+         provided by configuration.  The way extra text is added
+         here may prevent localization from working properly.
+         It's totally broken.)  */
       warning (OPT_Wframe_larger_than_,
-               "the frame size of %wd bytes is larger than %wd bytes",
+               "the frame size of %wd bytes is larger than %wd bytes"
+               WARN_FRAME_LARGER_THAN_EXTRA_TEXT,
                get_frame_size (), frame_larger_than_size);
   }
 
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 173353)
+++ gcc/configure.ac	(working copy)
@@ -4951,6 +4951,20 @@
 fi
 
 
+warn_frame_larger_than_extra_text=
+AC_ARG_WITH(warn-frame-larger-than-extra-text,
+[  --with-warn-frame-larger-than-extra-text=TEXT
+                          specifies extra text for frame size warnings],
+[case "${withval}" in
+yes)	AC_MSG_ERROR(bad value ${withval} given for frame size warning text) ;;
+no)	;;
+*)	warn_frame_larger_than_extra_text="$withval" ;;
+esac])
+AC_DEFINE_UNQUOTED(WARN_FRAME_LARGER_THAN_EXTRA_TEXT,
+                   "$warn_frame_larger_than_extra_text",
+                   [Define to be extra text for frame size warnings.])
+
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 

--
This patch is available for review at http://codereview.appspot.com/4479046


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