mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-12 19:55:45 +08:00
invoke.texi (Warning Options): Add new option -Wframe-larger-than=.
gcc/ChangeLog: 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. gcc/testsuite/ChangeLog: 2008-02-20 Seongbae Park <seongbae.park@gmail.com> * gcc.dg/Wframe-larger-than.c: New option test. From-SVN: r132496
This commit is contained in:
parent
c8910ef9e2
commit
a214518f7f
@ -1,3 +1,21 @@
|
||||
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.
|
||||
|
@ -110,6 +110,17 @@ Wfatal-errors
|
||||
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
|
||||
|
@ -236,7 +236,8 @@ Objective-C and Objective-C++ Dialects}.
|
||||
-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
|
||||
@ -3518,6 +3519,10 @@ global variable or whenever a built-in function is shadowed.
|
||||
@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
|
||||
|
@ -1524,6 +1524,15 @@ final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file,
|
||||
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 ());
|
||||
|
||||
|
@ -137,6 +137,12 @@ extern void set_Wstrict_aliasing (int onoff);
|
||||
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. */
|
||||
|
||||
|
10
gcc/opts.c
10
gcc/opts.c
@ -58,6 +58,11 @@ bool extra_warnings;
|
||||
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;
|
||||
|
||||
@ -1498,6 +1503,11 @@ common_handle_option (size_t scode, const char *arg, int value,
|
||||
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;
|
||||
|
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
13
gcc/testsuite/gcc.dg/Wframe-larger-than.c
Normal file
13
gcc/testsuite/gcc.dg/Wframe-larger-than.c
Normal file
@ -0,0 +1,13 @@
|
||||
/* 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" } */
|
Loading…
Reference in New Issue
Block a user