public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Cedric Roux <cedric.roux@acri-st.fr>
To: Manfred Schwind <lists@mani.de>
Cc: GCC-Help Mailing List <gcc-help@gcc.gnu.org>
Subject: Re: Accepting "%@" in format string with __attribute__ format
Date: Tue, 09 Mar 2010 15:05:00 -0000	[thread overview]
Message-ID: <4B96637C.1090509@acri-st.fr> (raw)
In-Reply-To: <E4581913-C44D-4BB4-B134-3D84B8F861B4@mani.de>

Manfred Schwind wrote:
> Is there any chance to get gcc check my passed parameters the
> "Objective-C way" with "%@" included but still having the format
> string passed as plain old C-string? It there any other types
> than __NSString__ I could try?
> 
> BTW, is there an official list what types are accepted by __attribute__((format(...))) ?

This NSString does not seem to be recognized by gcc at all.

I see that llvm handles it.
(http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?revision=97103&view=markup)
Are you sure you use gcc?

Compiling:
#import <Foundation/Foundation.h>

void mlog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));

leads to:
toto.m:3: warning: ‘__NSString__’ is an unrecognized format function type

with gcc 4.4 and GNUstep stuff.

Apart from that, the gcc documentation tells what types you can use in __attribute__ format
stuff. (Here when I do "info gcc", in the C Extensions -> Function Attributes it is
described and allowed stuff is:

`printf', `scanf', `strftime',
`gnu_printf', `gnu_scanf', `gnu_strftime' or `strfmon'.  (You can
also use `__printf__', `__scanf__', `__strftime__' or
`__strfmon__'.)  On MinGW targets, `ms_printf', `ms_scanf', and
`ms_strftime' are also present.
)

My .1 euros...

  reply	other threads:[~2010-03-09 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-09 13:45 Manfred Schwind
2010-03-09 15:05 ` Cedric Roux [this message]
2010-03-10 15:54 ` Ian Lance Taylor

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=4B96637C.1090509@acri-st.fr \
    --to=cedric.roux@acri-st.fr \
    --cc=gcc-help@gcc.gnu.org \
    --cc=lists@mani.de \
    /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).