This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
extending archtypes: __attribute__((format(__sqlite__, 2, 6)))
- From: kevin lyda <kevin at ie dot suberic dot net>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 7 Mar 2005 08:22:46 +0000
- Subject: extending archtypes: __attribute__((format(__sqlite__, 2, 6)))
- Reply-to: kevin lyda <kevin+dated+1110615768 dot 362d7c at ie dot suberic dot net>
the sqlite c api has the following function (and several like it):
int sqlite_exec_printf(sqlite*,
char *sql,
int (*)(void*,int,char**,char**),
void*,
char **errmsg,
...);
it would be nice if the header file prototyped it like so:
int sqlite_exec_printf(sqlite*,
char *sql,
int (*)(void*,int,char**,char**),
void*,
char **errmsg,
...) __attribute__((format(__printf__, 2, 6)));
for me, that catches quite a few annoying errors at compile time.
however i have to play tricks with sed to get this to actually do this
checking because the sqlite functions create two new function
specifiers: %q and %Q. they do the proper escapes for strings in sql
(for idiot testing i change %[Qq] to %s and use a different sqlite.h
file with the __attribute__ bit in it).
it would be nice to be able to extend the current format archtypes.
maybe something like this:
int sqlite_exec_printf(sqlite*,
char *sql,
int (*)(void*,int,char**,char**),
void*,
char **errmsg,
...) __attribute__((format(
__printf_extend__("Q", char *, "q", char *),
2, 6)));
is there any interest in this? if i was to come up with a patch that
accomplished this, would it have a chance of acceptance? is there a
better syntax that people might suggest?
kevin
--
kevin lyda ~ dems for torture: salazar(co/10) landrieu(la/08) pryor(ar/08)
kevin@ie.suberic.net ~ nelson(fl/06) nelson(ne/06) lieberman(ct/06) 2/2/04
Those who refuse to raise their voices against something as clearly evil
as torture are enablers, if not collaborators. --Bob Herbert, 2/11/04