I tried the latest from gnulib via coreutils, and encountered a new failure:
In file included from test-fdutimensat.c:35:0:
test-futimens.h: In function 'test_futimens':
test-futimens.h:95:9: error: declaration of 'fd' shadows a previous local \
[-Werror=shadow]
test-futimens.h:29:7: error: shadowed declaration is here [-Werror=shadow]
cc1: all warnings being treated as errors
I fixed it like this:
>From 90520caf3cfe735b83237a11034b7aa0c3bb05b9 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Sat, 24 Sep 2011 21:02:15 +0200
Subject: [PATCH] test-futimens: avoid a warning from gcc -Wshadow
* tests/test-futimens.h (test_futimens): Rename inner local, s/fd/fd0/
to avoid a shadowing warning.
---
ChangeLog | 6 ++++++
tests/test-futimens.h | 8 ++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9def263..f154617 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-24 Jim Meyering <[email protected]>
+
+ test-futimens: avoid a warning from gcc -Wshadow
+ * tests/test-futimens.h (test_futimens): Rename inner local, s/fd/fd0/
+ to avoid a shadowing warning.
+
2011-09-24 Bruno Haible <[email protected]>
fdopen: Support for MSVC 9.
diff --git a/tests/test-futimens.h b/tests/test-futimens.h
index 2cd7c01..9c9b1bb 100644
--- a/tests/test-futimens.h
+++ b/tests/test-futimens.h
@@ -90,11 +90,11 @@ test_futimens (int (*func) (int, struct timespec const *),
ASSERT (errno == EBADF);
}
{
- int fd = dup (0);
- ASSERT (0 <= fd);
- ASSERT (close (fd) == 0);
+ int fd0 = dup (0);
+ ASSERT (0 <= fd0);
+ ASSERT (close (fd0) == 0);
errno = 0;
- ASSERT (func (fd, NULL) == -1);
+ ASSERT (func (fd0, NULL) == -1);
ASSERT (errno == EBADF);
}
{
--
1.7.7.rc0.362.g5a14