This is the mail archive of the
mailing list for the GCC project.
Re: c/5127: Should Get a Compile Error
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: <rodrigc at gcc dot gnu dot org>, <dhighley at highley-recommended dot com>, <gcc-bugs at gcc dot gnu dot org>, <gcc-gnats at gcc dot gnu dot org>
- Date: Sat, 15 Dec 2001 21:23:53 +0000 (GMT)
- Subject: Re: c/5127: Should Get a Compile Error
On 15 Dec 2001 email@example.com wrote:
> The compiler's job is to check that the parameters you
> passed to freopen() satisfy the function prototype:
> FILE *freopen (const char *path, const char *mode, FILE *stream);
> If you satisfy the function prototype, but the type
> of data you pass in is bad, then that is the job
> of the underlying C library implementation to report
> an error (or not).
> If VC++ and Borland also did not report this error, then
> that should give you a clue that this is not a compiler bug.
> Not a gcc bug.
I think this is however a prefectly reasonable feature request, that GCC
support this check on the arguments of this ISO C function - probably
under -Wformat, since that's where we check for bad arguments to printf
etc. functions and where it has been proposed to check the NULL-terminated
lists of arguments to exec family functions (in some future version of
Marc Espie's __attribute__((nonnull)) patch, which hopefully will
eventually be in GCC). I think this should be left in state "analyzed" or
"suspended" and marked as a "change-request". If you don't want to leave
a PR open for this, please add a note to the format checking part of
htdocs/projects/index.html instead. (Such a note would probably be a good
idea whether the PR is reopened or not.)
Joseph S. Myers