Patch NuttX/nuttx and NuttX/apps for new arm-none-eabi-gcc 7.1.0 warnings

Rename nuttx patch

Add nuttx patch for unused variable error

Pending nuttx patch

Backport nuttx fix for unused variables in nsh_proccmds.c

Fix Patch format

Modify pending patch to match new nuttx PR

Move accepted nuttx changes from pending patch to backport patch
This commit is contained in:
Julien Lecoeur 2017-06-28 17:16:34 +02:00 committed by Beat Küng
parent 940f2c3cca
commit 87e9ad0caa
3 changed files with 403 additions and 0 deletions

View File

@ -0,0 +1,330 @@
diff --git NuttX/nuttx/fs/vfs/fs_lseek.c NuttX/nuttx/fs/vfs/fs_lseek.c
index be74239eca..bea398c0a3 100644
--- NuttX/nuttx/fs/vfs/fs_lseek.c
+++ NuttX/nuttx/fs/vfs/fs_lseek.c
@@ -99,7 +99,7 @@ off_t file_seek(FAR struct file *filep, off_t offset, int whence)
{
case SEEK_CUR:
offset += filep->f_pos;
-
+ /* FALLTHROUGH */
case SEEK_SET:
if (offset >= 0)
{
diff --git NuttX/nuttx/libc/stdio/lib_sscanf.c NuttX/nuttx/libc/stdio/lib_sscanf.c
index 0bc413295b..f2b9a8d4e8 100644
--- NuttX/nuttx/libc/stdio/lib_sscanf.c
+++ NuttX/nuttx/libc/stdio/lib_sscanf.c
@@ -417,6 +417,7 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
default:
case 'd':
sign = true;
+ /* FALLTHROUGH */
case 'u':
base = 10;
break;
diff --git NuttX/nuttx/libc/stdlib/lib_strtod.c NuttX/nuttx/libc/stdlib/lib_strtod.c
index 62da9e0f6e..af830abf50 100644
--- NuttX/nuttx/libc/stdlib/lib_strtod.c
+++ NuttX/nuttx/libc/stdlib/lib_strtod.c
@@ -113,8 +113,10 @@ double strtod(FAR const char *str, FAR char **endptr)
{
case '-':
negative = 1; /* Fall through to increment position */
+ /* FALLTHROUGH */
case '+':
p++;
+ /* FALLTHROUGH */
default:
break;
}
@@ -175,8 +177,10 @@ double strtod(FAR const char *str, FAR char **endptr)
{
case '-':
negative = 1; /* Fall through to increment pos */
+ /* FALLTHROUGH */
case '+':
p++;
+ /* FALLTHROUGH */
default:
break;
}
diff --git NuttX/nuttx/libc/stdlib/lib_strtof.c NuttX/nuttx/libc/stdlib/lib_strtof.c
index 467842f4e6..6571e2d77e 100644
--- NuttX/nuttx/libc/stdlib/lib_strtof.c
+++ NuttX/nuttx/libc/stdlib/lib_strtof.c
@@ -115,8 +115,10 @@ float strtof(FAR const char *str, FAR char **endptr)
{
case '-':
negative = 1; /* Fall through to increment position */
+ /* FALLTHROUGH */
case '+':
p++;
+ /* FALLTHROUGH */
default:
break;
}
@@ -177,8 +179,10 @@ float strtof(FAR const char *str, FAR char **endptr)
{
case '-':
negative = 1; /* Fall through to increment pos */
+ /* FALLTHROUGH */
case '+':
p++;
+ /* FALLTHROUGH */
default:
break;
}
diff --git NuttX/nuttx/libc/stdlib/lib_strtold.c NuttX/nuttx/libc/stdlib/lib_strtold.c
index c306392cec..ac9368e893 100644
--- NuttX/nuttx/libc/stdlib/lib_strtold.c
+++ NuttX/nuttx/libc/stdlib/lib_strtold.c
@@ -113,8 +113,10 @@ long double strtold(FAR const char *str, FAR char **endptr)
{
case '-':
negative = 1; /* Fall through to increment position */
+ /* FALLTHROUGH */
case '+':
p++;
+ /* FALLTHROUGH */
default:
break;
}
@@ -175,8 +177,10 @@ long double strtold(FAR const char *str, FAR char **endptr)
{
case '-':
negative = 1; /* Fall through to increment pos */
+ /* FALLTHROUGH */
case '+':
p++;
+ /* FALLTHROUGH */
default:
break;
}
diff --git NuttX/nuttx/libc/stdio/lib_dtoa.c NuttX/nuttx/libc/stdio/lib_dtoa.c
index 8ddc3bfd35..0cc3b48fdd 100644
--- NuttX/nuttx/libc/stdio/lib_dtoa.c
+++ NuttX/nuttx/libc/stdio/lib_dtoa.c
@@ -591,6 +591,7 @@ static int cmp(Bigint * a, Bigint * b)
break;
}
}
+
return 0;
}
@@ -784,6 +785,7 @@ static Bigint *d2b(double d, int *e, int *bits)
}
while (!x[i])
--i;
+
b->wds = i + 1;
#endif
if (de)
@@ -817,11 +819,6 @@ static const double bigtens[] =
1e16, 1e32, 1e64, 1e128, 1e256
};
-static const double tinytens[] =
-{
- 1e-16, 1e-32, 1e-64, 1e-128, 1e-256
-};
-
# define n_bigtens 5
#else
static const double bigtens[] =
@@ -829,11 +826,6 @@ static const double bigtens[] =
1e16, 1e32
};
-static const double tinytens[] =
-{
- 1e-16, 1e-32
-};
-
# define n_bigtens 2
#endif
@@ -849,12 +841,14 @@ static int quorem(Bigint * b, Bigint * S)
#endif
n = S->wds;
+
#ifdef CONFIG_DEBUG_LIB
if (b->wds > n)
{
lerr("ERROR: oversize b in quorem\n");
}
#endif
+
if (b->wds < n)
{
return 0;
@@ -865,17 +859,19 @@ static int quorem(Bigint * b, Bigint * S)
bx = b->x;
bxe = bx + n;
q = *bxe / (*sxe + 1); /* ensure q <= true quotient */
+
#ifdef CONFIG_DEBUG_LIB
if (q > 9)
- {
- lerr("ERROR: oversized quotient in quorem\n");
- }
+ {
+ lerr("ERROR: oversized quotient in quorem\n");
+ }
#endif
if (q)
{
borrow = 0;
carry = 0;
+
do
{
#ifdef Pack_32
@@ -912,6 +908,7 @@ static int quorem(Bigint * b, Bigint * S)
b->wds = n;
}
}
+
if (cmp(b, S) >= 0)
{
q++;
@@ -919,6 +916,7 @@ static int quorem(Bigint * b, Bigint * S)
carry = 0;
bx = b->x;
sx = S->x;
+
do
{
#ifdef Pack_32
@@ -943,12 +941,14 @@ static int quorem(Bigint * b, Bigint * S)
#endif
}
while (sx <= sxe);
+
bx = b->x;
bxe = bx + n;
if (!*bxe)
{
while (--bxe > bx && !*bxe)
--n;
+
b->wds = n;
}
}
@@ -1041,7 +1041,8 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
if (word0(d) & Sign_bit)
{
- /* set sign for everything, including 0's and NaNs */
+ /* Set sign for everything, including 0's and NaNs */
+
*sign = 1;
word0(d) &= ~Sign_bit; /* clear sign bit */
}
@@ -1058,6 +1059,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
#endif
{
/* Infinity or NaN */
+
*decpt = 9999;
s =
#ifdef IEEE_Arith
@@ -1076,6 +1078,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
return s;
}
#endif
+
if (!d)
{
*decpt = 1;
@@ -1190,7 +1193,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
case 2:
leftright = 0;
- /* no break */
+ /* FALLTHROUGH */
case 4:
if (ndigits <= 0)
{
@@ -1202,7 +1205,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
case 3:
leftright = 0;
- /* no break */
+ /* FALLTHROUGH */
case 5:
i = ndigits + k + 1;
ilim = i;
@@ -1241,7 +1244,8 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
if (j & Bletch)
{
- /* prevent overflows */
+ /* Prevent overflows */
+
j &= Bletch - 1;
d /= bigtens[n_bigtens - 1];
ieps++;
@@ -1292,8 +1296,10 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
d -= 5.;
if (d > eps)
goto one_digit;
+
if (d < -eps)
goto no_digits;
+
goto fast_failed;
}
@@ -1357,6 +1363,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
#ifndef No_leftright
}
#endif
+
fast_failed:
s = s0;
d = d2;
@@ -1386,8 +1393,10 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
{
L = (int)(d / ds);
d -= L * ds;
+
#ifdef Check_FLT_ROUNDS
/* If FLT_ROUNDS == 2, L will usually be high by 1 */
+
if (d < 0)
{
L--;
@@ -1411,6 +1420,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
++*s++;
}
+
break;
}
@@ -1500,6 +1510,7 @@ char *__dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
if (!word1(d) && !(word0(d) & Bndry_mask) && word0(d) & Exp_mask)
{
/* The special case */
+
b2 += Log2P;
s2 += Log2P;
spec_case = 1;
diff --git NuttX/nuttx/drivers/mmcsd/mmcsd_spi.c NuttX/nuttx/drivers/mmcsd/mmcsd_spi.c
index 2a4cdee73d..c50c3b1456 100644
--- NuttX/nuttx/drivers/mmcsd/mmcsd_spi.c
+++ b/drivers/mmcsd/mmcsd_spi.c
@@ -326,7 +326,9 @@ static const struct mmcsd_cmdinfo_s g_cmd0 = {CMD0, MMCSD_CMDRESP_R1, 0x95};
static const struct mmcsd_cmdinfo_s g_cmd1 = {CMD1, MMCSD_CMDRESP_R1, 0xff};
static const struct mmcsd_cmdinfo_s g_cmd8 = {CMD8, MMCSD_CMDRESP_R7, 0x87};
static const struct mmcsd_cmdinfo_s g_cmd9 = {CMD9, MMCSD_CMDRESP_R1, 0xff};
+#if 0 /*not used */
static const struct mmcsd_cmdinfo_s g_cmd10 = {CMD10, MMCSD_CMDRESP_R1, 0xff};
+#endif
static const struct mmcsd_cmdinfo_s g_cmd12 = {CMD12, MMCSD_CMDRESP_R1, 0xff};
static const struct mmcsd_cmdinfo_s g_cmd16 = {CMD16, MMCSD_CMDRESP_R1, 0xff};
static const struct mmcsd_cmdinfo_s g_cmd17 = {CMD17, MMCSD_CMDRESP_R1, 0xff};

View File

@ -0,0 +1,71 @@
--- NuttX/apps/nshlib/nsh_syscmds.c
+++ NuttX/apps/nshlib/nsh_syscmds.c
@@ -86,7 +86,9 @@
* Private Data
****************************************************************************/
+#ifndef CONFIG_NSH_DISABLE_UNAME
static const char g_unknown[] = "unknown";
+#endif
/****************************************************************************
* Public Functions
diff --git NuttX/apps/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c
index 116dd96d..abd37970 100644
--- NuttX/apps/nshlib/nsh_proccmds.c
+++ NuttX/apps/nshlib/nsh_proccmds.c
@@ -108,24 +108,30 @@ struct nsh_taskstatus_s
/* Status strings */
+#ifndef CONFIG_NSH_DISABLE_PS
#if 0 /* Not used */
static const char g_name[] = "Name:";
#endif
+
static const char g_type[] = "Type:";
+
#ifdef CONFIG_SCHED_HAVE_PARENT
#ifdef HAVE_GROUPID
static const char g_groupid[] = "Group:";
#else
static const char g_ppid[] = "PPID:";
#endif
-#endif
+#endif /* CONFIG_SCHED_HAVE_PARENT */
+
#ifdef CONFIG_SMP
static const char g_cpu[] = "CPU:";
#endif
+
static const char g_state[] = "State:";
static const char g_flags[] = "Flags:";
static const char g_priority[] = "Priority:";
static const char g_scheduler[] = "Scheduler:";
+
#ifndef CONFIG_DISABLE_SIGNALS
static const char g_sigmask[] = "SigMask:";
#endif
@@ -135,7 +141,8 @@ static const char g_stacksize[] = "StackSize:";
#ifdef CONFIG_STACK_COLORATION
static const char g_stackused[] = "StackUsed:";
#endif
-#endif
+#endif /* !CONFIG_NSH_DISABLE_PSSTACKUSAGE */
+#endif /* !CONFIG_NSH_DISABLE_PS */
/****************************************************************************
* Private Functions
@@ -471,10 +478,10 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
}
}
- nsh_output(vtbl, "%6.6u ", (unsigned int)stack_size);
+ nsh_output(vtbl, "%06u ", (unsigned int)stack_size);
#ifdef CONFIG_STACK_COLORATION
- nsh_output(vtbl, "%6.6u ", (unsigned int)stack_used);
+ nsh_output(vtbl, "%06u ", (unsigned int)stack_used);
stack_filled = 0;
if (stack_size > 0 && stack_used > 0)

View File

@ -59,6 +59,8 @@ set(nuttx_patches
00025-BACKPORT-add-set-ex-to-nsh.patch 00025-BACKPORT-add-set-ex-to-nsh.patch
00026-BACKPORT-stm32fX-serial-fix-freezing.patch 00026-BACKPORT-stm32fX-serial-fix-freezing.patch
00027-BACKPORT-stm32-sdio-1-bit-and-16G-fix.patch 00027-BACKPORT-stm32-sdio-1-bit-and-16G-fix.patch
00030-BACKPORT-fix-arm-none-eabi-gcc-7-warnings-nuttx.patch
00031-BACKPORT-fix-arm-none-eabi-gcc-7-warnings-apps.patch
90000-PENDING-wip-inflight-to-upstream.patch 90000-PENDING-wip-inflight-to-upstream.patch
) )