time.h: Sprinkle strftime format attribute

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-01-04 02:19:45 +08:00 committed by archer
parent 0dc6990166
commit 985f33e42c
2 changed files with 6 additions and 1 deletions

View File

@ -155,6 +155,7 @@
# define printflike(a, b) __attribute__((__format__ (__printf__, a, b)))
# define sysloglike(a, b) __attribute__((__format__ (__syslog__, a, b)))
# define scanflike(a, b) __attribute__((__format__ (__scanf__, a, b)))
# define strftimelike(a) __attribute__((__format__ (__strftime__, a, 0)))
/* GCC does not use storage classes to qualify addressing */
@ -374,6 +375,7 @@
# define printflike(a, b)
# define sysloglike(a, b)
# define scanflike(a, b)
# define strftimelike(a)
/* The reentrant attribute informs SDCC that the function
* must be reentrant. In this case, SDCC will store input
@ -504,6 +506,7 @@
# define printflike(a, b)
# define sysloglike(a, b)
# define scanflike(a, b)
# define strftimelike(a)
/* REVISIT: */
@ -607,6 +610,7 @@
# define printflike(a, b)
# define sysloglike(a, b)
# define scanflike(a, b)
# define strftimelike(a)
# define FAR
# define NEAR
@ -665,6 +669,7 @@
# define printflike(a, b)
# define sysloglike(a, b)
# define scanflike(a, b)
# define strftimelike(a)
# define FAR
# define NEAR

View File

@ -215,7 +215,7 @@ FAR struct tm *localtime(FAR const time_t *timep);
FAR struct tm *localtime_r(FAR const time_t *timep, FAR struct tm *result);
size_t strftime(FAR char *s, size_t max, FAR const char *format,
FAR const struct tm *tm);
FAR const struct tm *tm) strftimelike(3);
FAR char *asctime(FAR const struct tm *tp);
FAR char *asctime_r(FAR const struct tm *tp, FAR char *buf);