You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/13 14:32:50 UTC

[incubator-nuttx-apps] branch master updated (58085e5 -> 8fd8aad)

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

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


    from 58085e5  Run nxstyle against files modified in previous commit.
     new 5720d72  apps: Fix the nightly build warning
     new 8fd8aad  Fix nxstyle warning

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:
 include/graphics/twm4nx/cwindow.hxx |  10 +++
 interpreters/bas/bas.c              | 156 +++++++++++++++++++++---------------
 interpreters/bas/bas_fs.c           |  62 +++++++-------
 interpreters/bas/bas_token.c        |  84 -------------------
 nshlib/nsh_envcmds.c                |  30 ++++---
 nshlib/nsh_netcmds.c                |   8 +-
 6 files changed, 155 insertions(+), 195 deletions(-)


[incubator-nuttx-apps] 01/02: apps: Fix the nightly build warning

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

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

commit 5720d72b71c88af98a1dbd52f0cc4d4a9505c011
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Mar 9 00:13:09 2020 +0800

    apps: Fix the nightly build warning
    
    src/cwindowfactory.cxx: In member function 'void Twm4Nx::CWindowFactory::redrawIcons(const nxgl_rect_s*)':
    src/cwindowfactory.cxx:461:38: warning: 'iconPos.nxgl_point_s::y' may be used uninitialized in this function [-Wmaybe-uninitialized]
      461 |           iconBounds.pt2.y = iconPos.y + iconSize.h - 1;
          |                              ~~~~~~~~^
    src/cwindowfactory.cxx:460:38: warning: 'iconPos.nxgl_point_s::x' may be used uninitialized in this function [-Wmaybe-uninitialized]
      460 |           iconBounds.pt2.x = iconPos.x + iconSize.w - 1;
          |                              ~~~~~~~~^
    
    nsh_netcmds.c:424:20: warning: 'nsh_addrconv' defined but not used [-Wunused-function]
     static inline bool nsh_addrconv(FAR const char *hwstr,
                        ^
    nsh_netcmds.c:446:20: warning: 'nsh_sethwaddr' defined but not used [-Wunused-function]
     static inline void nsh_sethwaddr(FAR const char *ifname,
                        ^
    
    nsh_envcmds.c:94:21: warning: 'nsh_getdirpath' defined but not used [-Wunused-function]
     static inline char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
                         ^
    
    In file included from bas.c:84:0:
    bas.c: In function 'bas_interpreter':
    bas_error.h:110:37: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     #define NOSUCHLINE         STATIC+40, _("No such line")
                                         ^
    bas.c:2425:52: note: in expansion of macro 'NOSUCHLINE'
                               FS_putChars(STDCHANNEL, (NOSUCHLINE));
                                                        ^~~~~~~~~~
    bas_fs.c:107:22: warning: 'g_vt100_colormap' defined but not used [-Wunused-const-variable=]
     static const uint8_t g_vt100_colormap[8] =
                          ^~~~~~~~~~~~~~~~
    <stdout>:4048:16: warning: 'input' defined but not used [-Wunused-function]
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: I62610b4c90e67637250cbd0107c2935c8abc542f
---
 include/graphics/twm4nx/cwindow.hxx | 10 +++++
 interpreters/bas/bas.c              |  2 +-
 interpreters/bas/bas_fs.c           |  8 ----
 interpreters/bas/bas_token.c        | 84 -------------------------------------
 nshlib/nsh_envcmds.c                |  2 +
 nshlib/nsh_netcmds.c                |  4 +-
 6 files changed, 15 insertions(+), 95 deletions(-)

diff --git a/include/graphics/twm4nx/cwindow.hxx b/include/graphics/twm4nx/cwindow.hxx
index 26c13b3..807d21d 100644
--- a/include/graphics/twm4nx/cwindow.hxx
+++ b/include/graphics/twm4nx/cwindow.hxx
@@ -825,6 +825,11 @@ namespace Twm4Nx
           {
             m_iconWidget->getSize(size);
           }
+        else
+          {
+            size.w = 0;
+            size.h = 0;
+          }
       }
 
       /**
@@ -842,6 +847,11 @@ namespace Twm4Nx
           {
             m_iconWidget->getPos(pos);
           }
+        else
+          {
+            pos.x = 0;
+            pos.y = 0;
+          }
       }
 
       /**
diff --git a/interpreters/bas/bas.c b/interpreters/bas/bas.c
index f559caf..fab2f56 100644
--- a/interpreters/bas/bas.c
+++ b/interpreters/bas/bas.c
@@ -2422,7 +2422,7 @@ void bas_interpreter(void)
                       if (Program_goLine(&g_program, line->u.integer, &where) ==
                           (struct Pc *)0)
                         {
-                          FS_putChars(STDCHANNEL, (NOSUCHLINE));
+                          FS_putChars(STDCHANNEL, _("No such line\n"));
                         }
                       else
                         {
diff --git a/interpreters/bas/bas_fs.c b/interpreters/bas/bas_fs.c
index 1ac52e4..100a8b6 100644
--- a/interpreters/bas/bas_fs.c
+++ b/interpreters/bas/bas_fs.c
@@ -103,14 +103,6 @@ static int g_used;
 static const int g_open_mode[4] = { 0, O_RDONLY, O_WRONLY, O_RDWR };
 static char g_errmsgbuf[80];
 
-#ifdef CONFIG_INTERPRETER_BAS_VT100
-static const uint8_t g_vt100_colormap[8] =
-{
-  VT100_BLACK, VT100_BLUE,   VT100_GREEN,  VT100_CYAN,
-  VT100_RED,  VT100_MAGENTA, VT100_YELLOW, VT100_WHITE
-};
-#endif
-
 /****************************************************************************
  * Public Data
  ****************************************************************************/
diff --git a/interpreters/bas/bas_token.c b/interpreters/bas/bas_token.c
index 22fbbe5..8e57d0d 100644
--- a/interpreters/bas/bas_token.c
+++ b/interpreters/bas/bas_token.c
@@ -1525,16 +1525,6 @@ static void yy_flex_strncpy (char *,yyconst char *,int);
 static int yy_flex_strlen (yyconst char *);
 #endif
 
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (void);
-#else
-static int input (void);
-#endif
-
-#endif
-
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
 #ifdef __ia64__
@@ -4038,80 +4028,6 @@ static int yy_get_next_buffer (void)
     return yy_is_jam ? 0 : yy_current_state;
 }
 
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-    static int yyinput (void)
-#else
-    static int input  (void)
-#endif
-
-{
-  int c;
-
-  *(yy_c_buf_p) = (yy_hold_char);
-
-  if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR)
-    {
-    /* yy_c_buf_p now points to the character we want to return.
-     * If this occurs *before* the EOB characters, then it's a
-     * valid NUL; if not, then we've hit the end of the buffer.
-     */
-    if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
-      /* This was really a NUL. */
-      *(yy_c_buf_p) = '\0';
-
-    else
-      { /* need more input */
-      yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
-      ++(yy_c_buf_p);
-
-      switch (yy_get_next_buffer())
-        {
-        case EOB_ACT_LAST_MATCH:
-          /* This happens because yy_g_n_b()
-           * sees that we've accumulated a
-           * token and flags that we need to
-           * try matching the token before
-           * proceeding.  But for input(),
-           * there's no matching to consider.
-           * So convert the EOB_ACT_LAST_MATCH
-           * to EOB_ACT_END_OF_FILE.
-           */
-
-          /* Reset buffer status. */
-          yyrestart(yyin);
-
-          /*FALLTHROUGH*/
-
-        case EOB_ACT_END_OF_FILE:
-          {
-          if (yywrap())
-            return EOF;
-
-          if (! (yy_did_buffer_switch_on_eof))
-            YY_NEW_FILE;
-#ifdef __cplusplus
-          return yyinput();
-#else
-          return input();
-#endif
-          }
-
-        case EOB_ACT_CONTINUE_SCAN:
-          (yy_c_buf_p) = (yytext_ptr) + offset;
-          break;
-        }
-      }
-    }
-
-  c = *(unsigned char *) (yy_c_buf_p);  /* cast for 8-bit char's */
-  *(yy_c_buf_p) = '\0';  /* preserve yytext */
-  (yy_hold_char) = *++(yy_c_buf_p);
-
-  return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
 /** Immediately switch to a different input stream.
  * @param input_file A readable stream.
  *
diff --git a/nshlib/nsh_envcmds.c b/nshlib/nsh_envcmds.c
index 80dd63e..dbffd30 100644
--- a/nshlib/nsh_envcmds.c
+++ b/nshlib/nsh_envcmds.c
@@ -91,6 +91,7 @@ static inline FAR const char *nsh_getwd(const char *wd)
  * Name: nsh_getdirpath
  ****************************************************************************/
 
+#ifndef CONFIG_DISABLE_ENVIRON
 static inline char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
                                    const char *dirpath, const char *relpath)
 {
@@ -125,6 +126,7 @@ static inline char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
 
   return alloc;
 }
+#endif
 
 /****************************************************************************
  * Name: nsh_dumpvar
diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c
index ff69197..c6e42df 100644
--- a/nshlib/nsh_netcmds.c
+++ b/nshlib/nsh_netcmds.c
@@ -420,7 +420,7 @@ static int nsh_foreach_netdev(nsh_netdev_callback_t callback,
  * Name: nsh_addrconv
  ****************************************************************************/
 
-#ifdef HAVE_HWADDR
+#if !defined(CONFIG_NSH_DISABLE_IFCONFIG) && defined(HAVE_HWADDR)
 static inline bool nsh_addrconv(FAR const char *hwstr,
                                 FAR mac_addr_t *macaddr)
 {
@@ -442,7 +442,7 @@ static inline bool nsh_addrconv(FAR const char *hwstr,
  * Name: nsh_sethwaddr
  ****************************************************************************/
 
-#ifdef HAVE_HWADDR
+#if !defined(CONFIG_NSH_DISABLE_IFCONFIG) && defined(HAVE_HWADDR)
 static inline void nsh_sethwaddr(FAR const char *ifname,
                                  FAR mac_addr_t *macaddr)
 {


[incubator-nuttx-apps] 02/02: Fix nxstyle warning

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

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

commit 8fd8aad5c406c0d30e90944a8958e876b3f1ebae
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Apr 13 11:56:53 2020 +0800

    Fix nxstyle warning
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 interpreters/bas/bas.c    | 154 +++++++++++++++++++++++++++-------------------
 interpreters/bas/bas_fs.c |  58 +++++++++--------
 nshlib/nsh_envcmds.c      |  28 +++++----
 nshlib/nsh_netcmds.c      |   4 +-
 4 files changed, 142 insertions(+), 102 deletions(-)

diff --git a/interpreters/bas/bas.c b/interpreters/bas/bas.c
index fab2f56..5e34167 100644
--- a/interpreters/bas/bas.c
+++ b/interpreters/bas/bas.c
@@ -13,8 +13,8 @@
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
@@ -182,7 +182,8 @@ static int cat(const char *filename)
 
   while ((l = read(fd, buf, sizeof(buf))) > 0)
     {
-      ssize_t off, w;
+      ssize_t off;
+      ssize_t w;
 
       off = 0;
       while (off < l)
@@ -217,13 +218,14 @@ static struct Value *lvalue(struct Value *value)
   struct Pc lvpc = g_pc;
 
   sym = g_pc.token->u.identifier->sym;
-  assert(g_pass == DECLARE || sym->type == GLOBALVAR || sym->type == GLOBALARRAY
-         || sym->type == LOCALVAR);
+  assert(g_pass == DECLARE || sym->type == GLOBALVAR
+         || sym->type == GLOBALARRAY || sym->type == LOCALVAR);
 
   if ((g_pc.token + 1)->type == T_OP)
     {
       struct Pc idxpc;
-      unsigned int dim, capacity;
+      unsigned int dim;
+      unsigned int capacity;
       int *idx;
 
       g_pc.token += 2;
@@ -328,10 +330,8 @@ static struct Value *lvalue(struct Value *value)
       switch (g_pass)
         {
         case INTERPRET:
-          return VAR_SCALAR_VALUE(sym->type ==
-                                  GLOBALVAR ? &(sym->u.var) : Auto_local(&g_stack,
-                                                                         sym->
-                                                                         u.local.offset));
+          return VAR_SCALAR_VALUE(sym->type == GLOBALVAR ? &(sym->u.var) :
+                                  Auto_local(&g_stack, sym->u.local.offset));
 
         case DECLARE:
           return Value_nullValue(V_INTEGER);
@@ -353,7 +353,7 @@ static struct Value *func(struct Value *value)
 {
   struct Identifier *ident;
   struct Pc funcpc = g_pc;
-  int firstslot = -99;
+  long int firstslot = -99;
   int args = 0;
   struct Symbol *sym;
 
@@ -388,7 +388,7 @@ static struct Value *func(struct Value *value)
           ident->sym->u.sub.retType != V_VOID)
         {
           struct Var *v = Auto_pushArg(&g_stack);
-          Var_new(v, ident->sym->u.sub.retType, 0, (const unsigned int *)0, 0);
+          Var_new(v, ident->sym->u.sub.retType, 0, NULL, 0);
         }
     }
 
@@ -418,7 +418,10 @@ static struct Value *func(struct Value *value)
                       Value_clone(value, v->value);
                       while (g_stack.stackPointer > firstslot)
                         {
-                          Var_destroy(&g_stack.slot[--g_stack.stackPointer].var);
+                          long int stackPointer;
+
+                          stackPointer = --g_stack.stackPointer;
+                          Var_destroy(&g_stack.slot[stackPointer].var);
                         }
 
                       return value;
@@ -444,7 +447,10 @@ static struct Value *func(struct Value *value)
                 {
                   while (g_stack.stackPointer > firstslot)
                     {
-                      Var_destroy(&g_stack.slot[--g_stack.stackPointer].var);
+                      long int stackPointer;
+
+                      stackPointer = --g_stack.stackPointer;
+                      Var_destroy(&g_stack.slot[stackPointer].var);
                     }
                 }
 
@@ -484,7 +490,8 @@ static struct Value *func(struct Value *value)
       do
         {
           nomore = (g_pass == COMPILE &&
-                    !(sym->type == BUILTINFUNCTION && sym->u.sub.u.bltin.next));
+                    !(sym->type == BUILTINFUNCTION &&
+                      sym->u.sub.u.bltin.next));
           argerr = 0;
           if (args < sym->u.sub.argLength)
             {
@@ -595,8 +602,8 @@ static struct Value *func(struct Value *value)
                       if (strchr(value->u.error.msg, '\n') == (char *)0)
                         {
                           Auto_setError(&g_stack,
-                                        Program_lineNumber(&g_program, &g_pc), &g_pc,
-                                        value);
+                            Program_lineNumber(&g_program, &g_pc),
+                            &g_pc, value);
                           Program_PCtoError(&g_program, &g_pc, value);
                         }
 
@@ -618,7 +625,8 @@ static struct Value *func(struct Value *value)
 
                   Value_destroy(value);
                 }
-              while ((r = Program_skipEOL(&g_program, &g_pc, STDCHANNEL, 1)));
+              while ((r = Program_skipEOL(&g_program, &g_pc,
+                                          STDCHANNEL, 1)));
 
               if (!r)
                 {
@@ -687,7 +695,8 @@ static struct Value *func(struct Value *value)
  *
  *   i6:
  *   E  -> op E .             reduce 3
- *   E  -> E . op E    op*    shift 1 *=if stack[-2] contains op of unary lower priority
+ *   E  -> E . op E    op*    shift 1 *=if stack[-2] contains op of unary
+ *                                      lower priority
  *
  *   i7:
  *   E  -> ( E . )     )      shift 9
@@ -695,8 +704,9 @@ static struct Value *func(struct Value *value)
  *
  *   i8:
  *   E  -> E op E .           reduce 2
- *   E  -> E . op E    op*    shift 1 *=if stack[-2] contains op of lower priority or if
- *                                      if it is of equal priority and right associative
+ *   E  -> E . op E    op*    shift 1 *=if stack[-2] contains op of lower
+ *                                      priority or if it is of equal
+ *                                      priority and right associative
  *   i9:
  *   E  -> ( E ) .            reduce 4
  */
@@ -705,7 +715,11 @@ static struct Value *eval(struct Value *value, const char *desc)
 {
   /* Variables */
 
-  static const int gotoState[10] = { 5, 8, 6, 7, -1, -1, -1, -1, -1, -1 };
+  static const int gotoState[10] =
+  {
+    5, 8, 6, 7, -1, -1, -1, -1, -1, -1
+  };
+
   int capacity = 10;
   struct Pdastack
     {
@@ -716,6 +730,7 @@ static struct Value *eval(struct Value *value, const char *desc)
         } u;
       char state;
     };
+
   struct Pdastack *pdastack = malloc(capacity * sizeof(struct Pdastack));
   struct Pdastack *sp = pdastack;
   struct Pdastack *stackEnd = pdastack + capacity - 1;
@@ -743,17 +758,18 @@ static struct Value *eval(struct Value *value, const char *desc)
           {
             if (ip == T_IDENTIFIER)
               {
-                /* printf("state %d: shift 4\n",sp->state); */
-                /* printf("state 4: reduce E -> value\n"); */
+                /* printf("state %d: shift 4\n",sp->state);
+                 * printf("state 4: reduce E -> value\n");
+                 */
 
                 ++sp;
                 sp->state = gotoState[(sp - 1)->state];
                 if (g_pass == COMPILE)
                   {
                     if (((g_pc.token + 1)->type == T_OP ||
-                         Auto_find(&g_stack, g_pc.token->u.identifier) == 0) &&
-                        Global_find(&g_globals, g_pc.token->u.identifier,
-                                    (g_pc.token + 1)->type == T_OP) == 0)
+                         Auto_find(&g_stack, g_pc.token->u.identifier) == 0)
+                        && Global_find(&g_globals, g_pc.token->u.identifier,
+                                       (g_pc.token + 1)->type == T_OP) == 0)
                       {
                         Value_new_ERROR(value, UNDECLARED);
                         goto error;
@@ -786,8 +802,9 @@ static struct Value *eval(struct Value *value, const char *desc)
               }
             else if (ip == T_INTEGER)
               {
-                /* printf("state %d: shift 4\n",sp->state); */
-                /* printf("state 4: reduce E -> value\n"); */
+                /* printf("state %d: shift 4\n",sp->state);
+                 * printf("state 4: reduce E -> value\n");
+                 */
 
                 ++sp;
                 sp->state = gotoState[(sp - 1)->state];
@@ -796,8 +813,9 @@ static struct Value *eval(struct Value *value, const char *desc)
               }
             else if (ip == T_REAL)
               {
-                /* printf("state %d: shift 4\n",sp->state); */
-                /* printf("state 4: reduce E -> value\n"); */
+                /* printf("state %d: shift 4\n",sp->state);
+                 * printf("state 4: reduce E -> value\n");
+                 */
 
                 ++sp;
                 sp->state = gotoState[(sp - 1)->state];
@@ -815,8 +833,9 @@ static struct Value *eval(struct Value *value, const char *desc)
               }
             else if (ip == T_HEXINTEGER)
               {
-                /* printf("state %d: shift 4\n",sp->state); */
-                /* printf("state 4: reduce E -> value\n"); */
+                /* printf("state %d: shift 4\n",sp->state);
+                 * printf("state 4: reduce E -> value\n");
+                 */
 
                 ++sp;
                 sp->state = gotoState[(sp - 1)->state];
@@ -825,8 +844,9 @@ static struct Value *eval(struct Value *value, const char *desc)
               }
             else if (ip == T_OCTINTEGER)
               {
-                /* printf("state %d: shift 4\n",sp->state); */
-                /* printf("state 4: reduce E -> value\n"); */
+                /* printf("state %d: shift 4\n",sp->state);
+                 * printf("state 4: reduce E -> value\n");
+                 */
 
                 ++sp;
                 sp->state = gotoState[(sp - 1)->state];
@@ -844,8 +864,9 @@ static struct Value *eval(struct Value *value, const char *desc)
               }
             else if (ip == T_STRING)
               {
-                /* printf("state %d: shift 4\n",sp->state); */
-                /* printf("state 4: reduce E -> value\n"); */
+                /* printf("state %d: shift 4\n",sp->state);
+                 * printf("state 4: reduce E -> value\n");
+                 */
 
                 ++sp;
                 sp->state = gotoState[(sp - 1)->state];
@@ -911,7 +932,9 @@ static struct Value *eval(struct Value *value, const char *desc)
               {
                 assert(TOKEN_ISUNARYOPERATOR((sp - 1)->u.token));
 
-                /* printf("state %d: shift 1 (not reducing E -> op E)\n", sp->state); */
+                /* printf("state %d: shift 1 (not reducing E -> op E)\n",
+                 *        sp->state);
+                 */
 
                 ++sp;
                 sp->state = 1;
@@ -969,8 +992,9 @@ static struct Value *eval(struct Value *value, const char *desc)
               }
             else if (ip == T_CP)
               {
-                /* printf("state %d: shift 9\n",sp->state); */
-                /* printf("state 9: reduce E -> ( E )\n"); */
+                /* printf("state %d: shift 9\n",sp->state);
+                 * printf("state 9: reduce E -> ( E )\n");
+                 */
 
                 --sp;
                 sp->state = gotoState[(sp - 1)->state];
@@ -990,11 +1014,9 @@ static struct Value *eval(struct Value *value, const char *desc)
           {
             int p1, p2;
 
-            if (TOKEN_ISBINARYOPERATOR(ip)
-                &&
-                (((p1 = TOKEN_BINARYPRIORITY((sp - 1)->u.token)) < (p2 =
-                                                                    TOKEN_BINARYPRIORITY
-                                                                    (ip))) ||
+            if (TOKEN_ISBINARYOPERATOR(ip) &&
+                (((p1 = TOKEN_BINARYPRIORITY((sp - 1)->u.token)) <
+                  (p2 = TOKEN_BINARYPRIORITY(ip))) ||
                  (p1 == p2 && TOKEN_ISRIGHTASSOCIATIVE((sp - 1)->u.token))))
               {
                 /* printf("state %d: shift 1\n",sp->state); */
@@ -1008,8 +1030,8 @@ static struct Value *eval(struct Value *value, const char *desc)
               {
                 /* printf("state %d: reduce E -> E op E\n",sp->state); */
 
-                if (Value_commonType[(sp - 2)->u.value.type][sp->u.value.type]
-                    == V_ERROR)
+                if (Value_commonType[(sp - 2)->u.value.type]
+                    [sp->u.value.type] == V_ERROR)
                   {
                     Value_destroy(&sp->u.value);
                     sp -= 2;
@@ -1143,6 +1165,7 @@ error:
         case 8:
           Value_destroy(&sp->u.value);
         }
+
       --sp;
     }
 
@@ -1551,7 +1574,7 @@ static void pushLabel(enum labeltype_e type, struct Pc *patch)
       more =
         realloc(g_labelstack,
                 sizeof(struct labelstack_s) *
-                (g_labelstack_capacity ? (g_labelstack_capacity *= 2) : (32)));
+                (g_labelstack_capacity ? g_labelstack_capacity *= 2 : 32));
       g_labelstack = more;
     }
 
@@ -1562,7 +1585,8 @@ static void pushLabel(enum labeltype_e type, struct Pc *patch)
 
 static struct Pc *popLabel(enum labeltype_e type)
 {
-  if (g_labelstack_index == 0 || g_labelstack[g_labelstack_index - 1].type != type)
+  if (g_labelstack_index == 0 ||
+      g_labelstack[g_labelstack_index - 1].type != type)
     {
       return (struct Pc *)0;
     }
@@ -1801,7 +1825,7 @@ static struct Value *assign(struct Value *value)
       int i, used = 0, capacity = 0;
       struct Value retyped_value;
 
-      for (;;)
+      for (; ; )
         {
           if (used == capacity)
             {
@@ -2008,7 +2032,8 @@ static void runline(struct Token *line)
         {
           struct String s;
 
-          Auto_setError(&g_stack, Program_lineNumber(&g_program, &g_pc), &g_pc, &value);
+          Auto_setError(&g_stack, Program_lineNumber(&g_program, &g_pc),
+                        &g_pc, &value);
           Program_PCtoError(&g_program, &g_pc, &value);
           g_labelstack_index = 0;
           FS_putChars(STDCHANNEL, _("Error: "));
@@ -2044,8 +2069,8 @@ static void runline(struct Token *line)
         {
           if (strchr(value.u.error.msg, '\n') == (char *)0)
             {
-              Auto_setError(&g_stack, Program_lineNumber(&g_program, &g_pc), &g_pc,
-                            &value);
+              Auto_setError(&g_stack, Program_lineNumber(&g_program, &g_pc),
+                            &g_pc, &value);
               Program_PCtoError(&g_program, &g_pc, &value);
             }
 
@@ -2105,8 +2130,8 @@ static struct Value *evalGeometry(struct Value *value, unsigned int *dim,
     {
       ++g_pc.token;
       exprpc = g_pc;
-      if (eval(value, _("dimension"))->type == V_ERROR ||
-          (g_pass != DECLARE && Value_retype(value, V_INTEGER)->type == V_ERROR))
+      if (eval(value, _("dimension"))->type == V_ERROR || (g_pass != DECLARE
+          && Value_retype(value, V_INTEGER)->type == V_ERROR))
         {
           return value;
         }
@@ -2158,7 +2183,8 @@ static struct Value *convert(struct Value *value, struct Value *l,
 
         datainput = t->u.datainput;
         v = Value_vali(datainput, &end, &overflow);
-        if (end == datainput || (*end != '\0' && *end != ' ' && *end != '\t'))
+        if (end == datainput ||
+            (*end != '\0' && *end != ' ' && *end != '\t'))
           {
             return Value_new_ERROR(value, BADCONVERSION, _("integer"));
           }
@@ -2187,7 +2213,8 @@ static struct Value *convert(struct Value *value, struct Value *l,
 
         datainput = t->u.datainput;
         v = Value_vald(datainput, &end, &overflow);
-        if (end == datainput || (*end != '\0' && *end != ' ' && *end != '\t'))
+        if (end == datainput ||
+            (*end != '\0' && *end != ' ' && *end != '\t'))
           {
             return Value_new_ERROR(value, BADCONVERSION, _("real"));
           }
@@ -2201,6 +2228,7 @@ static struct Value *convert(struct Value *value, struct Value *l,
         VALUE_NEW_REAL(l, v);
         break;
       }
+
     case V_STRING:
       {
         Value_destroy(l);
@@ -2285,14 +2313,14 @@ more:
     {
       ++g_pc.token;
     }
-  else if ((g_pc.token->type == T_COLON && (g_pc.token + 1)->type != T_ELSE) ||
-           g_pc.token->type == T_QUOTE)
+  else if ((g_pc.token->type == T_COLON && (g_pc.token + 1)->type != T_ELSE)
+           || g_pc.token->type == T_QUOTE)
     {
       ++g_pc.token;
       goto more;
     }
-  else if ((g_pass == DECLARE || g_pass == COMPILE) && g_pc.token->type != T_EOL &&
-           g_pc.token->type != T_ELSE)
+  else if ((g_pass == DECLARE || g_pass == COMPILE) &&
+           g_pc.token->type != T_EOL && g_pc.token->type != T_ELSE)
     {
       return Value_new_ERROR(value, MISSINGCOLON);
     }
@@ -2419,8 +2447,8 @@ void bas_interpreter(void)
                     {
                       struct Pc where;
 
-                      if (Program_goLine(&g_program, line->u.integer, &where) ==
-                          (struct Pc *)0)
+                      if (Program_goLine(&g_program, line->u.integer, &where)
+                          == (struct Pc *)0)
                         {
                           FS_putChars(STDCHANNEL, _("No such line\n"));
                         }
diff --git a/interpreters/bas/bas_fs.c b/interpreters/bas/bas_fs.c
index 100a8b6..40bfcc4 100644
--- a/interpreters/bas/bas_fs.c
+++ b/interpreters/bas/bas_fs.c
@@ -14,8 +14,8 @@
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
@@ -100,8 +100,11 @@
 static struct FileStream **g_file;
 static int g_capacity;
 static int g_used;
-static const int g_open_mode[4] = { 0, O_RDONLY, O_WRONLY, O_RDWR };
 static char g_errmsgbuf[80];
+static const int g_open_mode[4] =
+{
+  0, O_RDONLY, O_WRONLY, O_RDWR
+};
 
 /****************************************************************************
  * Public Data
@@ -205,7 +208,8 @@ static int opened(int dev, int mode)
 
     case 4:
       {
-        fd = (g_file[dev]->randomfd != -1 ? g_file[dev]->randomfd : g_file[dev]->binaryfd);
+        fd = (g_file[dev]->randomfd != -1 ?
+              g_file[dev]->randomfd : g_file[dev]->binaryfd);
         if (fd == -1)
           {
             snprintf(g_errmsgbuf, sizeof(g_errmsgbuf),
@@ -270,6 +274,7 @@ static int edit(int chn, int nl)
           FS_putChar(chn, *buf);
         }
     }
+
   do
     {
       FS_flush(chn);
@@ -301,7 +306,7 @@ static int edit(int chn, int nl)
 #ifdef CONFIG_INTERPRETER_BAS_VT100
               /* Could use vt100_clrtoeol */
 #endif
-              /* Is the previous character in the buffer 2 character escape sequence? */
+              /* Is the previous char in buffer 2 char escape sequence? */
 
               if (f->inBuf[f->inCapacity - 1] >= '\0' &&
                   f->inBuf[f->inCapacity - 1] < ' ')
@@ -311,7 +316,7 @@ static int edit(int chn, int nl)
                   FS_putChars(chn, "\b\b  \b\b");
                 }
               else
-                 {
+                {
                   /* Yes.. erase one characters */
 
                   FS_putChars(chn, "\b \b");
@@ -335,7 +340,7 @@ static int edit(int chn, int nl)
 #elif defined(CONFIG_EOL_IS_LF)
               if (ch != '\n')
 #elif defined(CONFIG_EOL_IS_EITHER_CRLF)
-              if (ch != '\n' && ch != '\r' )
+              if (ch != '\n' && ch != '\r')
 #endif
                 {
                   /* No.. escape control characters other than newline and
@@ -540,7 +545,8 @@ int FS_openinChn(int chn, const char *name, int mode)
 
   /* Serial devices on Linux should be opened non-blocking, otherwise the
    * open() may block already.  Named pipes can not be opened non-blocking in
-   * write-only mode, so first try non-blocking, then blocking. */
+   * write-only mode, so first try non-blocking, then blocking.
+   */
 
   if ((fd = open(name, fl | O_NONBLOCK)) == -1)
     {
@@ -631,15 +637,16 @@ int FS_openoutChn(int chn, const char *name, int mode, int append)
 
   fl = g_open_mode[mode] | (append ? O_APPEND : 0);
 
-  /* Serial devices on Linux should be opened non-blocking, otherwise the */
-  /* open() may block already.  Named pipes can not be opened non-blocking */
-  /* in write-only mode, so first try non-blocking, then blocking.  */
+  /* Serial devices on Linux should be opened non-blocking, otherwise the
+   * open() may block already.  Named pipes can not be opened non-blocking
+   * in write-only mode, so first try non-blocking, then blocking.
+   */
 
   fd = open(name, fl | O_CREAT | (append ? 0 : O_TRUNC) | O_NONBLOCK, 0666);
   if (fd == -1)
     {
-      if (errno != ENXIO ||
-          (fd = open(name, fl | O_CREAT | (append ? 0 : O_TRUNC), 0666)) == -1)
+      if (errno != ENXIO || -1 ==
+          (fd = open(name, fl | O_CREAT | (append ? 0 : O_TRUNC), 0666)))
         {
           FS_errmsg = strerror(errno);
           return -1;
@@ -803,7 +810,8 @@ int FS_close(int dev)
   if (g_file[dev]->outfd >= 0)
     {
       if (g_file[dev]->tty &&
-          (g_file[dev]->outforeground != -1 || g_file[dev]->outbackground != -1))
+          (g_file[dev]->outforeground != -1 ||
+           g_file[dev]->outbackground != -1))
         {
           resetcolour(dev);
         }
@@ -928,7 +936,8 @@ int FS_truncate(int chn)
         }
     }
 
-  if ((o = lseek(fd, 0, SEEK_CUR)) == (off_t) - 1 || ftruncate(fd, o + 1) == -1)
+  if ((o = lseek(fd, 0, SEEK_CUR)) == (off_t) - 1 ||
+      ftruncate(fd, o + 1) == -1)
     {
       FS_errmsg = strerror(errno);
       return -1;
@@ -1143,8 +1152,8 @@ int FS_getbinaryString(int chn, struct String *s)
       return -1;
     }
 
-  if (s->length &&
-      (len = read(g_file[chn]->binaryfd, s->character, s->length)) != s->length)
+  if (s->length && s->length !=
+      (len = read(g_file[chn]->binaryfd, s->character, s->length)))
     {
       if (len == -1)
         {
@@ -1231,9 +1240,8 @@ int FS_nextcol(int dev)
     }
 
   f = g_file[dev];
-  if (f->outPos % f->outColWidth
-      && f->outLineWidth
-      && ((f->outPos / f->outColWidth + 2) * f->outColWidth) > f->outLineWidth)
+  if (f->outPos % f->outColWidth && f->outLineWidth &&
+      ((f->outPos / f->outColWidth + 2) * f->outColWidth) > f->outLineWidth)
     {
       return FS_putChar(dev, '\n');
     }
@@ -1497,7 +1505,7 @@ int FS_inkeyChar(int dev, int ms)
   FD_SET(f->infd, &just_infd);
   timeout.tv_sec = ms / 1000;
   timeout.tv_usec = (ms % 1000) * 1000;
-  switch (select(f->infd + 1, &just_infd, (fd_set *) 0, (fd_set *) 0, &timeout))
+  switch (select(f->infd + 1, &just_infd, NULL, NULL, &timeout))
     {
     case 1:
       {
@@ -1635,8 +1643,9 @@ long int FS_lof(int chn)
 
   assert(fd != -1);
 
-  /* Get the size of the file */
-  /* Save the current file position */
+  /* Get the size of the file
+   * Save the current file position
+   */
 
   curpos = lseek(fd, 0, SEEK_CUR);
   if (curpos == (off_t)-1)
@@ -1679,7 +1688,8 @@ long int FS_recLength(int chn)
 void FS_field(int chn, struct String *s, long int position, long int length)
 {
   assert(g_file[chn]);
-  String_joinField(s, &g_file[chn]->field, g_file[chn]->recBuf + position, length);
+  String_joinField(s, &g_file[chn]->field,
+                   g_file[chn]->recBuf + position, length);
 }
 
 int FS_seek(int chn, long int record)
diff --git a/nshlib/nsh_envcmds.c b/nshlib/nsh_envcmds.c
index dbffd30..7f9e366 100644
--- a/nshlib/nsh_envcmds.c
+++ b/nshlib/nsh_envcmds.c
@@ -1,7 +1,8 @@
 /****************************************************************************
  * apps/nshlib/nsh_envcmds.c
  *
- *   Copyright (C) 2007-2009, 2011-2012, 2018 Gregory Nutt. All rights reserved.
+ *   Copyright (C) 2007-2009, 2011-2012, 2018 Gregory Nutt. All rights
+ *   reserved.
  *   Author: Gregory Nutt <gn...@nuttx.org>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -95,7 +96,7 @@ static inline FAR const char *nsh_getwd(const char *wd)
 static inline char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
                                    const char *dirpath, const char *relpath)
 {
-  char *alloc;
+  FAR char *alloc;
   int len;
 
   /* Handle the special case where the dirpath is simply "/" */
@@ -103,7 +104,7 @@ static inline char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
   if (strcmp(dirpath, "/") == 0)
     {
       len   = strlen(relpath) + 2;
-      alloc = (char*)malloc(len);
+      alloc = (FAR char *)malloc(len);
       if (alloc)
         {
           sprintf(alloc, "/%s", relpath);
@@ -112,7 +113,7 @@ static inline char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
   else
     {
       len = strlen(dirpath) + strlen(relpath) + 2;
-      alloc = (char*)malloc(len);
+      alloc = (FAR char *)malloc(len);
       if (alloc)
         {
           sprintf(alloc, "%s/%s", dirpath, relpath);
@@ -389,23 +390,24 @@ int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
           else
             {
               value = &argv[1][1];
-              while(*value && *value != ' ')
+              while (*value && *value != ' ')
                 {
                   popt = strchr(opts, *value++);
                   if (popt == NULL)
                     {
-                      nsh_error(vtbl, g_fmtarginvalid, argv[0], "set", NSH_ERRNO);
+                      nsh_error(vtbl, g_fmtarginvalid,
+                                argv[0], "set", NSH_ERRNO);
                       ret = -EINVAL;
                       break;
                     }
 
                   if (op == '+')
                     {
-                      vtbl->np.np_flags |= 1 << (popt-opts);
+                      vtbl->np.np_flags |= 1 << (popt - opts);
                     }
                   else
                     {
-                      vtbl->np.np_flags &= ~(1 << (popt-opts));
+                      vtbl->np.np_flags &= ~(1 << (popt - opts));
                     }
                 }
 
@@ -416,8 +418,8 @@ int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
                 }
 #endif
             }
-         }
-      }
+        }
+    }
 
 #ifdef NSH_HAVE_VARS
   if (ret == OK && (argc == 3 || argc == 4))
@@ -431,7 +433,7 @@ int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 
       /* Trim whitespace from the value */
 
-      value = nsh_trimspaces(argv[ndx+1]);
+      value = nsh_trimspaces(argv[ndx + 1]);
 
 #ifdef CONFIG_NSH_VARS
 #ifndef CONFIG_DISABLE_ENVIRON
@@ -442,8 +444,8 @@ int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
        * a local variable that shadows the environment variable.
        */
 
-     oldvalue = getenv(argv[ndx]);
-     if (oldvalue == NULL)
+      oldvalue = getenv(argv[ndx]);
+      if (oldvalue == NULL)
 #endif
         {
           /* Set the NSH variable */
diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c
index c6e42df..21e4725 100644
--- a/nshlib/nsh_netcmds.c
+++ b/nshlib/nsh_netcmds.c
@@ -265,7 +265,7 @@ int tftpc_parseargs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
         }
     }
 
-  /* If a bad argument was encountered, then return without processing the command */
+  /* If a bad argument was encountered, then return without processing */
 
   if (badarg)
     {
@@ -669,7 +669,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
                 }
 
 #ifdef HAVE_HWADDR
-              /* REVISIT: How will we handle Ethernet and SLIP networks together? */
+              /* REVISIT: How will we handle Ethernet and SLIP together? */
 
               else if (!strcmp(tmp, "hw"))
                 {