btrfs-progs: enable -Wshadow for default build
With all the known one fixed, we can enable -Wshadow now. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
930c6362d1
commit
4c6f41f2b8
3
Makefile
3
Makefile
|
@ -86,7 +86,8 @@ DISABLE_WARNING_FLAGS := $(call cc-disable-warning, format-truncation) \
|
||||||
|
|
||||||
# Warnings that we want by default
|
# Warnings that we want by default
|
||||||
ENABLE_WARNING_FLAGS := $(call cc-option, -Wimplicit-fallthrough) \
|
ENABLE_WARNING_FLAGS := $(call cc-option, -Wimplicit-fallthrough) \
|
||||||
$(call cc-option, -Wmissing-prototypes)
|
$(call cc-option, -Wmissing-prototypes) \
|
||||||
|
-Wshadow
|
||||||
|
|
||||||
ASFLAGS =
|
ASFLAGS =
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ warning-2 := -Waggregate-return
|
||||||
warning-2 += -Wcast-align
|
warning-2 += -Wcast-align
|
||||||
warning-2 += -Wdisabled-optimization
|
warning-2 += -Wdisabled-optimization
|
||||||
warning-2 += -Wnested-externs
|
warning-2 += -Wnested-externs
|
||||||
warning-2 += -Wshadow
|
|
||||||
warning-2 += $(call cc-option, -Wlogical-op)
|
warning-2 += $(call cc-option, -Wlogical-op)
|
||||||
warning-2 += $(call cc-option, -Wmissing-field-initializers)
|
warning-2 += $(call cc-option, -Wmissing-field-initializers)
|
||||||
warning-2 += $(call cc-option, -Wformat-truncation)
|
warning-2 += $(call cc-option, -Wformat-truncation)
|
||||||
|
|
|
@ -185,9 +185,9 @@ sum_fini(sum_t *cs)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sum_add(sum_t *cs, void *buf, int size)
|
sum_add(sum_t *cs, void *data, int size)
|
||||||
{
|
{
|
||||||
SHA256Input(&cs->sha, buf, size);
|
SHA256Input(&cs->sha, data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -235,7 +235,7 @@ sum_xattrs(int fd, sum_t *dst)
|
||||||
{
|
{
|
||||||
ssize_t buflen;
|
ssize_t buflen;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
char *buf;
|
char *buffer;
|
||||||
char *p;
|
char *p;
|
||||||
char **names = NULL;
|
char **names = NULL;
|
||||||
int num_xattrs = 0;
|
int num_xattrs = 0;
|
||||||
|
@ -249,11 +249,11 @@ sum_xattrs(int fd, sum_t *dst)
|
||||||
if (buflen == 0)
|
if (buflen == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
buf = malloc(buflen);
|
buffer = malloc(buflen);
|
||||||
if (!buf)
|
if (!buffer)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
buflen = flistxattr(fd, buf, buflen);
|
buflen = flistxattr(fd, buffer, buflen);
|
||||||
if (buflen < 0) {
|
if (buflen < 0) {
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -265,7 +265,7 @@ sum_xattrs(int fd, sum_t *dst)
|
||||||
* on different filesystems.
|
* on different filesystems.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
p = buf;
|
p = buffer;
|
||||||
len = buflen;
|
len = buflen;
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
int keylen;
|
int keylen;
|
||||||
|
@ -282,7 +282,7 @@ sum_xattrs(int fd, sum_t *dst)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = buf;
|
p = buffer;
|
||||||
for (i = 0; i < num_xattrs; i++) {
|
for (i = 0; i < num_xattrs; i++) {
|
||||||
names[i] = p;
|
names[i] = p;
|
||||||
p += strlen(p) + 1; /* +1 for NULL terminator */
|
p += strlen(p) + 1; /* +1 for NULL terminator */
|
||||||
|
@ -315,7 +315,7 @@ sum_xattrs(int fd, sum_t *dst)
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
free(buf);
|
free(buffer);
|
||||||
free(names);
|
free(names);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue