From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19624 invoked by alias); 24 May 2011 18:38:46 -0000 Received: (qmail 19614 invoked by uid 22791); 24 May 2011 18:38:45 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ww0-f45.google.com (HELO mail-ww0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 May 2011 18:38:30 +0000 Received: by wwi36 with SMTP id 36so6281097wwi.2 for ; Tue, 24 May 2011 11:38:29 -0700 (PDT) Received: by 10.227.55.6 with SMTP id s6mr3763226wbg.112.1306262308564; Tue, 24 May 2011 11:38:28 -0700 (PDT) Received: from localhost (144.145.217.87.dynamic.jazztel.es [87.217.145.144]) by mx.google.com with ESMTPS id o23sm4953983wbc.27.2011.05.24.11.38.26 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 May 2011 11:38:27 -0700 (PDT) Date: Tue, 24 May 2011 18:38:00 -0000 From: David Sastre To: cygwin@cygwin.com Subject: Re: Error building run2 from source package in win7 Message-ID: <20110524183824.GA11571@jethro.local.lan> References: <20110523171750.GB16755@jethro.local.lan> <4DDA97CC.1090404@redhat.com> <4DDAA894.5090802@cwilson.fastmail.fm> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline In-Reply-To: <4DDAA894.5090802@cwilson.fastmail.fm> User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-05/txt/msg00348.txt.bz2 --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 4278 On Mon, May 23, 2011 at 02:33:56PM -0400, Charles Wilson wrote: > On 5/23/2011 1:22 PM, Eric Blake wrote: > > On 05/23/2011 11:17 AM, David Sastre wrote: > >> cc1: warnings being treated as errors > >> /usr/src/run2-0.4.0-1-src/run2-0.4.0-1/src/run2-0.4.0/lib/util.c: In f= unction 'run2_strtol': > >> /usr/src/run2-0.4.0-1-src/run2-0.4.0-1/src/run2-0.4.0/lib/util.c:423:3= : error: passing argument 3 of '__assert_func' discards qualifiers from poi= nter target type > >> /usr/include/assert.h:41:6: note: expected 'char *' but argument is of= type 'const char *' > >=20 > > The signature in assert.h uses 'const char *'; I would have to suspect > > that somewhere in your build process you have a stray: > >=20 > > #define const > >=20 > > getting in the way, >=20 > I think this is the only possibility, because... >=20 > > and that this is thus a bug in the run2 sources and > > not in cygwin headers. FWIW, I never meant to have found a bug in cygwin nor in the run2 sources. I'm just failing to build it and I hoped your wisdom might help me. > ...the code does this: >=20 > int > run2_strtol(char *arg, long *value) > { > char *endptr; > int errno_save =3D errno; >=20 > assert(arg!=3DNULL); >=20 > However, the stringization of the expression 'arg!=3DNULL' is passed as > arg #4 (and the expression itself doesn't appear in the argument list of > __assert_func at all; see definition below). Anyway, the #3 argument of > __assert_func is __ASSERT_FUNC: >=20 > # define assert(__e) ((__e) ? (void)0 : \ > __assert_func (__FILE__, __LINE__, \ > __ASSERT_FUNC, #__e)) >=20 > and __ASSERT_FUNC is defined as > __PRETTY_FUNCTION__ > __func__ > or __FUNCTION__ > depending on the compiler and various flags. Now, since these are > built-ins, the "signature" is fixed: they are all const char*. So the > only way you could get this warning/error is if assert.h is "messed up" > somehow...e.g. as Eric suggests, because an earlier header has #defined > const away before the following decl in assert.h is parsed: >=20 > void _EXFUN(__assert_func, (const char *, int, const char *, > const char *) _ATTRIBUTE ((__noreturn__))); =20 Thanks both for the educational explanation.=20 =20 > Now, where could a #define const occur? >=20 > $ find ${run2_srcdir} -type f |\ > xargs grep const | grep define | grep '#' > ./configure:$as_echo "#define const /**/" >>confdefs.h >=20 > ...more checking...Ah, this is part of the configure macro AC_C_CONST. >=20 > hmm...maybe the OP should check his generated config.h file for the > offending def. If it's there, a quick look inside config.log should > tell you why 'checking for an ANSI C-conforming const' is reporting 'no'. $ grep -nR "define const" run2-0.4.0-1/build/config.h 152:#define const /**/ =46rom the config.log: configure:12737: checking for an ANSI C-conforming const configure:12802: gcc -c -Wall -Werror conftest.c >&5 cc1: warnings being treated as errors conftest.c: In function 'main': conftest.c:69:10: error: 't' is used uninitialized in this function conftest.c:85:23: error: 'b' may be used uninitialized in this function configure:12802: $? =3D 1 configure: failed program was: (snipped defines and removed comments) | int | main () | { | #ifndef __cplusplus | typedef int charset[2]; | const charset cs; | char const *const *pcpcc; | char **ppc; | struct point {int x, y;}; | static struct point const zero =3D {0,0}; | const char *g =3D "string"; | pcpcc =3D &g + (g ? g-g : 0); | ++pcpcc; | ppc =3D (char**) pcpcc; | pcpcc =3D (char const *const *) ppc; | { | char *t; | char const *s =3D 0 ? (char *) 0 : (char const *) 0; | | *t++ =3D 0; | if (s) return 0; | } | { | int x[] =3D {25, 17}; | const int *foo =3D &x[0]; | ++foo; | } | { | typedef const int *iptr; | iptr p =3D 0; | ++p; | } | { | "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue= . */ | struct s { int j; const int *ap[3]; }; | struct s *b; b->j =3D 5; | } | { | const int foo =3D 10; | if (!foo) return 0; | } | return !cs[0] && !zero.x; | #endif | | ; | return 0; | } configure:12809: result: no --=20 Huella de clave primaria: AD8F BDC0 5A2C FD5F A179 60E7 F79B AB04 5299 EC56 --3V7upXqbjpZ4EhLz Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline Content-length: 230 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EAREIAAYFAk3b+yAACgkQ95urBFKZ7FauRAD/bt01VPAl+QolB0sD86+8+YER QyUpe7B1UIGDHIHYh3EA/3IV90Aiu55N6klzDlv3YysuVcOKzQZ2Y2kZugxY2EPh =0ik6 -----END PGP SIGNATURE----- --3V7upXqbjpZ4EhLz--