You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/08/24 03:03:45 UTC

[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1987: nshlib/nsh_timcmds.c: Suppress warning about unused variable (errfmt)

xiaoxiang781216 commented on code in PR #1987:
URL: https://github.com/apache/nuttx-apps/pull/1987#discussion_r1303732524


##########
nshlib/nsh_timcmds.c:
##########
@@ -367,7 +367,7 @@ int cmd_time(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
 int cmd_date(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
 {
   FAR char *newtime = NULL;
-  FAR const char *errfmt;
+  FAR const char *errfmt unused_data;

Review Comment:
   @pussuw we can fix like this:
   ```
   #ifdef CONFIG_NSH_DISABLE_ERROR_PRINT 
   #  undef nsh_error 
   #  ifdef CONFIG_CPP_HAVE_VARARGS 
   #    define nsh_error(v, ...)   do { if (0) (v, ##__VA_ARGS__); } while (0)
   #  else 
   #    define nsh_error         (void)(vtbl) 
   #  endif 
   #endif
   ```
   like _none in debug.h:
   ```
   #ifdef CONFIG_CPP_HAVE_VARARGS
   /* don't call syslog while performing the compiler's format check. */
   
   #  define _none(format, ...) \
       do { if (0) syslog(LOG_ERR, format, ##__VA_ARGS__); } while (0)
   #else
   #  define _none       (void)
   #endif
   ```



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