This is the mail archive of the 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/5127: Should Get a Compile Error

On 15 Dec 2001 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

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