mirror of
https://github.com/ipmitool/ipmitool.git
synced 2026-06-03 20:51:36 +00:00
Fix strftime() non-literal argument warning
There is a bug in gcc since 4.3.2 and still not fixed in 8.1.0. Even if __attribute__((format(strftime... is specified for a wrapper function around strftime, gcc still complains about strftime being called from the wrapper with a "non-literal" format argument. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438 This commit adds 'ugly hacks' from that discussion to call strftime() from strftime-formatted wrappers and silence the warnings. Partially resolves ipmitool/ipmitool#23 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
@@ -75,10 +75,12 @@ typedef char ipmi_datebuf_t[IPMI_ASCTIME_SZ];
|
||||
* in account the command line options
|
||||
*/
|
||||
char *ipmi_asctime_r(time_t stamp, ipmi_datebuf_t outbuf);
|
||||
size_t ipmi_strftime(char *s, int max, const char *format, time_t stamp);
|
||||
size_t ipmi_strftime(char *s, size_t max, const char *format, time_t stamp)
|
||||
__attribute__((format(strftime, 3, 0)));
|
||||
|
||||
/* These return pointers to static arrays and aren't thread safe */
|
||||
char *ipmi_timestamp_fmt(uint32_t stamp, const char *fmt);
|
||||
char *ipmi_timestamp_fmt(uint32_t stamp, const char *fmt)
|
||||
__attribute__((format(strftime, 2, 0)));
|
||||
char *ipmi_timestamp_string(uint32_t stamp); /* Day Mon DD HH:MM:SS YYYY ZZZ */
|
||||
char *ipmi_timestamp_numeric(uint32_t stamp); /* MM/DD/YYYY HH:MM:SS ZZZ */
|
||||
char *ipmi_timestamp_date(uint32_t stamp); /* MM/DD/YYYY ZZZ */
|
||||
|
||||
Reference in New Issue
Block a user