public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: jsm28@cam.ac.uk
Cc: amylaar@cygnus.co.uk, gcc@gcc.gnu.org, gdr@codesourcery.com,
	meissner@cygnus.com
Subject: Re: Silently checking whether diagnostics would occur
Date: Fri, 15 Sep 2000 11:12:00 -0000	[thread overview]
Message-ID: <200009151812.OAA18000@caip.rutgers.edu> (raw)

 > From: "Joseph S. Myers" <jsm28@cam.ac.uk>
 > 
 > On Thu, 14 Sep 2000, Kaveh R. Ghazi wrote:
 > 
 > > 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
 > 
 > This should probably be considered a bug (which should be fixed) that
 > format attributes don't attach properly to the function type.

I agree, would you like to fix it? :-)

I looked at this a year ago, but lost interest.  If you want to take a
stab by all means please do.

The first problem is that in c-common.c:decl_attributes, the A_FORMAT
case specifically errors when it receives something that is not a
FUNCTION_DECL.  So you need to also handle POINTER_TYPEs (for function
pointers) or AGGREGATE_TYPEs (for arrays or structs containing
function pointers), as well descending subexpressions of these, until
you get to the eventual FUNCTION_DECL if you want to fix this.

That's just to get the attribute to be accepted.  You also have to
muck with c-typeck.c:build_function_call to actually do the
appropriate checks.

 > 
 > Marc Espie's __attribute__((__nonnull__)) patch allows (I think) for one
 > function to have multiple printf/scanf attributes (which could make sense
 > if all but as must one are vprintf/vscanf-like), but I don't know if it
 > fixes this problem.

I haven't seen his patch, so I can't say.

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions

             reply	other threads:[~2000-09-15 11:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-15 11:12 Kaveh R. Ghazi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-09-15 11:25 Kaveh R. Ghazi
2000-09-14  8:31 Kaveh R. Ghazi
2000-09-14  8:42 ` Michael Meissner
2000-09-14 10:47 ` Joseph S. Myers
2000-09-14 12:37 ` Joern Rennecke
2000-09-14  7:43 Kaveh R. Ghazi
2000-09-13 17:38 Mike Stump
2000-09-13 14:33 Kaveh R. Ghazi
2000-09-13 20:37 ` Michael Meissner
2000-09-13  8:50 Kaveh R. Ghazi
2000-09-13 13:51 ` Michael Meissner
2000-09-13 16:37 ` Joern Rennecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200009151812.OAA18000@caip.rutgers.edu \
    --to=ghazi@caip.rutgers.edu \
    --cc=amylaar@cygnus.co.uk \
    --cc=gcc@gcc.gnu.org \
    --cc=gdr@codesourcery.com \
    --cc=jsm28@cam.ac.uk \
    --cc=meissner@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).