Hi,

On Wed, May 27, 2015 at 3:40 PM, Charles Duffy <char...@dyfis.net> wrote:
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wformat-nonliteral"
> +        time_len = strftime(buf, l, arg_time_format, curr_time);
> +        if (time_len <= 0)
> +                return;
> +#pragma GCC diagnostic pop

You could instead use gcc's __attribute__ ((format (strftime, ...)))
to indicate that arg_time_format is supposed to be a valid strftime
format.

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bflatten_007d-function-attribute-3080

See also the definition of _printf_ in src/shared/macro.h and its uses.

Though I'm not sure whether taking a strftime format as a command line
argument is really a good idea... But I'll defer that to other
reviewers.

Cheers,
Filipe
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to