This new warning is debatable: utimecmp.c: In function 'utimecmp': utimecmp.c:222:36: error: comparison between 'enum <anonymous>' and 'enum <anonymous>' [-Wenum-compare]
The code in question: enum { BILLION = 1000 * 1000 * 1000 }; /* Best possible resolution that utimens can set and stat can return, due to system-call limitations. It must be a power of 10 that is no greater than 1 billion. */ #if HAVE_UTIMENSAT enum { SYSCALL_RESOLUTION = 1 }; #elif ((HAVE_FUTIMESAT || HAVE_WORKING_UTIMES) \ && (defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC \ || defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC \ || defined HAVE_STRUCT_STAT_ST_ATIMENSEC \ || defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC \ || defined HAVE_STRUCT_STAT_ST_SPARE1)) enum { SYSCALL_RESOLUTION = 1000 }; #else enum { SYSCALL_RESOLUTION = BILLION }; #endif and here's line 222: if (SYSCALL_RESOLUTION == BILLION) In general I use "enum"s for constants like this, so that defined symbols are accessible in the debugger, but "BILLION" is pretty obvious here, so I prefer to compromise its definition in gnulib, rather than to require each utimecmp-using package (with a strict, non-warning policy) to do something like the following patch, which I wrote but am not going to use in coreutils. So I've pushed this. >From 56a9c0c14e067f5375863981337056a31e45c8f0 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Mon, 11 Jan 2010 16:50:02 +0100 Subject: [PATCH] utimecmp: avoid new warning from upcoming gcc-4.5.0 * lib/utimecmp.c (BILLION): Define using #define rather than an anonymous enum, to placate upcoming gcc-4.5.0's -Wenum-compare. --- ChangeLog | 6 ++++++ lib/utimecmp.c | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 291b88b..d075b31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-01-11 Jim Meyering <meyer...@redhat.com> + + utimecmp: avoid new warning from upcoming gcc-4.5.0 + * lib/utimecmp.c (BILLION): Define using #define rather than an + anonymous enum, to placate upcoming gcc-4.5.0's -Wenum-compare. + 2010-01-11 Eric Blake <e...@byu.net> math: add portability warnings for classification macros diff --git a/lib/utimecmp.c b/lib/utimecmp.c index 81c36b3..63a0c9a 100644 --- a/lib/utimecmp.c +++ b/lib/utimecmp.c @@ -39,7 +39,7 @@ # define MAX(a, b) ((a) > (b) ? (a) : (b)) #endif -enum { BILLION = 1000 * 1000 * 1000 }; +#define BILLION (1000 * 1000 * 1000) /* Best possible resolution that utimens can set and stat can return, due to system-call limitations. It must be a power of 10 that is -- 1.6.6.439.gaf68f >From 77c4d350e18e48214431f321c0d3e598bb0327af Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Mon, 11 Jan 2010 16:29:26 +0100 Subject: [PATCH] build: avoid a warning in gnulib from experimental gcc-4.5.0 * configure.ac (GNULIB_WARN_CFLAGS): Remove -Wenum-compare, to avoid a warning that is new in 4.5.0 20100109. --- configure.ac | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index b07a52b..4c35c02 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,11 @@ if test "$gl_gcc_warnings" = yes; then nw="$nw -Wunused-macros" nw="$nw -Wmissing-prototypes" nw="$nw -Wold-style-definition" + + # The sole violation is in utimecmp.c:222, but it doesn't seem to + # merit the warning or a fix. + gl_WARN_ADD([-Wno-enum-compare]) + gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) AC_SUBST([GNULIB_WARN_CFLAGS]) fi -- 1.6.6.439.gaf68f