bug#20536: avoid new gcc warning: ENOTSUP vs EOPNOTSUPP
On Sun, May 10, 2015 at 7:17 AM, Paul Eggert wrote: > Jim Meyering wrote: >> >> + return err == EOPNOTSUPP >> +#if ENOTSUP != EOPNOTSUPP >> +|| err == ENOTSUP >> +#endif >> +; > > Would the following work instead? It's a bit cleaner to avoid #if: > > return err == EOPNOTSUPP || (ENOTSUP != EOPNOTSUPP && err == ENOTSUP); I confirmed that too avoids the warning, so I've pushed it in your name.
bug#20536: avoid new gcc warning: ENOTSUP vs EOPNOTSUPP
Jim Meyering wrote: + return err == EOPNOTSUPP +#if ENOTSUP != EOPNOTSUPP +|| err == ENOTSUP +#endif +; Would the following work instead? It's a bit cleaner to avoid #if: return err == EOPNOTSUPP || (ENOTSUP != EOPNOTSUPP && err == ENOTSUP);
bug#20536: avoid new gcc warning: ENOTSUP vs EOPNOTSUPP
On 09/05/15 19:15, Jim Meyering wrote: > Building with very new gcc-from-git, I encountered 3 new warnings. > Here's a patch to address them: > > Without this change, very recent gcc (e.g., version 6.0.0 20150509) > would print the following when configured with --enable-gcc-warnings: > > src/copy.c:165:30: error: logical 'or' of equal expressions \ > [-Werror=logical-op] > && (errno == EOPNOTSUPP || errno == ENOTSUP || errno == ENOSYS)) >^ > * src/system.h (is_ENOTSUP): New function. > * src/copy.c (punch_hole): Use it. > * src/ls.c (errno_unsupported, gobble_file): Use it. Not sure I agree with GCC's warning here, but the fix looks good. Marking this as done. thanks! Pádraig
bug#20536: avoid new gcc warning: ENOTSUP vs EOPNOTSUPP
Building with very new gcc-from-git, I encountered 3 new warnings. Here's a patch to address them: Without this change, very recent gcc (e.g., version 6.0.0 20150509) would print the following when configured with --enable-gcc-warnings: src/copy.c:165:30: error: logical 'or' of equal expressions \ [-Werror=logical-op] && (errno == EOPNOTSUPP || errno == ENOTSUP || errno == ENOSYS)) ^ * src/system.h (is_ENOTSUP): New function. * src/copy.c (punch_hole): Use it. * src/ls.c (errno_unsupported, gobble_file): Use it. 0001-build-avoid-a-warning-form-gcc-s-new-Wlogical-op.patch Description: Binary data