public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Declaring a function to be of wprintf style
@ 2022-09-22 16:24 Lee Shallis
  0 siblings, 0 replies; only message in thread
From: Lee Shallis @ 2022-09-22 16:24 UTC (permalink / raw)
  To: GCC Help

I attempted this:

#ifdef __GNUC__
#define PAW__ATTR_PRINTF(ARGS_POS,VA_POS) \
    __attribute__((format (printf, ARGS_POS, VA_POS)))
#define PAW__ATTR_WPRINTF(ARGS_POS,VA_POS) \
    __attribute__((format (wprintf, ARGS_POS, VA_POS)))
#else
#define PAW__ATTR_PRINTF(ARGS_POS,VA_POS)
#define PAW__ATTR_WPRINTF(ARGS_POS,VA_POS)
#endif

#ifdef _DEBUG
#define PAW_ATTR_PRINTF(ARGS_POS,VA_POS) PAW__ATTR_PRINTF(ARGS_POS,VA_POS)
#define PAW_ATTR_WPRINTF(ARGS_POS,VA_POS) PAW__ATTR_WPRINTF(ARGS_POS,VA_POS)
#else
#define PAW_ATTR_PRINTF(ARGS_POS,VA_POS)
#define PAW_ATTR_WPRINTF(ARGS_POS,VA_POS)
#endif

But gcc gave this "error: ‘wprintf’ is an unrecognized format function
type", I also tried just printf but then it complained the args
parameter was not of char const *

Is there anyway to declare it to be of that style and if so is there a
way to extend what it checks for as I have some custom modifiers for
the string types & and some extra specifiers, 3 of which can change
what is expected to be found in the args, namely what options are
sought out, what modifiers are sought out and what specifiers are
sought out, I would greatly appreciate being able to get my arguments
checked for type mis-matches in the default scenarios during compile
time

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-22 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 16:24 Declaring a function to be of wprintf style Lee Shallis

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).