public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: David Sastre <d.sastre.medina@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Error building run2 from source package in win7
Date: Tue, 24 May 2011 18:38:00 -0000	[thread overview]
Message-ID: <20110524183824.GA11571@jethro.local.lan> (raw)
In-Reply-To: <4DDAA894.5090802@cwilson.fastmail.fm>

[-- Attachment #1: Type: text/plain, Size: 4332 bytes --]

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 function '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 pointer target type
> >> /usr/include/assert.h:41:6: note: expected 'char *' but argument is of type 'const char *'
> > 
> > The signature in assert.h uses 'const char *'; I would have to suspect
> > that somewhere in your build process you have a stray:
> > 
> > #define const
> > 
> > getting in the way,
> 
> I think this is the only possibility, because...
> 
> > 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:
> 
> int
> run2_strtol(char *arg, long *value)
> {
>   char *endptr;
>   int errno_save = errno;
> 
>   assert(arg!=NULL);
> 
> However, the stringization of the expression 'arg!=NULL' 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:
> 
> # define assert(__e) ((__e) ? (void)0 : \
>    __assert_func (__FILE__, __LINE__, \
>    __ASSERT_FUNC, #__e))
> 
> 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:
> 
> void _EXFUN(__assert_func, (const char *, int, const char *,
>   const char *) _ATTRIBUTE ((__noreturn__)));
 
Thanks both for the educational explanation. 
 
> Now, where could a #define const occur?
> 
> $ find ${run2_srcdir} -type f |\
>       xargs grep const | grep define | grep '#'
> ./configure:$as_echo "#define const /**/" >>confdefs.h
> 
> ...more checking...Ah, this is part of the configure macro AC_C_CONST.
> 
> 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 /**/

From 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: $? = 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 = {0,0};
|   const char *g = "string";
|   pcpcc = &g + (g ? g-g : 0);
|   ++pcpcc;
|   ppc = (char**) pcpcc;
|   pcpcc = (char const *const *) ppc;
|   {
|     char *t;
|     char const *s = 0 ? (char *) 0 : (char const *) 0;
|
|     *t++ = 0;
|     if (s) return 0;
|   }
|   {
|     int x[] = {25, 17};
|     const int *foo = &x[0];
|     ++foo;
|   }
|   {
|     typedef const int *iptr;
|     iptr p = 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 = 5;
|   }
|   {
|     const int foo = 10;
|     if (!foo) return 0;
|   }
|   return !cs[0] && !zero.x;
| #endif
|
|   ;
|   return 0;
| }
configure:12809: result: no

-- 
Huella de clave primaria: AD8F BDC0 5A2C FD5F A179  60E7 F79B AB04 5299 EC56

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

  reply	other threads:[~2011-05-24 18:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 17:18 David Sastre
2011-05-23 17:22 ` Eric Blake
2011-05-23 18:34   ` Charles Wilson
2011-05-24 18:38     ` David Sastre [this message]
2011-05-24 18:48       ` Eric Blake
2011-05-24 18:59       ` Charles Wilson
2011-05-24 19:54         ` David Sastre
2011-05-24 21:10           ` Charles Wilson
2011-05-25 10:34             ` David Sastre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110524183824.GA11571@jethro.local.lan \
    --to=d.sastre.medina@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).