[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] "-Wall -Wextra -Werror" compilation patches - part 1/3
From: |
Doron Tsur |
Subject: |
[PATCH 1/3] "-Wall -Wextra -Werror" compilation patches - part 1/3 |
Date: |
Wed, 4 Dec 2013 13:58:06 +0200 |
Tests: Ubuntu 13.10 compilation
.../configure --prefix=/usr --enable-mm-debug --enable-cache-stats
EFI_ARCH=x86_64 --with-platform=efi --enable-boot-time CFLAGS="-Wall -Wextra
-Werror" && make
Signed-off-by: Doron Tsur <address@hidden>
---
grub-core/gnulib/argp-fmtstream.c | 2 +-
grub-core/gnulib/argp-help.c | 6 +++---
grub-core/gnulib/argp-parse.c | 4 ++--
grub-core/gnulib/vasnprintf.c | 18 +++++++++++++-----
grub-core/lib/libgcrypt/cipher/rijndael.c | 3 ++-
5 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/grub-core/gnulib/argp-fmtstream.c
b/grub-core/gnulib/argp-fmtstream.c
index 02406ff..19fab18 100644
--- a/grub-core/gnulib/argp-fmtstream.c
+++ b/grub-core/gnulib/argp-fmtstream.c
@@ -234,7 +234,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
else
{
size_t display_width = mbsnwidth (buf, nl - buf, MBSW_STOP_AT_NUL);
- if (display_width < (ssize_t) fs->rmargin)
+ if (display_width < (size_t) fs->rmargin)
{
/* The buffer contains a full line that fits within the maximum
line width. Reset point and scan the next line. */
diff --git a/grub-core/gnulib/argp-help.c b/grub-core/gnulib/argp-help.c
index 2914f47..e01d40c 100644
--- a/grub-core/gnulib/argp-help.c
+++ b/grub-core/gnulib/argp-help.c
@@ -599,8 +599,8 @@ hol_entry_long_iterate (const struct hol_entry *entry,
/* Iterator that returns true for the first short option. */
static int
-until_short (const struct argp_option *opt, const struct argp_option *real,
- const char *domain, void *cookie)
+until_short (const struct argp_option *opt, const struct argp_option *real
__attribute__((unused)),
+ const char *domain __attribute__((unused)), void *cookie
__attribute__((unused)))
{
return oshort (opt) ? opt->key : 0;
}
@@ -1269,7 +1269,7 @@ optional for any corresponding short options.");
static int
add_argless_short_opt (const struct argp_option *opt,
const struct argp_option *real,
- const char *domain, void *cookie)
+ const char *domain __attribute__((unused)), void
*cookie)
{
char **snao_end = cookie;
if (!(opt->arg || real->arg)
diff --git a/grub-core/gnulib/argp-parse.c b/grub-core/gnulib/argp-parse.c
index 67ea32c..93cce25 100644
--- a/grub-core/gnulib/argp-parse.c
+++ b/grub-core/gnulib/argp-parse.c
@@ -144,7 +144,7 @@ static const struct argp_option argp_version_options[] =
};
static error_t
-argp_version_parser (int key, char *arg, struct argp_state *state)
+argp_version_parser (int key, char *arg __attribute__((unused)), struct
argp_state *state)
{
switch (key)
{
@@ -714,7 +714,7 @@ parser_parse_arg (struct parser *parser, char *val)
/* Call the user parsers to parse the option OPT, with argument VAL, at the
current position, returning any error. */
static error_t
-parser_parse_opt (struct parser *parser, int opt, char *val)
+parser_parse_opt (struct parser *parser, int opt, char *val
__attribute__((unused)))
{
/* The group key encoded in the high bits; 0 for short opts or
group_number + 1 for long opts. */
diff --git a/grub-core/gnulib/vasnprintf.c b/grub-core/gnulib/vasnprintf.c
index 8fdab32..f636389 100644
--- a/grub-core/gnulib/vasnprintf.c
+++ b/grub-core/gnulib/vasnprintf.c
@@ -1532,7 +1532,7 @@ is_borderline (const char *digits, size_t precision)
of sprintf or SNPRINTF of a single conversion directive. */
static size_t
MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
- arg_type type, int flags, size_t width, int has_precision,
+ arg_type type, int flags __attribute__((unused)), size_t
width, int has_precision,
size_t precision, int pad_ourselves)
{
size_t tmp_length;
@@ -2693,7 +2693,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
errno = EILSEQ;
return NULL;
}
- if (precision < count)
+ if (precision < (size_t)count)
break;
arg_end++;
characters += count;
@@ -4606,13 +4606,17 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
arg_type type = a.arg[dp->arg_index].type;
int flags = dp->flags;
#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR ||
ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO ||
NEED_PRINTF_UNBOUNDED_PRECISION
- int has_width;
size_t width;
#endif
#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 ||
NEED_PRINTF_UNBOUNDED_PRECISION
int has_precision;
size_t precision;
#endif
+#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR ||
ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO ||
NEED_PRINTF_UNBOUNDED_PRECISION
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST ||
NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+ int has_width;
+#endif
+#endif
#if NEED_PRINTF_UNBOUNDED_PRECISION
int prec_ourselves;
#else
@@ -4636,7 +4640,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#endif
#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR ||
ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO ||
NEED_PRINTF_UNBOUNDED_PRECISION
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST ||
NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
has_width = 0;
+#endif
width = 0;
if (dp->width_start != dp->width_end)
{
@@ -4665,7 +4671,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST ||
NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
has_width = 1;
+#endif
}
#endif
@@ -5306,7 +5314,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#endif
#if !USE_SNPRINTF
- if (count >= tmp_length)
+ if ((size_t)count >= tmp_length)
/* tmp_length was incorrectly calculated - fix the
code above! */
abort ();
@@ -5397,7 +5405,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#if DCHAR_IS_TCHAR && !USE_SNPRINTF
/* Make room for the result. */
- if (count > allocated - length)
+ if ((size_t)count > allocated - length)
{
/* Need at least count elements. But allocate
proportionally. */
diff --git a/grub-core/lib/libgcrypt/cipher/rijndael.c
b/grub-core/lib/libgcrypt/cipher/rijndael.c
index 4e8eb3a..b79f0ce 100644
--- a/grub-core/lib/libgcrypt/cipher/rijndael.c
+++ b/grub-core/lib/libgcrypt/cipher/rijndael.c
@@ -181,7 +181,8 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const
unsigned keylen)
static int initialized = 0;
static const char *selftest_failed=0;
int rounds;
- int i,j, r, t, rconpointer = 0;
+ int j, r, t, rconpointer = 0;
+ unsigned i = 0;
int KC;
union
{
--
1.7.8.2
- [PATCH 1/3] "-Wall -Wextra -Werror" compilation patches - part 1/3,
Doron Tsur <=