This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Silently checking whether diagnostics would occur
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Silently checking whether diagnostics would occur
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Thu, 14 Sep 2000 11:42:34 -0400
- Cc: meissner at cygnus dot com, amylaar at cygnus dot co dot uk, gcc at gcc dot gnu dot org, gdr at codesourcery dot com
- References: <200009141530.LAA09532@caip.rutgers.edu>
On Thu, Sep 14, 2000 at 11:30:49AM -0400, Kaveh R. Ghazi wrote:
> > From: Michael Meissner <meissner@cygnus.com>
> >
> > Rather than returning an error value, you could have the parameter be
> > an int pointer, and if the pointer is NULL, otherwise set the pointer
> > to non-zero and return. Another way to write the function is to pass
> > a function that writes the error messages, and for the case you don't
> > want the error messages, have it record in a static about being called
> > and return, and change the other callers to pass error or what have
> > you for the function.
>
> One nit with passing in a function is that attribute printf doesn't
> work on function pointers IIRC, so all the calls to the warning
> function ptr would lose format checks. (Though I suppose that could
> be fixed.) Sigh, that would have been cleaner since I could do
> "#pragma poison warning" to make sure the function pointer parameter
> was always used in preference to `warning'.
Use a special purpose warning function then that has fixed arguments, instead
of a general stdarg function.
--
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482