[systemd-devel] [PATCH 4/5] shared:util : Remove shadow compile warning
From: Philippe De Swert philippedesw...@gmail.com Removes the following compilation warning: src/shared/util.c: In function 'rm_rf_children_dangerous': src/shared/util.c:2800:22: warning: declaration of 'is_dir' shadows a global declaration [-Wshadow] In file included from src/shared/util.c:77:0: src/shared/mkdir.h:45:5: warning: shadowed declaration is here [-Wshadow] --- src/shared/util.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/util.c b/src/shared/util.c index 5f6249e..1545547 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -2797,7 +2797,7 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct for (;;) { struct dirent *de; -bool is_dir, keep_around; +bool is_a_dir, keep_around; struct stat st; int r; @@ -2821,17 +2821,17 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct continue; } -is_dir = S_ISDIR(st.st_mode); +is_a_dir = S_ISDIR(st.st_mode); keep_around = honour_sticky (st.st_uid == 0 || st.st_uid == getuid()) (st.st_mode S_ISVTX); } else { -is_dir = de-d_type == DT_DIR; +is_a_dir = de-d_type == DT_DIR; keep_around = false; } -if (is_dir) { +if (is_a_dir) { int subdir_fd; /* if root_dev is set, remove subdirectories only, if device is same as dir */ -- 1.8.3.2 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 4/5] shared:util : Remove shadow compile warning
On Fri, Oct 17, 2014 at 12:43:52AM +0300, philippedesw...@gmail.com wrote: From: Philippe De Swert philippedesw...@gmail.com Removes the following compilation warning: src/shared/util.c: In function 'rm_rf_children_dangerous': src/shared/util.c:2800:22: warning: declaration of 'is_dir' shadows a global declaration [-Wshadow] In file included from src/shared/util.c:77:0: src/shared/mkdir.h:45:5: warning: shadowed declaration is here [-Wshadow] --- What compiler version are you using? IIRC, gcc used to warn about local variables shadowing globals and then stopped. Zbyszek src/shared/util.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/util.c b/src/shared/util.c index 5f6249e..1545547 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -2797,7 +2797,7 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct for (;;) { struct dirent *de; -bool is_dir, keep_around; +bool is_a_dir, keep_around; struct stat st; int r; @@ -2821,17 +2821,17 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct continue; } -is_dir = S_ISDIR(st.st_mode); +is_a_dir = S_ISDIR(st.st_mode); keep_around = honour_sticky (st.st_uid == 0 || st.st_uid == getuid()) (st.st_mode S_ISVTX); } else { -is_dir = de-d_type == DT_DIR; +is_a_dir = de-d_type == DT_DIR; keep_around = false; } -if (is_dir) { +if (is_a_dir) { int subdir_fd; /* if root_dev is set, remove subdirectories only, if device is same as dir */ -- 1.8.3.2 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 4/5] shared:util : Remove shadow compile warning
Hi, On 17/10/14 02:09, Zbigniew Jędrzejewski-Szmek wrote: On Fri, Oct 17, 2014 at 12:43:52AM +0300, philippedesw...@gmail.com wrote: From: Philippe De Swert philippedesw...@gmail.com Removes the following compilation warning: src/shared/util.c: In function 'rm_rf_children_dangerous': src/shared/util.c:2800:22: warning: declaration of 'is_dir' shadows a global declaration [-Wshadow] In file included from src/shared/util.c:77:0: src/shared/mkdir.h:45:5: warning: shadowed declaration is here [-Wshadow] --- What compiler version are you using? IIRC, gcc used to warn about local variables shadowing globals and then stopped. 4.7.3. Not exactly the latest and greatest. And as I stated in the cover letter these are most likely just cosmetic. The only real problem being the implicit declaration has apparently been fixed just 40 min after I sent my patchset. Anyway not very important patches so if they seem more trouble than they're worth you can just skip them. Cheers, Philippe ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 4/5] shared:util : Remove shadow compile warning
On Fri, Oct 17, 2014 at 02:16:14AM +0300, Philippe De Swert wrote: Hi, On 17/10/14 02:09, Zbigniew Jędrzejewski-Szmek wrote: On Fri, Oct 17, 2014 at 12:43:52AM +0300, philippedesw...@gmail.com wrote: From: Philippe De Swert philippedesw...@gmail.com Removes the following compilation warning: src/shared/util.c: In function 'rm_rf_children_dangerous': src/shared/util.c:2800:22: warning: declaration of 'is_dir' shadows a global declaration [-Wshadow] In file included from src/shared/util.c:77:0: src/shared/mkdir.h:45:5: warning: shadowed declaration is here [-Wshadow] --- What compiler version are you using? IIRC, gcc used to warn about local variables shadowing globals and then stopped. 4.7.3. Not exactly the latest and greatest. And as I stated in the cover letter these are most likely just cosmetic. Anyway not very important patches so if they seem more trouble than they're worth you can just skip them. Well, importance is a relative. False warnings obscure useful warnings, so they are not unimportant. But the diagnostics have improved in 4.8 and 4.9 quite a bit, and I don't think we should clutter code with workarounds for compiler issues that are actually already fixed. The only real problem being the implicit declaration has apparently been fixed just 40 min after I sent my patchset. Ah, OK, I'll then skip that patch too. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel