You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/25 09:18:41 UTC

[nuttx-apps] branch master updated (1274aa5c8 -> 94d477b3d)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


    from 1274aa5c8 mbedtls: mbedtls_selftest depends on MBEDTLS_SSL_DTLS_CONNECTION_ID
     new 1668c3e97 Revert "nshlib/nsh_timcmds.c: Suppress warning about unused variable (errfmt)"
     new 94d477b3d nshlib/nsh_console.h: Add nsh_none, where any empty output can be forwarded

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nshlib/nsh_console.h | 30 +++++++++++++++++++++---------
 nshlib/nsh_timcmds.c |  2 +-
 2 files changed, 22 insertions(+), 10 deletions(-)


[nuttx-apps] 02/02: nshlib/nsh_console.h: Add nsh_none, where any empty output can be forwarded

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 94d477b3dfcefd0cd2719cb78dbad07f3f633086
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Thu Aug 24 13:26:20 2023 +0300

    nshlib/nsh_console.h: Add nsh_none, where any empty output can be forwarded
    
    Add nsh_none to consume all empty traces from nsh.
    
    For the variadic argument case need to add a (inline) function to eat
    away the __VA_ARGS__ list, there is no good / portable way to do this by
    pre-processor macros, but a function will eat the variadic list whatever
    its size is.
---
 nshlib/nsh_console.h | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/nshlib/nsh_console.h b/nshlib/nsh_console.h
index a9a382045..adea4b455 100644
--- a/nshlib/nsh_console.h
+++ b/nshlib/nsh_console.h
@@ -51,20 +51,19 @@
 #define nsh_exit(v,s)          (v)->exit(v,s)
 
 #ifdef CONFIG_CPP_HAVE_VARARGS
-#  define nsh_error(v, ...)     (v)->error(v, ##__VA_ARGS__)
-#  define nsh_output(v, ...)    (v)->output(v, ##__VA_ARGS__)
+#  define nsh_error(v, ...)    (v)->error(v, ##__VA_ARGS__)
+#  define nsh_output(v, ...)   (v)->output(v, ##__VA_ARGS__)
+#  define nsh_none(v, ...)     \
+     do { if (0) nsh_output_none(v, ##__VA_ARGS__); } while (0)
 #else
-#  define nsh_error             vtbl->error
-#  define nsh_output            vtbl->output
+#  define nsh_error            vtbl->error
+#  define nsh_output           vtbl->output
+#  define nsh_none             (void)
 #endif
 
 #ifdef CONFIG_NSH_DISABLE_ERROR_PRINT
 #  undef nsh_error
-#  ifdef CONFIG_CPP_HAVE_VARARGS
-#    define nsh_error(v, ...) (void)(v)
-#  else
-#    define nsh_error         (void)(vtbl)
-#  endif
+#  define nsh_error            nsh_none
 #endif
 
 /* Size of info to be saved in call to nsh_redirect
@@ -183,6 +182,19 @@ struct console_stdio_s
  * Public Data
  ****************************************************************************/
 
+/****************************************************************************
+ * Inline functions
+ ****************************************************************************/
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+/* Can be used to suppress any nsh output */
+
+static inline void nsh_output_none(FAR struct nsh_vtbl_s *vtbl, ...)
+{
+  UNUSED(vtbl);
+}
+#endif
+
 /****************************************************************************
  * Public Function Prototypes
  ****************************************************************************/


[nuttx-apps] 01/02: Revert "nshlib/nsh_timcmds.c: Suppress warning about unused variable (errfmt)"

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 1668c3e97dd6e4397bf5d64dae6caf94ecb4900a
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Thu Aug 24 13:20:08 2023 +0300

    Revert "nshlib/nsh_timcmds.c: Suppress warning about unused variable (errfmt)"
    
    This reverts commit 4ca9b518fa9923c1af9c120eafbac59359874e13.
---
 nshlib/nsh_timcmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nshlib/nsh_timcmds.c b/nshlib/nsh_timcmds.c
index 20681e488..19d53ebc1 100644
--- a/nshlib/nsh_timcmds.c
+++ b/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 unused_data;
+  FAR const char *errfmt;
   bool utc = false;
   int option;
   int ret;