* Searching for a gcc option
[not found] <612647203.284.1262636977809.JavaMail.root@stormy.trychlos.pwi>
@ 2010-01-04 20:35 ` Pierre Wieser
2010-01-04 22:39 ` Kevin P. Fleming
2010-01-05 8:57 ` Frank Mehnert
0 siblings, 2 replies; 3+ messages in thread
From: Pierre Wieser @ 2010-01-04 20:35 UTC (permalink / raw)
To: gcc-help; +Cc: pwieser
Hi
I'am the maintainer of Nautilus-Actions, a Gnome application.
I'm afraid that my code may sometimes embed some sentences such as
printf( "blah blah" );
instead of
printf( "%s", "blah blah" );
For the second time, a Gentoo user complains about a syntax error
in the first form, probably due to a particular configuration option
of the Gentoo gcc.
Might someone be kind enough to point out which gcc option I should
use in order to be warned on this type of error, please ?
This may give better quality to my releases...
My current compilation options are:
-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare -Werror -ansi -fstack-protector -Wno-overlength-strings -g -O2 -MT
Thanks in advance for your help
Regards
Pierre
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Searching for a gcc option
2010-01-04 20:35 ` Searching for a gcc option Pierre Wieser
@ 2010-01-04 22:39 ` Kevin P. Fleming
2010-01-05 8:57 ` Frank Mehnert
1 sibling, 0 replies; 3+ messages in thread
From: Kevin P. Fleming @ 2010-01-04 22:39 UTC (permalink / raw)
To: Pierre Wieser; +Cc: gcc-help
Pierre Wieser wrote:
> I'm afraid that my code may sometimes embed some sentences such as
> printf( "blah blah" );
> instead of
> printf( "%s", "blah blah" );
>
> For the second time, a Gentoo user complains about a syntax error
> in the first form, probably due to a particular configuration option
> of the Gentoo gcc.
>
> Might someone be kind enough to point out which gcc option I should
> use in order to be warned on this type of error, please ?
> This may give better quality to my releases...
This is -Wformat.
--
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpfleming@digium.com
Check us out at www.digium.com & www.asterisk.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Searching for a gcc option
2010-01-04 20:35 ` Searching for a gcc option Pierre Wieser
2010-01-04 22:39 ` Kevin P. Fleming
@ 2010-01-05 8:57 ` Frank Mehnert
1 sibling, 0 replies; 3+ messages in thread
From: Frank Mehnert @ 2010-01-05 8:57 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
On Monday 04 January 2010, Pierre Wieser wrote:
> I'am the maintainer of Nautilus-Actions, a Gnome application.
>
> I'm afraid that my code may sometimes embed some sentences such as
> printf( "blah blah" );
> instead of
> printf( "%s", "blah blah" );
>
> For the second time, a Gentoo user complains about a syntax error
> in the first form, probably due to a particular configuration option
> of the Gentoo gcc.
the first form is dangerous if "blah blah" is a string which can
contain format specifiers, for instance
void foo(const char *str)
{
...
printf(str);
}
where str is passed from somewhere else. Maybe Gentoo hardenend does
not allow such use of printf. The correct switch for this warning is
-Wformat-security
which will make gcc produce
``warning: format not a string literal and no format arguments''
in such a case.
Kind regards,
Frank
--
Dr.-Ing. Frank Mehnert Sun Microsystems, Inc. www.sun.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-05 8:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <612647203.284.1262636977809.JavaMail.root@stormy.trychlos.pwi>
2010-01-04 20:35 ` Searching for a gcc option Pierre Wieser
2010-01-04 22:39 ` Kevin P. Fleming
2010-01-05 8:57 ` Frank Mehnert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).