aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2017-01-08 23:42:09 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2017-01-08 16:42:09 -0700
commitefcc8d387f52f995a6e41bc78a76cc77e4bb6ee8 (patch)
treef91cdc7136d16f3e039d0ea98daf535a9c7c6f30 /gcc/c-family
parent1243c42d6457fd2b09917b5789c8c42dd13437ec (diff)
downloadgcc-efcc8d387f52f995a6e41bc78a76cc77e4bb6ee8.zip
gcc-efcc8d387f52f995a6e41bc78a76cc77e4bb6ee8.tar.gz
gcc-efcc8d387f52f995a6e41bc78a76cc77e4bb6ee8.tar.bz2
PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length PR middle-end/77708 - -Wformat-length %s warns for snprintf gcc/ChangeLog: PR middle-end/77708 * doc/invoke.texi (Warning Options): Document -Wformat-truncation. * gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt): New member functions. (format_directive): Used them. (add_bytes): Same. (pass_sprintf_length::handle_gimple_call): Same. * graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size to avoid truncation for any argument. (extract_affine_mul): Same. * tree.c (get_file_function_name): Same. gcc/c-family/ChangeLog: PR middle-end/77708 * c.opt (-Wformat-truncation): New option. gcc/fortran/ChangeLog: PR tree-optimization/78913 PR middle-end/77708 * trans-common.c (build_equiv_decl): Increase buffer size to avoid truncation for any argument. * trans-types.c (gfc_build_logical_type): Same. gcc/testsuite/ChangeLog: PR middle-end/77708 * gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test. * gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing due to bug 78969. * gcc.dg/format/pr78569.c: Adjust. From-SVN: r244210
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c.opt9
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 375dad1..3bd2c7c 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-08 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/77708
+ * c.opt (-Wformat-truncation): New option.
+
2017-01-06 Alexandre Oliva <aoliva@redhat.com>
* c-pretty-print.c (pp_c_tree_decl_identifier): Convert 16-bit
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 0b74aba..8b2fc79 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -537,6 +537,11 @@ Wformat-signedness
C ObjC C++ ObjC++ Var(warn_format_signedness) Warning
Warn about sign differences with format functions.
+Wformat-truncation
+C ObjC C++ ObjC++ Warning Alias(Wformat-truncation=, 1, 0)
+Warn about calls to snprintf and similar functions that truncate output.
+Same as -Wformat-truncation=1.
+
Wformat-y2k
C ObjC C++ ObjC++ Var(warn_format_y2k) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=,warn_format >= 2, 0)
Warn about strftime formats yielding 2-digit years.
@@ -554,6 +559,10 @@ C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format_length) Warning
Warn about function calls with format strings that write past the end
of the destination region.
+Wformat-truncation=
+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format_trunc) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0)
+Warn about calls to snprintf and similar functions that truncate output.
+
Wignored-qualifiers
C C++ Var(warn_ignored_qualifiers) Warning EnabledBy(Wextra)
Warn whenever type qualifiers are ignored.