You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/03/08 14:34:03 UTC

[incubator-nuttx] branch master updated (bfedbf1 -> d725623)

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

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


    from bfedbf1  arm/imx6: Enable setjmp test in ostest
     new 0c01f0c  libc/stdio: Add _s suffix for struct arg in lib_libvsprintf.c
     new 428ce93  libc/stdio: Skip fetch double argument if !CONFIG_LIBC_FLOATINGPOINT && CONFIG_LIBC_NUMBERED_ARGS
     new a2e9e83  libc/stdio: Don't fetch width/prec modifier in parser phase
     new 0e12bf1  libc/stdio: Make %p[V|S|s] work with CONFIG_LIBC_NUMBERED_ARGS
     new d725623  boards/sim/nsh: Enable ONFIG_LIBC_NUMBERED_ARGS and ONFIG_SCHED_BACKTRACE

The 5 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:
 boards/sim/sim/sim/configs/nsh/defconfig |   2 +
 libs/libc/stdio/lib_libvsprintf.c        | 138 +++++++++++++++----------------
 2 files changed, 70 insertions(+), 70 deletions(-)

[incubator-nuttx] 02/05: libc/stdio: Skip fetch double argument if !CONFIG_LIBC_FLOATINGPOINT && CONFIG_LIBC_NUMBERED_ARGS

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

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

commit 428ce93ee5d7f5e0719d393606aa19ab98632d75
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Mar 8 16:34:23 2022 +0800

    libc/stdio: Skip fetch double argument if !CONFIG_LIBC_FLOATINGPOINT && CONFIG_LIBC_NUMBERED_ARGS
    
    since the argument is already fetched by lib_vsprintf in this case
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libc/stdio/lib_libvsprintf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c
index 7d34427..7d449cb 100644
--- a/libs/libc/stdio/lib_libvsprintf.c
+++ b/libs/libc/stdio/lib_libvsprintf.c
@@ -937,7 +937,9 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
 #else /* !CONFIG_LIBC_FLOATINGPOINT */
       if ((c >= 'E' && c <= 'G') || (c >= 'e' && c <= 'g'))
         {
+#  ifndef CONFIG_LIBC_NUMBERED_ARGS
           va_arg(ap, double);
+#  endif
           pnt  = "*float*";
           size = sizeof("*float*") - 1;
           goto str_lpad;

[incubator-nuttx] 01/05: libc/stdio: Add _s suffix for struct arg in lib_libvsprintf.c

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

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

commit 0c01f0ce5a8c8179d18d5ab7e40199829da00f29
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Mar 8 15:14:53 2022 +0800

    libc/stdio: Add _s suffix for struct arg in lib_libvsprintf.c
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libc/stdio/lib_libvsprintf.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c
index 0c13d35..7d34427 100644
--- a/libs/libc/stdio/lib_libvsprintf.c
+++ b/libs/libc/stdio/lib_libvsprintf.c
@@ -124,7 +124,7 @@
  * Private Types
  ****************************************************************************/
 
-struct arg
+struct arg_s
 {
   unsigned char type;
   union
@@ -150,7 +150,7 @@ static const char g_nullstring[] = "(null)";
  ****************************************************************************/
 
 static int vsprintf_internal(FAR struct lib_outstream_s *stream,
-                             FAR struct arg *arglist, int numargs,
+                             FAR struct arg_s *arglist, int numargs,
                              FAR const IPTR char *fmt, va_list ap);
 
 /****************************************************************************
@@ -175,7 +175,7 @@ static int sprintf_internal(FAR struct lib_outstream_s *stream,
 #endif
 
 static int vsprintf_internal(FAR struct lib_outstream_s *stream,
-                             FAR struct arg *arglist, int numargs,
+                             FAR struct arg_s *arglist, int numargs,
                              FAR const IPTR char *fmt, va_list ap)
 {
   unsigned char c; /* Holds a char from the format string */
@@ -203,9 +203,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
   int total_len = 0;
 
 #ifdef CONFIG_LIBC_NUMBERED_ARGS
-
   int argnumber;
-
 #endif
 
   for (; ; )
@@ -297,8 +295,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
                     {
                       int index;
 
-                      flags    &= ~FL_ASTERISK;
-
+                      flags &= ~FL_ASTERISK;
                       if ((flags & FL_PREC) == 0)
                         {
                           index = width;
@@ -559,7 +556,6 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
         }
 
 #ifdef CONFIG_LIBC_NUMBERED_ARGS
-
       if ((flags & FL_ARGNUMBER) != 0)
         {
           if (argnumber > 0 && argnumber <= numargs)
@@ -612,7 +608,6 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
         {
           continue; /* We do only parsing */
         }
-
 #endif
 
 #ifdef CONFIG_LIBC_FLOATINGPOINT
@@ -964,7 +959,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
 #else
           buf[0] = va_arg(ap, int);
 #endif
-          pnt = (FAR char *) buf;
+          pnt = (FAR char *)buf;
           size = 1;
           goto str_lpad;
 
@@ -1319,7 +1314,6 @@ tail:
     }
 
 ret:
-
   return total_len;
 }
 
@@ -1331,9 +1325,9 @@ int lib_vsprintf(FAR struct lib_outstream_s *stream,
                  FAR const IPTR char *fmt, va_list ap)
 {
 #ifdef CONFIG_LIBC_NUMBERED_ARGS
-  int i;
-  struct arg arglist[NL_ARGMAX];
+  struct arg_s arglist[NL_ARGMAX];
   int numargs;
+  int i;
 
   /* We do 2 passes of parsing and fill the arglist between the passes. */
 
@@ -1348,6 +1342,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *stream,
           arglist[i].value.ull = va_arg(ap, unsigned long long);
           break;
 #endif
+
         case TYPE_LONG:
           arglist[i].value.ul = va_arg(ap, unsigned long);
           break;
@@ -1367,10 +1362,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *stream,
     }
 
   return vsprintf_internal(stream, arglist, numargs, fmt, ap);
-
 #else
-
   return vsprintf_internal(stream, NULL, 0, fmt, ap);
-
 #endif
 }

[incubator-nuttx] 03/05: libc/stdio: Don't fetch width/prec modifier in parser phase

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

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

commit a2e9e83956961ae354b981d831d81a1bd768f432
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Mar 8 17:47:22 2022 +0800

    libc/stdio: Don't fetch width/prec modifier in parser phase
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libc/stdio/lib_libvsprintf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c
index 7d449cb..c6a5c71 100644
--- a/libs/libc/stdio/lib_libvsprintf.c
+++ b/libs/libc/stdio/lib_libvsprintf.c
@@ -363,6 +363,10 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
                       flags |= FL_ASTERISK;
                       continue;
                     }
+                  else if (stream == NULL)
+                    {
+                      continue; /* We do only parsing */
+                    }
 #endif
 
                   if ((flags & FL_PREC) != 0)

[incubator-nuttx] 04/05: libc/stdio: Make %p[V|S|s] work with CONFIG_LIBC_NUMBERED_ARGS

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

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

commit 0e12bf167b45162f6f81865de6d4b0a7dda61d24
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Mar 8 17:06:46 2022 +0800

    libc/stdio: Make %p[V|S|s] work with CONFIG_LIBC_NUMBERED_ARGS
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libc/stdio/lib_libvsprintf.c | 108 +++++++++++++++++++-------------------
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c
index c6a5c71..8588e89 100644
--- a/libs/libc/stdio/lib_libvsprintf.c
+++ b/libs/libc/stdio/lib_libvsprintf.c
@@ -488,60 +488,6 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
 
       if (c == 'p')
         {
-          unsigned char sub_c = fmt_char(fmt);
-
-          switch (sub_c)
-            {
-              case 'V':
-                {
-                  FAR struct va_format *vaf = va_arg(ap, void *);
-#ifdef va_copy
-                  va_list copy;
-
-                  va_copy(copy, *vaf->va);
-                  vsprintf_internal(stream, NULL, 0, vaf->fmt, copy);
-                  va_end(copy);
-#else
-                  vsprintf_internal(stream, NULL, 0, vaf->fmt, *vaf->va);
-#endif
-                  continue;
-                }
-#ifdef CONFIG_ALLSYMS
-
-              case 'S':
-              case 's':
-                {
-                  FAR const struct symtab_s *symbol;
-                  FAR void *addr = va_arg(ap, FAR void *);
-                  size_t symbolsize;
-
-                  symbol = allsyms_findbyvalue(addr, &symbolsize);
-                  if (symbol)
-                    {
-                      pnt = symbol->sym_name;
-                      while (*pnt)
-                        {
-                          putc(*pnt++, stream);
-                        }
-
-                      if (sub_c == 'S')
-                        {
-                          sprintf_internal(stream, "+%#x/%#x",
-                                           addr - symbol->sym_value,
-                                           symbolsize);
-                        }
-
-                      continue;
-                    }
-                }
-#endif
-
-              default:
-                {
-                  fmt_ungetc(fmt);
-                }
-            }
-
           /* Determine size of pointer and set flags accordingly */
 
           flags &= ~(FL_LONG | FL_REPD_TYPE);
@@ -1177,6 +1123,60 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
               break;
 
             case 'p':
+              c = fmt_char(fmt);
+              switch (c)
+                {
+                  case 'V':
+                    {
+                      FAR struct va_format *vaf = (FAR void *)(uintptr_t)x;
+#ifdef va_copy
+                      va_list copy;
+
+                      va_copy(copy, *vaf->va);
+                      lib_vsprintf(stream, vaf->fmt, copy);
+                      va_end(copy);
+#else
+                      lib_vsprintf(stream, vaf->fmt, *vaf->va);
+#endif
+                      continue;
+                    }
+
+#ifdef CONFIG_ALLSYMS
+                  case 'S':
+                  case 's':
+                    {
+                      FAR const struct symtab_s *symbol;
+                      FAR void *addr = (FAR void *)(uintptr_t)x;
+                      size_t symbolsize;
+
+                      symbol = allsyms_findbyvalue(addr, &symbolsize);
+                      if (symbol != NULL)
+                        {
+                          pnt = symbol->sym_name;
+                          while (*pnt != '\0')
+                            {
+                              putc(*pnt++, stream);
+                            }
+
+                          if (c == 'S')
+                            {
+                              sprintf_internal(stream, "+%#x/%#x",
+                                               addr - symbol->sym_value,
+                                               symbolsize);
+                            }
+
+                          continue;
+                        }
+
+                      break;
+                    }
+#endif
+
+                  default:
+                    fmt_ungetc(fmt);
+                    break;
+                }
+
               flags |= FL_ALT;
 
               /* no break */

[incubator-nuttx] 05/05: boards/sim/nsh: Enable ONFIG_LIBC_NUMBERED_ARGS and ONFIG_SCHED_BACKTRACE

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

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

commit d72562328c89869cb6934c42342ef6264ca68626
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Mar 8 17:14:46 2022 +0800

    boards/sim/nsh: Enable ONFIG_LIBC_NUMBERED_ARGS and ONFIG_SCHED_BACKTRACE
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 boards/sim/sim/sim/configs/nsh/defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/boards/sim/sim/sim/configs/nsh/defconfig b/boards/sim/sim/sim/configs/nsh/defconfig
index 987df2c..85dc828 100644
--- a/boards/sim/sim/sim/configs/nsh/defconfig
+++ b/boards/sim/sim/sim/configs/nsh/defconfig
@@ -41,6 +41,7 @@ CONFIG_LIBC_EXECFUNCS=y
 CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_LOCALE_CATALOG=y
 CONFIG_LIBC_LOCALE_GETTEXT=y
+CONFIG_LIBC_NUMBERED_ARGS=y
 CONFIG_NSH_ARCHINIT=y
 CONFIG_NSH_ARCHROMFS=y
 CONFIG_NSH_BUILTIN_APPS=y
@@ -57,6 +58,7 @@ CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
 CONFIG_PSEUDOFS_ATTRIBUTES=y
 CONFIG_PSEUDOFS_SOFTLINKS=y
 CONFIG_READLINE_TABCOMPLETION=y
+CONFIG_SCHED_BACKTRACE=y
 CONFIG_SCHED_HAVE_PARENT=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_ONEXIT=y