commit b7069e59f7cae129104e1c4735be98ca7470fbd1 Author: Oswald Buddenhagen <o...@users.sf.net> Date: Sun Jul 28 20:42:04 2019 +0200
fix strftime() format string warning properly the workaround for -Wformat triggered -Wformat-nonliteral in turn. so instead go back to using pragmas and add a proper gcc version check. amends/reverts 55e65147. src/common.h | 11 +++++++++++ src/drv_imap.c | 11 ++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/common.h b/src/common.h index d52240e..a383c3c 100644 --- a/src/common.h +++ b/src/common.h @@ -55,6 +55,17 @@ typedef unsigned long ulong; # define ATTR_PACKED(ref) #endif +#if __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 9ee95f7..5620aa9 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -2893,12 +2893,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 ) @@ -2937,7 +2931,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 { _______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel