On Mon, Feb 20, 2012 at 11:22:18AM -0800, Ted Kremenek wrote: > On Feb 20, 2012, at 11:04 AM, Joerg Sonnenberger <[email protected]> > wrote: > > > On Mon, Feb 20, 2012 at 06:31:53PM +0000, Hans Wennborg wrote: > >> I'm a little bit confused about the status of some of these. For > >> example, should 'C' and 'S' be considered GNU extensions, and > >> therefore allowable when using -std=gnu99? > > > > In my opinion: no. -std=gnu99 specifies C99 with GNU compiler > > extensions. It doesn't mean anything about the run time implementation. > > As such, all the non-standard flags should go into a -Wformat-extensions > > category and it should be enabled by default with -Wformat. > > I would expect most users would be very unhappy to see these warnings > even when compiling with -std=gnu99. I think it is reasonable to > activate them (or a subset) for -std=c99, as that essentially ties in > with the portability argument I said in my other email.
Language extensions and runtime extensions aren't strongly related, so I don't buy that. > We should aim to do the right thing for users. In my experience, most > users are not going to want to see these pedantic warnings unless they > add value. >From my experience, the same set of users doesn't understand how to use ctype(3) correctly and will complain about patches that makes the code standard compliant. As such, not warning in first place dramatically increases the maintainance code. > I agree that ultimately this comes down to what the runtime supports, > but not knowing those details doesn't give us liberty to emit a bunch > of new warnings just because we don't have enough information to make > a good decision about whether to emit a warning or not. The default behavior for -Wformat would be "check that the format string is standard compliant". I think that's a perfectively sane default and if someone wants to use non-standard format extensions, clang tells them how to get them. I don't think that the average piece of code written nowadays will only ever run on glibc-Linux / *BSD / Mac OSX or any other single platform. I do know that the GCC behavior of silently accepting them has created hidden bugs. There are some applications where more fine-grained controlled would be very helpful, e.g. "only allow C89 format modifiers", since there is still a certain demand for dealing with non-C99 environments (hello Microsoft?). Joerg _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
