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/17 06:53:18 UTC

[GitHub] [incubator-nuttx] yamt opened a new pull request #2319: Printflike3

yamt opened a new pull request #2319:
URL: https://github.com/apache/incubator-nuttx/pull/2319


   ## Summary
   printflike stuff separated from https://github.com/apache/incubator-nuttx/pull/2222
   ## Impact
   
   ## Testing
   
   


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2319:
URL: https://github.com/apache/incubator-nuttx/pull/2319#discussion_r526804987



##########
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:
       merge to line 197?




----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #2319:
URL: https://github.com/apache/incubator-nuttx/pull/2319#issuecomment-730696998


   > Does it make more sense to merge into one patch or two(one for printflike, another scanflike)?
   
   for me, smaller patches are easier to manage. (revert, cherry-pick, etc)
   


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2319: printf/scanf format checks

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2319:
URL: https://github.com/apache/incubator-nuttx/pull/2319#issuecomment-730320879


   Does it make more sense to merge into one patch or two(one for printflike, another scanflike)?


----------------------------------------------------------------
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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #2319: printf/scanf format checks

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #2319:
URL: https://github.com/apache/incubator-nuttx/pull/2319


   


----------------------------------------------------------------
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