aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2010-04-27 20:22:54 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2010-04-27 20:22:54 +0000
commit5dc16b195243d3c9ed970aa1ae62159a9265b2c4 (patch)
tree778af4c2a789370f37221943c394560c41ac11e2 /gcc/doc
parentea8b8aa005a994ce5d3e5437c780a35a2c27ff4e (diff)
downloadgcc-5dc16b195243d3c9ed970aa1ae62159a9265b2c4.zip
gcc-5dc16b195243d3c9ed970aa1ae62159a9265b2c4.tar.gz
gcc-5dc16b195243d3c9ed970aa1ae62159a9265b2c4.tar.bz2
invoke.texi (-Wsuggest-attribute=const, [...]): Document.
2010-04-27 Manuel López-Ibáñez <manu@gcc.gnu.org> Jan Hubicka <hubicka@ucw.cz> * doc/invoke.texi (-Wsuggest-attribute=const, -Wsuggest-attribute=pure): Document. * ipa-pure-const.c: Include toplev.h, intl.h and opts.h. (function_always_visible_to_compiler_p, suggest_attribute, warn_function_pure, warn_function_const): New functions. (check_call): Improve debug info. (analyze_function): Do not check availability. (add_new_function): Check availability. (propagate): Output warnings. (skip_function_for_local_pure_const): New function. (local_pure_const): Use it; output warnings. * common.opt (Wsuggest-attribute=const, Wsuggest-attribute=pure): New. testsuite/ * gcc.dg/pure-2.c: New testcase. * gcc.dg/const-1.c: New testcase. Co-Authored-By: Jan Hubicka <hubicka@ucw.cz> From-SVN: r158803
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi28
1 files changed, 27 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 23f744b..fefb0ab 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -257,6 +257,7 @@ Objective-C and Objective-C++ Dialects}.
-Wsign-compare -Wsign-conversion -Wstack-protector @gol
-Wstrict-aliasing -Wstrict-aliasing=n @gol
-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
+-Wsuggest-attribute=@r{[}const@r{|}pure@r{]} @gol
-Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
-Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
-Wunknown-pragmas -Wno-pragmas @gol
@@ -3621,11 +3622,36 @@ comparisons, so this warning level will give a very large number of
false positives.
@end table
+@item -Wsuggest-attribute=@r{[}const@r{|}pure@r{]}
+@opindex Wsuggest-attribute=
+@opindex Wno-suggest-attribute=
+Warn for cases where adding an attribute may be beneficial. The
+attributes currently supported are listed below.
+
+@table @gcctabopt
+@item -Wsuggest-attribute=pure
+@itemx -Wsuggest-attribute=const
+@opindex Wsuggest-attribute=pure
+@opindex Wno-suggest-attribute=pure
+@opindex Wsuggest-attribute=const
+@opindex Wno-suggest-attribute=const
+
+Warn about functions which might be candidates for attributes
+@code{pure} or @code{const}. The compiler only warns for functions
+visible in other compilation units or if it cannot prove that the
+function returns normally. A function returns normally if it doesn't
+contain an infinite loop nor returns abnormally by throwing, calling
+@code{abort()} or trapping. This analysis requires option
+@option{-fipa-pure-const}, which is enabled by default at @option{-O}
+and higher. Higher optimization levels improve the accuracy of the
+analysis.
+@end table
+
@item -Warray-bounds
@opindex Wno-array-bounds
@opindex Warray-bounds
This option is only active when @option{-ftree-vrp} is active
-(default for -O2 and above). It warns about subscripts to arrays
+(default for @option{-O2} and above). It warns about subscripts to arrays
that are always out of bounds. This warning is enabled by @option{-Wall}.
@item -Wno-div-by-zero