On 12/17/2012 11:20 PM, Pádraig Brady wrote:
On 12/17/2012 11:50 AM, Z. Majeed wrote:
Building latest git source in a non-src directory on cygwin win7 with gcc 4.5.3
is broken
I had to configure --disable-gcc-warnings to avoid the following errors because
gcc 4.5.3 is the latest on cygwin
> and not covered by the ignore warnings pragma in extern-inline.m4 for gcc
4.6 and higher:
CC dtotimespec.o
In file included from dtotimespec.c:25:0:
timespec.h:58:1: error: no previous declaration for 'timespec_cmp'
[-Werror=missing-declarations]
timespec_cmp (struct timespec a, struct timespec b)
That's a possible gnulib issue. I'll CC there separately.
It could be avoided in gnulib as detailed here:
http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00087.html
But I think the attached coreutils patch
which just avoids auto enabling all these gcc
warnings on older compilers is more appropriate.
thanks,
Pádraig.
>From 8b11507d6dec4238dcf441ad2b3da9c8db7442bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Wed, 19 Dec 2012 09:13:21 +0000
Subject: [PATCH] build: avoid --enable-gcc-warnings on GCC <= 4.5
* configure.ac: Only enable warnings automatically when
on GCC >= 4.6 (and when building from a git checkout)
as that was the first GCC version to support fine-grained
control of warnings, allowing them to be adjusted around
certain code sections. gnulib relies on this for certain
warnings, so avoid auto enabling this option lest we trigger
build failures on now over two year old compilers.
Reported by Zartaj Majeed with GCC 4.5.3 on cygwin.
---
configure.ac | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6504144..295802d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,21 +67,6 @@ cu_have_perl=yes
case $PERL in *"/missing "*) cu_have_perl=no;; esac
AM_CONDITIONAL([HAVE_PERL], [test $cu_have_perl = yes])
-AC_ARG_ENABLE([gcc-warnings],
- [AS_HELP_STRING([--enable-gcc-warnings],
- [turn on many GCC warnings (for developers; best with GNU make)])],
- [case $enableval in
- yes|no) ;;
- *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
- esac
- gl_gcc_warnings=$enableval],
- [if test -d "$srcdir"/.git; then
- gl_gcc_warnings=yes
- else
- gl_gcc_warnings=no
- fi]
-)
-
# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
# ------------------------------------------------
# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
@@ -100,6 +85,23 @@ AC_DEFUN([gl_GCC_VERSION_IFELSE],
]
)
+AC_ARG_ENABLE([gcc-warnings],
+ [AS_HELP_STRING([--enable-gcc-warnings],
+ [turn on many GCC warnings (for developers; best with GNU make)])],
+ [case $enableval in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
+ esac
+ gl_gcc_warnings=$enableval],
+ [
+ # GCC provides fine-grained control over diagnostics which
+ # is used in gnulib for example to suppress warnings from
+ # certain sections of code. So if this is available and
+ # we're running from a git repo, then auto enable the warnings.
+ gl_gcc_warnings=no
+ gl_GCC_VERSION_IFELSE([4], [6], [test -d "$srcdir"/.git && gl_gcc_warnings=yes])]
+)
+
if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
--
1.7.6.4