aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2016-11-21 17:15:54 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2016-11-21 10:15:54 -0700
commit89990732da0502a298fd10f8bfb85e2973259ef6 (patch)
tree15ec3f07505e52dec9c26a060a43fc171ee971dd /gcc
parent9636feef4d6ade39ba9682ed7f7826d2cf31bcb9 (diff)
downloadgcc-89990732da0502a298fd10f8bfb85e2973259ef6.zip
gcc-89990732da0502a298fd10f8bfb85e2973259ef6.tar.gz
gcc-89990732da0502a298fd10f8bfb85e2973259ef6.tar.bz2
Enable -fprintf-return-value by default. Tested on powerpc64le and x86.
gcc/c-family/ChangeLog: * c.opt (-fprintf-return-value): Enable by default. gcc/ChangeLog: * doc/invoke.texi (-fprintf-return-value): Document that option is enabled by default. From-SVN: r242674
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c-family/c.opt2
-rw-r--r--gcc/doc/invoke.texi32
4 files changed, 27 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6c50925..543d38b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-21 Martin Sebor <msebor@redhat.com>
+
+ * doc/invoke.texi (-fprintf-return-value): Document that option
+ is enabled by default.
+
2016-11-21 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr-c.c (avr_register_target_pragmas): Use C++
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 565ff82..f2ea179 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,7 @@
+2016-11-21 Martin Sebor <msebor@redhat.com>
+
+ * c.opt (-fprintf-return-value): Enable by default.
+
2016-11-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/71973
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 10a8793..c61fab8 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1554,7 +1554,7 @@ C++ ObjC++ Var(flag_pretty_templates) Init(1)
-fno-pretty-templates Do not pretty-print template specializations as the template signature followed by the arguments.
fprintf-return-value
-C ObjC C++ ObjC++ LTO Optimization Var(flag_printf_return_value) Init(0)
+C ObjC C++ ObjC++ LTO Optimization Var(flag_printf_return_value) Init(1)
Treat known sprintf return values as constants.
freplace-objc-classes
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 67ed240..e026653 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -381,11 +381,12 @@ Objective-C and Objective-C++ Dialects}.
-fmove-loop-invariants -fno-branch-count-reg @gol
-fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
-fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
--fno-peephole2 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
+-fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
+-fno-sched-spec -fno-signed-zeros @gol
-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
-fomit-frame-pointer -foptimize-sibling-calls @gol
-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
--fprefetch-loop-arrays -fprintf-return-value @gol
+-fprefetch-loop-arrays @gol
-fprofile-correction @gol
-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
-fprofile-reorder-functions @gol
@@ -8274,18 +8275,19 @@ dependent on the structure of loops within the source code.
Disabled at level @option{-Os}.
-@item -fprintf-return-value
-@opindex fprintf-return-value
-Substitute constants for known return value of formatted output functions
-such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and @code{vsnprintf}
-(but not @code{printf} of @code{fprintf}). This transformation allows GCC
-to optimize or even eliminate branches based on the known return value of
-these functions called with arguments that are either constant, or whose
-values are known to be in a range that makes determining the exact return
-value possible. For example, both the branch and the body of the @code{if}
-statement (but not the call to @code{snprint}) can be optimized away when
-@code{i} is a 32-bit or smaller integer because the return value is guaranteed
-to be at most 8.
+@item -fno-printf-return-value
+@opindex fno-printf-return-value
+Do not substitute constants for known return value of formatted output
+functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
+@code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
+transformation allows GCC to optimize or even eliminate branches based
+on the known return value of these functions called with arguments that
+are either constant, or whose values are known to be in a range that
+makes determining the exact return value possible. For example, when
+@option{-fprintf-return-value} is in effect, both the branch and the
+body of the @code{if} statement (but not the call to @code{snprint})
+can be optimized away when @code{i} is a 32-bit or smaller integer
+because the return value is guaranteed to be at most 8.
@smallexample
char buf[9];
@@ -8296,7 +8298,7 @@ if (snprintf (buf, "%08x", i) >= sizeof buf)
The @option{-fprintf-return-value} option relies on other optimizations
and yields best results with @option{-O2}. It works in tandem with the
@option{-Wformat-length} option. The @option{-fprintf-return-value}
-option is disabled by default.
+option is enabled by default.
@item -fno-peephole
@itemx -fno-peephole2