diff --git a/src/common.h b/src/common.h index d52240e..a04e9f9 100644 --- a/src/common.h +++ b/src/common.h @@ -55,6 +55,22 @@ typedef unsigned long ulong; # define ATTR_PACKED(ref) #endif +#if defined(__clang__) +# define DO_PRAGMA__(text) _Pragma(#text) +# define DIAG_PUSH DO_PRAGMA__(clang diagnostic push) +# define DIAG_POP DO_PRAGMA__(clang diagnostic pop) +# define DIAG_DISABLE(text) DO_PRAGMA__(clang diagnostic ignored text) +#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) +# define DO_PRAGMA__(text) _Pragma(#text) +# define DIAG_PUSH DO_PRAGMA__(GCC diagnostic push) +# define DIAG_POP DO_PRAGMA__(GCC diagnostic pop) +# define DIAG_DISABLE(text) DO_PRAGMA__(GCC diagnostic ignored text) +#else +# define DIAG_PUSH +# define DIAG_POP +# define DIAG_DISABLE(text) +#endif + #if __GNUC__ >= 7 # define FALLTHROUGH __attribute__((fallthrough)); #else diff --git a/src/drv_imap.c b/src/drv_imap.c index 7eeff82..e49d040 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -2927,12 +2927,6 @@ imap_trash_msg( store_t *gctx, message_t *msg, static void imap_store_msg_p2( imap_store_t *, imap_cmd_t *, int ); -static size_t -my_strftime( char *s, size_t max, const char *fmt, const struct tm *tm ) -{ - return strftime( s, max, fmt, tm ); -} - static void imap_store_msg( store_t *gctx, msg_data_t *data, int to_trash, void (*cb)( int sts, uint uid, void *aux ), void *aux ) @@ -2971,7 +2965,10 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int to_trash, } if (data->date) { /* configure ensures that %z actually works. */ - my_strftime( datestr, sizeof(datestr), "%d-%b-%Y %H:%M:%S %z", localtime( &data->date ) ); +DIAG_PUSH +DIAG_DISABLE("-Wformat") + strftime( datestr, sizeof(datestr), "%d-%b-%Y %H:%M:%S %z", localtime( &data->date ) ); +DIAG_POP imap_exec( ctx, &cmd->gen, imap_store_msg_p2, "APPEND \"%\\s\" %s\"%\\s\" ", buf, flagstr, datestr ); } else {