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 2022/11/19 16:04:46 UTC

[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1426: Fix clang compiler warning

pkarashchenko commented on code in PR #1426:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1426#discussion_r1027109606


##########
examples/dac/dac_main.c:
##########
@@ -110,15 +110,15 @@ static void print_cmds(FAR const char *header,
                        size_t ncmds,
                        FAR const char *trailer)
 {
-  printf(header);
+  printf("%s", header);

Review Comment:
   Sorry, but what was the warning here? The `header` seems to be `const char*`



##########
examples/foc/foc_fixed16_thr.c:
##########
@@ -185,9 +185,10 @@ int foc_fixed16_thr(FAR struct foc_ctrl_env_s *envp)
   struct foc_mq_s         handle;
   struct foc_motor_b16_s  motor;
   struct foc_device_s     dev;
-  int                     time      = 0;
-  int                     ret       = OK;
+  int                     time = 0;

Review Comment:
   Maybe
   ```suggestion
   #ifdef FOC_STATE_PRINT_PRE
     int                     time = 0;
   #endif
   ```
   instead?



##########
examples/dac/dac_main.c:
##########
@@ -110,15 +110,15 @@ static void print_cmds(FAR const char *header,
                        size_t ncmds,
                        FAR const char *trailer)
 {
-  printf(header);
+  printf("%s", header);
   while (ncmds--)
     {
       printf("  %s %s %c", cmds->name, cmds->args,
                            (ncmds > 0) ? '\n' : ' ');
       cmds++;
     }
 
-  printf(trailer);
+  printf("%s", trailer);

Review Comment:
   ditto



##########
examples/foc/foc_float_thr.c:
##########
@@ -186,9 +186,10 @@ int foc_float_thr(FAR struct foc_ctrl_env_s *envp)
   struct foc_mq_s         handle;
   struct foc_motor_f32_s  motor;
   struct foc_device_s     dev;
-  int                     time      = 0;
-  int                     ret       = OK;
+  int                     time = 0;

Review Comment:
   ditto



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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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