This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ patch] accept __null as sentinel


Michael Matz wrote:
Hi,

On Fri, 29 Apr 2005, Joseph S. Myers wrote:


One possibility in that regard is for it to go in -Wformat=2 alongside
-Wformat-nonliteral -Wformat-security -Wformat-y2k. Though unlike
--Wformat-nonliteral -Wformat-y2k which are cases where the warning can
be difficult to avoid (if your code needs to build up a format string,
or if you know you do want a particular strftime format) so indicating
it doesn't belong in -Wall, here the warning can always be avoided by
adding a cast at each call site (with no change to the code generated).


This indicates that you never had to deal with more than a couple sources,
whose initial author is long dead ;-)

Would you please stop making these kinds of comments?


I've been developing commercial software for twenty years, and working with C++ programs written by others for much of that time, including truly crufty code in Cfront itself, and working with customers who were themselves developing C and C++ code (including developing commercial products to check for errors statically and dynamically) on a variety of systems ranging from 8-bit embedded to supercomputers running systems from BeOS to Windows to VxWorks to IRIX. The implication that we're living in an ivory tower and don't know anything about programming in the real world is simply not true.

portability, well, there's -pedantic.  Let's keep -Wall usable and not
force people to do "-W -Wall -Wno-not-this-one -Wno-thats-dumb-too
-Wno-cant-break-anything" to get at the usefull warnings.

Fine; then -Wformat=2 is a reasonable place. I agree with Joseph that -pedantic is not the right place; that's about failures to conform to standards.


A criteria for usefull warnings _to me_ (I fully realize that's not the
opinion of all), is "can it change code harmfully depending on the
architecture or circumstances, when compiled on a GNU system".

That's indeed a useful category of warnings, and I'd be happy to have a switch for that. But -Wall isn't presently that option; for example, -W adds support for warning about falling off a function, which clearly can cause problems when compiled on a GNU system. Nor is that warning added by -pedantic, as it's not a standards-conformance issue.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]