From: Gilles Depeyrot Date: Fri, 21 Jun 2002 21:37:00 +0000 (+0000) Subject: added macro definitions for printf like function checks when using gcc X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/58863a9e3400d36eb65e2741e55c075a7e4d4798 added macro definitions for printf like function checks when using gcc git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/defs.h b/include/wx/defs.h index 666ab31808..ea7a3722ae 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -427,6 +427,27 @@ class WXDLLEXPORT wxEvent; typedef void (*wxFunction) (wxObject&, wxEvent&); #endif +// Printf-like attribute definitions to obtain warnings with GNU C/C++ +#if defined(__GNUC__) +# ifndef ATTRIBUTE_PRINTF +# define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +# define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) +# define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) +# define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) +# define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) +# define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) +# endif /* ATTRIBUTE_PRINTF */ +#else +# ifndef ATTRIBUTE_PRINTF +# define ATTRIBUTE_PRINTF +# define ATTRIBUTE_PRINTF_1 +# define ATTRIBUTE_PRINTF_2 +# define ATTRIBUTE_PRINTF_3 +# define ATTRIBUTE_PRINTF_4 +# define ATTRIBUTE_PRINTF_5 +# endif /* ATTRIBUTE_PRINTF */ +#endif + // ---------------------------------------------------------------------------- // OS mnemonics -- Identify the running OS (useful for Windows) // ----------------------------------------------------------------------------