added attribute printf checks to printf like functions (when using gcc)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -487,11 +487,13 @@ WXDLLEXPORT const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0);
|
|||||||
#define DECLARE_LOG_FUNCTION(level) \
|
#define DECLARE_LOG_FUNCTION(level) \
|
||||||
extern void WXDLLEXPORT wxVLog##level(const wxChar *szFormat, \
|
extern void WXDLLEXPORT wxVLog##level(const wxChar *szFormat, \
|
||||||
va_list argptr); \
|
va_list argptr); \
|
||||||
extern void WXDLLEXPORT wxLog##level(const wxChar *szFormat, ...)
|
extern void WXDLLEXPORT wxLog##level(const wxChar *szFormat, \
|
||||||
|
...) ATTRIBUTE_PRINTF_1
|
||||||
#define DECLARE_LOG_FUNCTION2(level, arg1) \
|
#define DECLARE_LOG_FUNCTION2(level, arg1) \
|
||||||
extern void WXDLLEXPORT wxVLog##level(arg1, const wxChar *szFormat, \
|
extern void WXDLLEXPORT wxVLog##level(arg1, const wxChar *szFormat, \
|
||||||
va_list argptr); \
|
va_list argptr); \
|
||||||
extern void WXDLLEXPORT wxLog##level(arg1, const wxChar *szFormat, ...)
|
extern void WXDLLEXPORT wxLog##level(arg1, const wxChar *szFormat, \
|
||||||
|
...) ATTRIBUTE_PRINTF_2
|
||||||
|
|
||||||
#else // !wxUSE_LOG
|
#else // !wxUSE_LOG
|
||||||
|
|
||||||
|
@@ -330,8 +330,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Output a debug message, in a system dependent fashion.
|
// Output a debug message, in a system dependent fashion.
|
||||||
void WXDLLEXPORT wxTrace(const wxChar *fmt ...);
|
void WXDLLEXPORT wxTrace(const wxChar *fmt ...) ATTRIBUTE_PRINTF_1;
|
||||||
void WXDLLEXPORT wxTraceLevel(int level, const wxChar *fmt ...);
|
void WXDLLEXPORT wxTraceLevel(int level, const wxChar *fmt ...) ATTRIBUTE_PRINTF_2;
|
||||||
|
|
||||||
#define WXTRACE wxTrace
|
#define WXTRACE wxTrace
|
||||||
#define WXTRACELEVEL wxTraceLevel
|
#define WXTRACELEVEL wxTraceLevel
|
||||||
|
@@ -168,11 +168,13 @@ inline int Stricmp(const char *psz1, const char *psz2)
|
|||||||
// wxSnprintf() is like snprintf() if it's available and sprintf() (always
|
// wxSnprintf() is like snprintf() if it's available and sprintf() (always
|
||||||
// available, but dangerous!) if not
|
// available, but dangerous!) if not
|
||||||
extern int WXDLLEXPORT wxSnprintf(wxChar *buf, size_t len,
|
extern int WXDLLEXPORT wxSnprintf(wxChar *buf, size_t len,
|
||||||
const wxChar *format, ...);
|
const wxChar *format,
|
||||||
|
...) ATTRIBUTE_PRINTF_3;
|
||||||
|
|
||||||
// and wxVsnprintf() is like vsnprintf() or vsprintf()
|
// and wxVsnprintf() is like vsnprintf() or vsprintf()
|
||||||
extern int WXDLLEXPORT wxVsnprintf(wxChar *buf, size_t len,
|
extern int WXDLLEXPORT wxVsnprintf(wxChar *buf, size_t len,
|
||||||
const wxChar *format, va_list argptr);
|
const wxChar *format,
|
||||||
|
va_list argptr);
|
||||||
|
|
||||||
// return an empty wxString
|
// return an empty wxString
|
||||||
class WXDLLEXPORT wxString; // not yet defined
|
class WXDLLEXPORT wxString; // not yet defined
|
||||||
@@ -718,12 +720,13 @@ public:
|
|||||||
|
|
||||||
// formated input/output
|
// formated input/output
|
||||||
// as sprintf(), returns the number of characters written or < 0 on error
|
// as sprintf(), returns the number of characters written or < 0 on error
|
||||||
int Printf(const wxChar *pszFormat, ...);
|
// (take 'this' into account in attribute parameter count)
|
||||||
|
int Printf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2;
|
||||||
// as vprintf(), returns the number of characters written or < 0 on error
|
// as vprintf(), returns the number of characters written or < 0 on error
|
||||||
int PrintfV(const wxChar* pszFormat, va_list argptr);
|
int PrintfV(const wxChar* pszFormat, va_list argptr);
|
||||||
|
|
||||||
// returns the string containing the result of Printf() to it
|
// returns the string containing the result of Printf() to it
|
||||||
static wxString Format(const wxChar *pszFormat, ...);
|
static wxString Format(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_1;
|
||||||
// the same as above, but takes a va_list
|
// the same as above, but takes a va_list
|
||||||
static wxString FormatV(const wxChar *pszFormat, va_list argptr);
|
static wxString FormatV(const wxChar *pszFormat, va_list argptr);
|
||||||
|
|
||||||
@@ -751,8 +754,9 @@ public:
|
|||||||
// values for first parameter of Strip function
|
// values for first parameter of Strip function
|
||||||
enum stripType {leading = 0x1, trailing = 0x2, both = 0x3};
|
enum stripType {leading = 0x1, trailing = 0x2, both = 0x3};
|
||||||
|
|
||||||
// use Printf()
|
// use Printf()
|
||||||
int sprintf(const wxChar *pszFormat, ...);
|
// (take 'this' into account in attribute parameter count)
|
||||||
|
int sprintf(const wxChar *pszFormat, ...) ATTRIBUTE_PRINTF_2;
|
||||||
|
|
||||||
// use Cmp()
|
// use Cmp()
|
||||||
inline int CompareTo(const wxChar* psz, caseCompare cmp = exact) const
|
inline int CompareTo(const wxChar* psz, caseCompare cmp = exact) const
|
||||||
|
Reference in New Issue
Block a user