[Top] [All Lists]

Re: [SOLVED] Re: GCC-4.3.3 sillyness

To: Manuel Lauss <>
Subject: Re: [SOLVED] Re: GCC-4.3.3 sillyness
From: Kumba <>
Date: Wed, 25 Feb 2009 00:13:20 -0500
Cc: Ralf Baechle <>, Geert Uytterhoeven <>,
In-reply-to: <>
Original-recipient: rfc822;
References: <> <>
User-agent: Thunderbird (Windows/20081209)
Manuel Lauss wrote:
On Fri, 30 Jan 2009 08:44:07 +0100
Manuel Lauss <> wrote:


Can't build kernel because gcc-4.3.3 comes up with this gem:

  CC      arch/mips/kernel/traps.o
cc1: warnings being treated as errors
/linux-2.6.git/arch/mips/kernel/traps.c: In function 'set_uncached_handler':
/linux-2.6.git/arch/mips/kernel/traps.c:1599: error: format not a string 
literal and no format arguments

Turns out Gentoo applied a patch (from Debian) which unconditionally
enables -Wformat-security (which is responsible for the warning).

Yeah, I did some digging and it looks like we added a patch called "10_all_gcc-default-format-security.patch" into our gcc-4.3.3 ebuild. The patch claims it was ripped from Debian; can any Debian devs comment on whether you guys still use this patch and what the idea behind it is? I'm not sure if I'll find any discussion on our end as to why it's included without finding Mike (vapier) around.

Joshua Kinard

"The past tempts us, the present confuses us, the future frightens us. And our lives slip away, moment by moment, lost in that vast, terrible in-between."

--Emperor Turhan, Centauri Republic
ripped from Debian

# DP: Turn on -Wformat -Wformat-security by  default for C, C++, ObjC, ObjC++.

--- gcc/c-common.c
+++ gcc/c-common.c
@@ -277,7 +277,7 @@
 /* Warn about format/argument anomalies in calls to formatted I/O functions
    (*printf, *scanf, strftime, strfmon, etc.).  */
-int warn_format;
+int warn_format = 1;
 /* Warn about using __null (as NULL in C++) as sentinel.  For code compiled
    with GCC this doesn't matter as __null is guaranteed to have the right
--- gcc/c.opt
+++ gcc/c.opt
@@ -228,7 +228,7 @@
 Warn about format strings that contain NUL bytes
-C ObjC C++ ObjC++ Var(warn_format_security) Warning
+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning
 Warn about possible security problems with format functions
--- gcc/doc/invoke.texi
+++ gcc/doc/invoke.texi
@@ -2802,6 +2802,9 @@
 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
+NOTE: In Gentoo, this option is enabled by default for C, C++, ObjC, ObjC++.
+To disable, use @option{-Wformat=0}.
 @item -Wformat-y2k
 @opindex Wformat-y2k
 @opindex Wno-format-y2k
@@ -2849,6 +2852,11 @@
 in future warnings may be added to @option{-Wformat-security} that are not
 included in @option{-Wformat-nonliteral}.)
+NOTE: In Gentoo, this option is enabled by default for C, C++, ObjC, ObjC++.
+To disable, use @option{-Wno-format-security}, or disable all format warnings
+with @option{-Wformat=0}.  To make format security warnings fatal, specify
 @item -Wformat=2
 @opindex Wformat=2
 @opindex Wno-format=2
<Prev in Thread] Current Thread [Next in Thread>