~ubuntu-branches/ubuntu/raring/gcc-4.7/raring

« back to all changes in this revision

Viewing changes to debian/patches/gcc-default-format-security.diff

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-12-17 23:19:46 UTC
  • Revision ID: package-import@ubuntu.com-20111217231946-n668coanjbjgqxq7
Tags: 4.7-20111217-1
* GCC-4.7 snapshot build.
  - Including the GFDL documentation; will stay in experimental
    until the 4.7.0 release sometime next year.
* Update patches for the trunk.
* Update symbols files.
* Build libitm packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# DP: Turn on -Wformat -Wformat-security by  default for C, C++, ObjC, ObjC++.
 
2
 
 
3
---
 
4
 gcc/c-common.c      |    2 +-
 
5
 gcc/c.opt           |    2 +-
 
6
 gcc/doc/invoke.texi |    8 ++++++++
 
7
 3 files changed, 10 insertions(+), 2 deletions(-)
 
8
 
 
9
--- a/src/gcc/c-family/c-common.c
 
10
+++ b/src/gcc/c-family/c-common.c
 
11
@@ -201,7 +201,7 @@
 
12
 /* Warn about format/argument anomalies in calls to formatted I/O functions
 
13
    (*printf, *scanf, strftime, strfmon, etc.).  */
 
14
 
 
15
-int warn_format;
 
16
+int warn_format = 1;
 
17
 
 
18
 /* C/ObjC language option variables.  */
 
19
 
 
20
--- a/src/gcc/c-family/c.opt
 
21
+++ b/src/gcc/c-family/c.opt
 
22
@@ -384,7 +384,7 @@
 
23
 Warn about format strings that contain NUL bytes
 
24
 
 
25
 Wformat-security
 
26
-C ObjC C++ ObjC++ Var(warn_format_security) Warning
 
27
+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning
 
28
 Warn about possible security problems with format functions
 
29
 
 
30
 Wformat-y2k
 
31
--- a/src/gcc/doc/invoke.texi
 
32
+++ b/src/gcc/doc/invoke.texi
 
33
@@ -3102,6 +3102,9 @@
 
34
 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
 
35
 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
 
36
 
 
37
+NOTE: In Ubuntu 8.10 and later versions this option is enabled by default
 
38
+for C, C++, ObjC, ObjC++.  To disable, use @option{-Wformat=0}.
 
39
+
 
40
 @item -Wformat-y2k
 
41
 @opindex Wformat-y2k
 
42
 @opindex Wno-format-y2k
 
43
@@ -3155,6 +3158,11 @@
 
44
 in future warnings may be added to @option{-Wformat-security} that are not
 
45
 included in @option{-Wformat-nonliteral}.)
 
46
 
 
47
+NOTE: In Ubuntu 8.10 and later versions this option is enabled by default
 
48
+for C, C++, ObjC, ObjC++.  To disable, use @option{-Wno-format-security},
 
49
+or disable all format warnings with @option{-Wformat=0}.  To make format
 
50
+security warnings fatal, specify @option{-Werror=format-security}.
 
51
+
 
52
 @item -Wformat=2
 
53
 @opindex Wformat=2
 
54
 @opindex Wno-format=2