You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/11/19 23:15:14 UTC

[GitHub] [incubator-nuttx] yamt commented on a change in pull request #2319: printf/scanf format checks

yamt commented on a change in pull request #2319:
URL: https://github.com/apache/incubator-nuttx/pull/2319#discussion_r527267409



##########
File path: include/stdio.h
##########
@@ -174,28 +176,36 @@ int    ungetc(int c, FAR FILE *stream);
  */
 
 void   perror(FAR const char *s);
-int    printf(FAR const IPTR char *fmt, ...);
+int    printf(FAR const IPTR char *fmt, ...) printflike(1, 2);
 int    putc(int c, FAR FILE *stream);
 int    putchar(int c);
 int    puts(FAR const IPTR char *s);
 int    rename(FAR const char *oldpath, FAR const char *newpath);
-int    sprintf(FAR char *buf, FAR const IPTR char *fmt, ...);
-int    asprintf(FAR char **ptr, FAR const IPTR char *fmt, ...);
+int    sprintf(FAR char *buf, FAR const IPTR char *fmt, ...)
+       printflike(2, 3);
+int    asprintf(FAR char **ptr, FAR const IPTR char *fmt, ...)
+       printflike(2, 3);
 int    snprintf(FAR char *buf, size_t size,
-         FAR const IPTR char *fmt, ...);
-int    sscanf(FAR const char *buf, FAR const IPTR char *fmt, ...);
+         FAR const IPTR char *fmt, ...) printflike(3, 4);
+int    sscanf(FAR const char *buf, FAR const IPTR char *fmt, ...)
+       scanflike(2, 3);
 
-int    scanf(FAR const IPTR char *fmt, ...);
-int    vasprintf(FAR char **ptr, FAR const IPTR char *fmt, va_list ap);
+int    scanf(FAR const IPTR char *fmt, ...) scanflike(1, 2);
+int    vasprintf(FAR char **ptr, FAR const IPTR char *fmt, va_list ap)
+       printflike(2, 0);
 int    vfprintf(FAR FILE *stream, FAR const IPTR char *fmt,
-         va_list ap);
-int    vfscanf(FAR FILE *stream, FAR const IPTR char *fmt, va_list ap);
-int    vprintf(FAR const IPTR char *fmt, va_list ap);
-int    vscanf(FAR const IPTR char *fmt, va_list ap);
+         va_list ap)
+       printflike(2, 0);

Review comment:
       done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org