<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-legacy-support.
</pre>
<p><a href="https://github.com/macports/macports-legacy-support/commit/8c1dbd02a467d0a6d8cdfc47a76e714520d32162">https://github.com/macports/macports-legacy-support/commit/8c1dbd02a467d0a6d8cdfc47a76e714520d32162</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 8c1dbd02a467d0a6d8cdfc47a76e714520d32162
</span>Author: Fred Wright <fw@fwright.net>
AuthorDate: Wed Feb 19 20:34:10 2025 -0800
<span style='display:block; white-space:pre;color:#404040;'> test_stat: Fix "shadowing" warnings.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> After enabling -Wshadow in tests to catch the 'dirname' shadowing
</span><span style='display:block; white-space:pre;color:#404040;'> issue in the headers, this tests now gets that warning. Adjust a name
</span><span style='display:block; white-space:pre;color:#404040;'> to fix that.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> TESTED:
</span><span style='display:block; white-space:pre;color:#404040;'> No longer gets shadowing warnings with -Wshadow.
</span>---
test/test_stat.c | 84 ++++++++++++++++++++++++++++----------------------------
1 file changed, 42 insertions(+), 42 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/test/test_stat.c b/test/test_stat.c
</span><span style='display:block; white-space:pre;color:#808080;'>index fd007cc..125c381 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/test/test_stat.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/test/test_stat.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -65,26 +65,26 @@ stat_init(int ino64)
</span> }
static void
<span style='display:block; white-space:pre;background:#ffe0e0;'>-copy_stat_std(int link)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+copy_stat_std(int uselink)
</span> {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- safe_stat_t *dest = link ? &stat_link_copy : &stat_copy;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ safe_stat_t *dest = uselink ? &stat_link_copy : &stat_copy;
</span> dest->s = stat_buf.s;
}
static void
<span style='display:block; white-space:pre;background:#ffe0e0;'>-copy_stat_64(int link)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+copy_stat_64(int uselink)
</span> {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- safe_stat_t *dest = link ? &stat_link_copy : &stat_copy;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ safe_stat_t *dest = uselink ? &stat_link_copy : &stat_copy;
</span> dest->s64 = stat_buf.s64;
}
static void
<span style='display:block; white-space:pre;background:#ffe0e0;'>-copy_stat(int ino64, int link)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+copy_stat(int ino64, int uselink)
</span> {
if (!ino64) {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- copy_stat_std(link);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ copy_stat_std(uselink);
</span> } else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- copy_stat_64(link);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ copy_stat_64(uselink);
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -95,9 +95,9 @@ ts_equal(const struct timespec *a, const struct timespec *b)
</span> }
static void
<span style='display:block; white-space:pre;background:#ffe0e0;'>-check_copy_std(int link)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+check_copy_std(int uselink)
</span> {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- const safe_stat_t *copy = link ? &stat_link_copy : &stat_copy;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const safe_stat_t *copy = uselink ? &stat_link_copy : &stat_copy;
</span>
assert(stat_buf.s.s.st_dev == copy->s.s.st_dev);
assert(stat_buf.s.s.st_ino == copy->s.s.st_ino);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -121,9 +121,9 @@ check_copy_std(int link)
</span> }
static void
<span style='display:block; white-space:pre;background:#ffe0e0;'>-check_copy_64(int link)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+check_copy_64(int uselink)
</span> {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- const safe_stat_t *copy = link ? &stat_link_copy : &stat_copy;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const safe_stat_t *copy = uselink ? &stat_link_copy : &stat_copy;
</span>
assert(stat_buf.s64.s.st_dev == copy->s64.s.st_dev);
assert(stat_buf.s64.s.st_mode == copy->s64.s.st_mode);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -146,12 +146,12 @@ check_copy_64(int link)
</span> }
static void
<span style='display:block; white-space:pre;background:#ffe0e0;'>-check_copy(int ino64, int link)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+check_copy(int ino64, int uselink)
</span> {
if (!ino64) {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- check_copy_std(link);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ check_copy_std(uselink);
</span> } else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- check_copy_64(link);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ check_copy_64(uselink);
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -245,11 +245,11 @@ main(int argc, char *argv[])
</span> assert(S_ISREG(get_mode(0)) && "stat expected regular file");
copy_stat(0, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'stat' of link\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'stat' of uselink\n");
</span> stat_init(0);
stat_err = stat(source_link, &stat_buf.s.s);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (check_err("stat of link")) return 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- assert(S_ISREG(get_mode(0)) && "stat of link expected regular file");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (check_err("stat of uselink")) return 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ assert(S_ISREG(get_mode(0)) && "stat of uselink expected regular file");
</span> check_copy(0, 0);
if (verbose) printf(" testing 'lstat'\n");
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -278,11 +278,11 @@ main(int argc, char *argv[])
</span> assert(S_ISREG(get_mode(1)) && "stat64 expected regular file");
copy_stat(1, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'stat64' of link\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'stat64' of uselink\n");
</span> stat_init(1);
stat_err = stat64(source_link, &stat_buf.s64.s);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (check_err("stat64 of link")) return 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- assert(S_ISREG(get_mode(1)) && "stat64 of link expected regular file");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (check_err("stat64 of uselink")) return 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ assert(S_ISREG(get_mode(1)) && "stat64 of uselink expected regular file");
</span> check_copy(1, 0);
if (verbose) printf(" testing 'lstat64'\n");
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -315,15 +315,15 @@ main(int argc, char *argv[])
</span> assert(S_ISREG(get_mode(0)) && "fstatat (AT_FDCWD) expected regular file");
check_copy(0, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'fstatat' (AT_FDCWD) of link\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'fstatat' (AT_FDCWD) of uselink\n");
</span> stat_init(0);
stat_err = fstatat(AT_FDCWD, source_link, &stat_buf.s.s, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (check_err("fstatat (AT_FDCWD) of link")) return 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (check_err("fstatat (AT_FDCWD) of uselink")) return 1;
</span> assert(S_ISREG(get_mode(0))
<span style='display:block; white-space:pre;background:#ffe0e0;'>- && "fstatat (AT_FDCWD) of link expected regular file");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && "fstatat (AT_FDCWD) of uselink expected regular file");
</span> check_copy(0, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'fstatat' (AT_FDCWD) of link (NOFOLLOW)\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'fstatat' (AT_FDCWD) of uselink (NOFOLLOW)\n");
</span> stat_init(0);
stat_err = fstatat(AT_FDCWD, source_link, &stat_buf.s.s,
AT_SYMLINK_NOFOLLOW);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -340,14 +340,14 @@ main(int argc, char *argv[])
</span> assert(S_ISREG(get_mode(0)) && "fstatat (dir) expected regular file");
check_copy(0, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'fstatat' (dir) of link\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'fstatat' (dir) of uselink\n");
</span> stat_init(0);
stat_err = fstatat(fd, rel_link, &stat_buf.s.s, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (check_err("fstatat (dir) of link")) return 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- assert(S_ISREG(get_mode(0)) && "fstatat (dir) of link expected regular file");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (check_err("fstatat (dir) of uselink")) return 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ assert(S_ISREG(get_mode(0)) && "fstatat (dir) of uselink expected regular file");
</span> check_copy(0, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'fstatat' (dir) of link (NOFOLLOW)\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'fstatat' (dir) of uselink (NOFOLLOW)\n");
</span> stat_init(0);
stat_err = fstatat(fd, rel_link, &stat_buf.s.s,
AT_SYMLINK_NOFOLLOW);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -373,15 +373,15 @@ main(int argc, char *argv[])
</span> assert(S_ISREG(get_mode(1)) && "fstatat64 (AT_FDCWD) expected regular file");
check_copy(1, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'fstatat64' (AT_FDCWD) of link\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'fstatat64' (AT_FDCWD) of uselink\n");
</span> stat_init(1);
stat_err = fstatat64(AT_FDCWD, source_link, &stat_buf.s64.s, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (check_err("fstatat64 (AT_FDCWD) of link")) return 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (check_err("fstatat64 (AT_FDCWD) of uselink")) return 1;
</span> assert(S_ISREG(get_mode(1))
<span style='display:block; white-space:pre;background:#ffe0e0;'>- && "fstatat64 (AT_FDCWD) of link expected regular file");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && "fstatat64 (AT_FDCWD) of uselink expected regular file");
</span> check_copy(1, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'fstatat64' (AT_FDCWD) of link (NOFOLLOW)\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'fstatat64' (AT_FDCWD) of uselink (NOFOLLOW)\n");
</span> stat_init(1);
stat_err = fstatat64(AT_FDCWD, source_link, &stat_buf.s64.s,
AT_SYMLINK_NOFOLLOW);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -398,15 +398,15 @@ main(int argc, char *argv[])
</span> assert(S_ISREG(get_mode(1)) && "fstatat64 (dir) expected regular file");
check_copy(1, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'fstatat64' (dir) of link\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'fstatat64' (dir) of uselink\n");
</span> stat_init(1);
stat_err = fstatat64(fd, rel_link, &stat_buf.s64.s, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (check_err("fstatat64 (dir) of link")) return 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (check_err("fstatat64 (dir) of uselink")) return 1;
</span> assert(S_ISREG(get_mode(1))
<span style='display:block; white-space:pre;background:#ffe0e0;'>- && "fstatat64 (dir) of link expected regular file");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && "fstatat64 (dir) of uselink expected regular file");
</span> check_copy(1, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'fstatat64' (dir) of link (NOFOLLOW)\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'fstatat64' (dir) of uselink (NOFOLLOW)\n");
</span> stat_init(1);
stat_err = fstatat64(fd, rel_link, &stat_buf.s64.s,
AT_SYMLINK_NOFOLLOW);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -432,11 +432,11 @@ main(int argc, char *argv[])
</span> assert(S_ISREG(get_mode(0)) && "statx_np expected regular file");
check_copy(0, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'statx_np' of link\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'statx_np' of uselink\n");
</span> stat_init(0);
stat_err = statx_np(source_link, &stat_buf.s.s, fsec);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (check_err("statx_np of link")) return 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- assert(S_ISREG(get_mode(0)) && "statx_np of link expected regular file");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (check_err("statx_np of uselink")) return 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ assert(S_ISREG(get_mode(0)) && "statx_np of uselink expected regular file");
</span> check_copy(0, 0);
if (verbose) printf(" testing 'lstatx_np'\n");
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -475,11 +475,11 @@ main(int argc, char *argv[])
</span> assert(S_ISREG(get_mode(1)) && "statx64_np expected regular file");
check_copy(1, 0);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (verbose) printf(" testing 'statx64_np' of link\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (verbose) printf(" testing 'statx64_np' of uselink\n");
</span> stat_init(1);
stat_err = statx64_np(source_link, &stat_buf.s64.s, fsec);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (check_err("statx64_np of link")) return 1;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- assert(S_ISREG(get_mode(1)) && "statx64_np of link expected regular file");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (check_err("statx64_np of uselink")) return 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ assert(S_ISREG(get_mode(1)) && "statx64_np of uselink expected regular file");
</span> check_copy(1, 0);
if (verbose) printf(" testing 'lstatx64_np'\n");
</pre><pre style='margin:0'>
</pre>