[systemd-devel] [PATCH 4/4] cgtop: support time header with user-specified format string
filbranden at google.com
Wed May 27 16:58:35 PDT 2015
On Wed, May 27, 2015 at 3:40 PM, Charles Duffy <charles at 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
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
More information about the systemd-devel