www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/05/23/14:34:20

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4DDAA894.5090802@cwilson.fastmail.fm>
Date: Mon, 23 May 2011 14:33:56 -0400
From: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
Reply-To: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Error building run2 from source package in win7
References: <20110523171750 DOT GB16755 AT jethro DOT local DOT lan> <4DDA97CC DOT 1090404 AT redhat DOT com>
In-Reply-To: <4DDA97CC.1090404@redhat.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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.

...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__)));




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'.

--
Chuck

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019