+2008-02-20 Seongbae Park <seongbae.park@gmail.com>
+
+ * doc/invoke.texi (Warning Options): Add new option
+ -Wframe-larger-than=.
+ (-Wframe-larger-than): Document.
+
+ * flags.h (warn_frame_larger_than, frame_larger_than_size):
+ Add declarations for new option variables.
+
+ * final.c (final_start_function): Check the frame size
+ before emission and issue a Wframe-larger-than warning.
+
+ * opts.c (warn_frame_larger_than, frame_larger_than_size):
+ Add definitions for new option variables.
+ (common_handle_option): Handle new option OPT_Wframe_larger_than_.
+
+ * common.opt (Wframe-larger-than=): New option.
+
2008-02-20 Uros Bizjak <ubizjak@gmail.com>
* config/i386/sse.md (<sse>_vmmul<mode>3): Fix typo in asm template.
Common Var(flag_fatal_errors)
Exit on the first error occurred
+Wframe-larger-than=
+Common RejectNegative Joined UInteger
+-Wframe-larger-than=@var{len} Warn whenever a function's stack frame requires
+more than @var{len} bytes. The computation done to determine
+the stack frame size is approximate and not conservative.
+The actual requirements may be somewhat greater than @var{len}
+even if you do not get a warning. In addition, any space allocated
+via @code{alloca}, variable-length arrays, or related constructs
+is not included by the compiler when determining
+whether or not to issue a warning.
+
Winline
Common Var(warn_inline) Warning
Warn when an inlined function cannot be inlined
-Werror -Werror=* @gol
-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
-Wno-format-extra-args -Wformat-nonliteral @gol
--Wformat-security -Wformat-y2k -Wignored-qualifiers @gol
+-Wformat-security -Wformat-y2k @gol
+-Wframe-larger-than=@var{len} -Wignored-qualifiers @gol
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
-Wimport -Wno-import -Winit-self -Winline @gol
-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
@opindex Wlarger-than-@var{len}
Warn whenever an object of larger than @var{len} bytes is defined.
+@item -Wframe-larger-than=@var{len}
+@opindex Wframe-larger-than
+Warn whenever the size of a function frame is larger than @var{len} bytes.
+
@item -Wunsafe-loop-optimizations
@opindex Wunsafe-loop-optimizations
@opindex Wno-unsafe-loop-optimizations
TREE_ASM_WRITTEN (DECL_INITIAL (current_function_decl)) = 1;
}
+ if (warn_frame_larger_than
+ && get_frame_size () > frame_larger_than_size)
+ {
+ /* Issue a warning */
+ warning (OPT_Wframe_larger_than_,
+ "the frame size of %wd bytes is larger than %wd bytes",
+ get_frame_size (), frame_larger_than_size);
+ }
+
/* First output the function prologue: code to set up the stack frame. */
targetm.asm_out.function_prologue (file, get_frame_size ());
extern bool warn_larger_than;
extern HOST_WIDE_INT larger_than_size;
+/* Nonzero means warn about any function whose frame size is larger
+ than N bytes. */
+
+extern bool warn_frame_larger_than;
+extern HOST_WIDE_INT frame_larger_than_size;
+
/* Temporarily suppress certain warnings.
This is set while reading code from a system header file. */
bool warn_larger_than;
HOST_WIDE_INT larger_than_size;
+/* True to warn about any function whose frame size is larger
+ * than N bytes. */
+bool warn_frame_larger_than;
+HOST_WIDE_INT frame_larger_than_size;
+
/* Hack for cooperation between set_Wunused and set_Wextra. */
static bool maybe_warn_unused_parameter;
warn_larger_than = value != -1;
break;
+ case OPT_Wframe_larger_than_:
+ frame_larger_than_size = value;
+ warn_frame_larger_than = value != -1;
+ break;
+
case OPT_Wstrict_aliasing:
set_Wstrict_aliasing (value);
break;
+2008-02-20 Seongbae Park <seongbae.park@gmail.com>
+
+ * gcc.dg/Wframe-larger-than.c: New option test.
+
2008-02-20 Tobias Burnus <burnus@net-b.de>
PR fortran/34997
--- /dev/null
+/* Test -Wframe-larger-than for warning
+ when the frame size is bigger than specified.
+ Origin: Seongbae Park <seongbae.park@gmail.com> */
+
+/* { dg-do compile } */
+/* { dg-options "-Wframe-larger-than=2048" } */
+
+extern void func(char *);
+
+void foo (void) {
+ char array[4096];
+ func(array);
+} /* { dg-warning "the frame size of .* bytes is larger than 2048 bytes" } */