diff options
author | dougkwan <dougkwan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-13 00:22:38 +0000 |
---|---|---|
committer | dougkwan <dougkwan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-13 00:22:38 +0000 |
commit | 36e37a8772797c12053db9ddaeb88e728996d815 (patch) | |
tree | e1ab0d8cbc735be34bf3b43df3a196670e70025b /gcc/doc/invoke.texi | |
parent | e0c9c00f8e3d73854993553257b6438b617989ab (diff) | |
download | gcc-36e37a8772797c12053db9ddaeb88e728996d815.tar.gz |
ChangeLog:
2008-01-12 Doug Kwan <dougkwan@google.com>
* c-decl.c: (grokdeclarator): Use OPT_Wignored_qualifiers
instead of OPT_Wreturn_type in warning due to ignored return type
qualifiers.
* c-opt.c (c_common_post_option): Add -Wignored-qualifiers to
options included in -Wextra.
* c.opt: New option -Wignored_qualifiers.
* doc/invoke.texi (Warning Options, -Wextra): Add new option
-Wignore_qualifiers.
(-Wignored-qualifiers): Document.
(-Wreturn-type): Remove description of functionality now handled
by -Wignored-qualifiers.
cp/ChangeLog:
2008-01-12 Doug Kwan <dougkwan@google.com>
* decl.c: (grokdeclarator): Use OPT_Wignored_qualifiers
instead of OPT_Wreturn_type in warning due to ignored return type
qualifiers.
* pt.c: (tsubst_function_type): Use OPT_Wignored_qualifiers
instead of OPT_Wreturn_type in warning due to ignored return type
qualifiers.
testsuite/ChangeLog:
2008-01-12 Doug Kwan <dougkwan@google.com>
* gcc.dg/qual-return-1.c: Add -Wignored-qualifiers.
* g++.dg/warn/Wreturn-type-4.C: Replace -Wreturn-type by
-Wignored-qualifiers.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131499 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 177e007db11..5e41ec30f51 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -236,7 +236,7 @@ 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 @gol +-Wformat-security -Wformat-y2k -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 @@ -2675,6 +2675,7 @@ name is still supported, but the newer name is more descriptive.) @gccoptlist{-Wclobbered @gol -Wempty-body @gol +-Wignored-qualifiers @gol -Wmissing-field-initializers @gol -Wmissing-parameter-type @r{(C only)} @gol -Wold-style-declaration @r{(C only)} @gol @@ -2864,6 +2865,19 @@ enabled by default and it is made into an error by Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. This warning is enabled by @option{-Wall}. +@item -Wignored-qualifiers +@opindex Wignored-qualifiers +@opindex Wno-ignored-qualifiers +Warn if the return type of a function has a type qualifier +such as @code{const}. For ISO C such a type qualifier has no effect, +since the value returned by a function is not an lvalue. +For C++, the warning is only emitted for scalar types or @code{void}. +ISO C prohibits qualified @code{void} return types on function +definitions, so such return types always receive a warning +even without this option. + +This warning is also enabled by @option{-Wextra}. + @item -Wmain @opindex Wmain Warn if the type of @samp{main} is suspicious. @samp{main} should be a @@ -2996,14 +3010,6 @@ return-value in a function whose return-type is not @code{void} without a value), and about a @code{return} statement with a expression in a function whose return-type is @code{void}. -Also warn if the return type of a function has a type qualifier -such as @code{const}. For ISO C such a type qualifier has no effect, -since the value returned by a function is not an lvalue. -For C++, the warning is only emitted for scalar types or @code{void}. -ISO C prohibits qualified @code{void} return types on function -definitions, so such return types always receive a warning -even without this option. - For C++, a function without return type always produces a diagnostic message, even when @option{-Wno-return-type} is specified. The only exceptions are @samp{main} and functions defined in system headers. |