Skip to content

Commit 4c6f41f

Browse files
adam900710kdave
authored andcommitted
btrfs-progs: enable -Wshadow for default build
With all the known one fixed, we can enable -Wshadow now. Signed-off-by: Qu Wenruo <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 930c636 commit 4c6f41f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ DISABLE_WARNING_FLAGS := $(call cc-disable-warning, format-truncation) \
8686

8787
# Warnings that we want by default
8888
ENABLE_WARNING_FLAGS := $(call cc-option, -Wimplicit-fallthrough) \
89-
$(call cc-option, -Wmissing-prototypes)
89+
$(call cc-option, -Wmissing-prototypes) \
90+
-Wshadow
9091

9192
ASFLAGS =
9293

Makefile.extrawarn

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ warning-2 := -Waggregate-return
6060
warning-2 += -Wcast-align
6161
warning-2 += -Wdisabled-optimization
6262
warning-2 += -Wnested-externs
63-
warning-2 += -Wshadow
6463
warning-2 += $(call cc-option, -Wlogical-op)
6564
warning-2 += $(call cc-option, -Wmissing-field-initializers)
6665
warning-2 += $(call cc-option, -Wformat-truncation)

tests/fssum.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ sum_fini(sum_t *cs)
185185
}
186186

187187
static void
188-
sum_add(sum_t *cs, void *buf, int size)
188+
sum_add(sum_t *cs, void *data, int size)
189189
{
190-
SHA256Input(&cs->sha, buf, size);
190+
SHA256Input(&cs->sha, data, size);
191191
}
192192

193193
static void
@@ -235,7 +235,7 @@ sum_xattrs(int fd, sum_t *dst)
235235
{
236236
ssize_t buflen;
237237
ssize_t len;
238-
char *buf;
238+
char *buffer;
239239
char *p;
240240
char **names = NULL;
241241
int num_xattrs = 0;
@@ -249,11 +249,11 @@ sum_xattrs(int fd, sum_t *dst)
249249
if (buflen == 0)
250250
return 0;
251251

252-
buf = malloc(buflen);
253-
if (!buf)
252+
buffer = malloc(buflen);
253+
if (!buffer)
254254
return -ENOMEM;
255255

256-
buflen = flistxattr(fd, buf, buflen);
256+
buflen = flistxattr(fd, buffer, buflen);
257257
if (buflen < 0) {
258258
ret = -errno;
259259
goto out;
@@ -265,7 +265,7 @@ sum_xattrs(int fd, sum_t *dst)
265265
* on different filesystems.
266266
*/
267267

268-
p = buf;
268+
p = buffer;
269269
len = buflen;
270270
while (len > 0) {
271271
int keylen;
@@ -282,7 +282,7 @@ sum_xattrs(int fd, sum_t *dst)
282282
goto out;
283283
}
284284

285-
p = buf;
285+
p = buffer;
286286
for (i = 0; i < num_xattrs; i++) {
287287
names[i] = p;
288288
p += strlen(p) + 1; /* +1 for NULL terminator */
@@ -315,7 +315,7 @@ sum_xattrs(int fd, sum_t *dst)
315315
free(p);
316316
}
317317
out:
318-
free(buf);
318+
free(buffer);
319319
free(names);
320320

321321
return ret;

0 commit comments

Comments
 (0)