Generalize WX_ATTRIBUTE_PRINTF to WX_ATTRIBUTE_FORMAT
Allow applying gcc "format" attribute to other functions and do apply it to wxStrftime(). Also suppress -Wformat-nonliteral inside wxStrftime() itself, as it's now supposed to be checked when calling it.
This commit is contained in:
@@ -1052,9 +1052,16 @@ inline wchar_t* wxGetenv(const wxScopedWCharBuffer& name) { return wxCRT_GetenvW
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||
WX_ATTRIBUTE_FORMAT(__strftime__, 3, 4)
|
||||
inline size_t wxStrftime(char *s, size_t max,
|
||||
const wxString& format, const struct tm *tm)
|
||||
{ return wxCRT_StrftimeA(s, max, format.mb_str(), tm); }
|
||||
{
|
||||
wxGCC_ONLY_WARNING_SUPPRESS(format-nonliteral)
|
||||
|
||||
return wxCRT_StrftimeA(s, max, format.mb_str(), tm);
|
||||
|
||||
wxGCC_ONLY_WARNING_RESTORE(format-nonliteral)
|
||||
}
|
||||
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||
|
||||
inline size_t wxStrftime(wchar_t *s, size_t max,
|
||||
|
Reference in New Issue
Block a user