patches/gcc/4.4.4/140-default-format-security.patch
author Darcy Watkins <dwatkins@tranzeo.com>
Thu Aug 05 18:19:07 2010 +0200 (2010-08-05)
branch1.8
changeset 2073 a3b7a63dce01
child 2148 ada9128c98b8
permissions -rw-r--r--
cc/gcc: with static ppl, correctly link with libm

On some Fedora boxen (at least FC13), it is also required
to link with libm when static ppl is used.
(transplanted from bcd33fce4db9c18223b59ecdc96f10bf6dd574de)
yann@1948
     1
diff -durN gcc-4.4.0.orig/gcc/c-common.c gcc-4.4.0/gcc/c-common.c
yann@1948
     2
yann@1948
     3
diff -durN gcc-4.4.4.orig/gcc/c-common.c gcc-4.4.4/gcc/c-common.c
yann@1948
     4
--- gcc-4.4.4.orig/gcc/c-common.c	2009-11-05 15:57:57.000000000 +0100
yann@1948
     5
+++ gcc-4.4.4/gcc/c-common.c	2010-05-16 19:11:21.000000000 +0200
yann@1948
     6
@@ -301,7 +301,7 @@
yann@1948
     7
 /* Warn about format/argument anomalies in calls to formatted I/O functions
yann@1948
     8
    (*printf, *scanf, strftime, strfmon, etc.).  */
yann@1948
     9
 
yann@1948
    10
-int warn_format;
yann@1948
    11
+int warn_format = 1;
yann@1948
    12
 
yann@1948
    13
 /* Warn about using __null (as NULL in C++) as sentinel.  For code compiled
yann@1948
    14
    with GCC this doesn't matter as __null is guaranteed to have the right
yann@1948
    15
diff -durN gcc-4.4.4.orig/gcc/c.opt gcc-4.4.4/gcc/c.opt
yann@1948
    16
--- gcc-4.4.4.orig/gcc/c.opt	2009-09-18 23:53:23.000000000 +0200
yann@1948
    17
+++ gcc-4.4.4/gcc/c.opt	2010-05-16 19:11:21.000000000 +0200
yann@1948
    18
@@ -236,7 +236,7 @@
yann@1948
    19
 Warn about format strings that contain NUL bytes
yann@1948
    20
 
yann@1948
    21
 Wformat-security
yann@1948
    22
-C ObjC C++ ObjC++ Var(warn_format_security) Warning
yann@1948
    23
+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning
yann@1948
    24
 Warn about possible security problems with format functions
yann@1948
    25
 
yann@1948
    26
 Wformat-y2k
yann@1948
    27
diff -durN gcc-4.4.4.orig/gcc/doc/invoke.texi gcc-4.4.4/gcc/doc/invoke.texi
yann@1948
    28
--- gcc-4.4.4.orig/gcc/doc/invoke.texi	2010-04-08 12:46:46.000000000 +0200
yann@1948
    29
+++ gcc-4.4.4/gcc/doc/invoke.texi	2010-05-16 19:11:21.000000000 +0200
yann@1948
    30
@@ -2888,6 +2888,9 @@
yann@1948
    31
 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
yann@1948
    32
 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
yann@1948
    33
 
yann@1948
    34
+NOTE: In Gentoo, this option is enabled by default for C, C++, ObjC, ObjC++.
yann@1948
    35
+To disable, use @option{-Wformat=0}.
yann@1948
    36
+
yann@1948
    37
 @item -Wformat-y2k
yann@1948
    38
 @opindex Wformat-y2k
yann@1948
    39
 @opindex Wno-format-y2k
yann@1948
    40
@@ -2941,6 +2944,11 @@
yann@1948
    41
 in future warnings may be added to @option{-Wformat-security} that are not
yann@1948
    42
 included in @option{-Wformat-nonliteral}.)
yann@1948
    43
 
yann@1948
    44
+NOTE: In Gentoo, this option is enabled by default for C, C++, ObjC, ObjC++.
yann@1948
    45
+To disable, use @option{-Wno-format-security}, or disable all format warnings
yann@1948
    46
+with @option{-Wformat=0}.  To make format security warnings fatal, specify
yann@1948
    47
+@option{-Werror=format-security}.
yann@1948
    48
+
yann@1948
    49
 @item -Wformat=2
yann@1948
    50
 @opindex Wformat=2
yann@1948
    51
 @opindex Wno-format=2