delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/06/04/20:49:46

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 4 Jun 2008 20:49:13 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: flex 2.5.35-1: isatty() problem (and solution)
Message-ID: <20080605004913.GA19779@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <100308 DOT 36291 DOT qm AT web52812 DOT mail DOT re2 DOT yahoo DOT com>
MIME-Version: 1.0
In-Reply-To: <100308.36291.qm@web52812.mail.re2.yahoo.com>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 Wed, Jun 04, 2008 at 05:37:09PM -0700, Dante Allegria wrote:
>Hi,
>
>Recently, I updated my cygwin flex from 2.5.4 to 2.5.35-1 and my build has been breaking because of changes in flex.skl.
>
>Specifically, I have a problem with extern declaration of isatty in flex.skl. In 2.5.35-1, it is done like this in flex.skl:
>
>%if-c-only
>m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],,
>[[
>    m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
>    [[
>#ifdef __cplusplus
>extern int isatty M4_YY_PARAMS( int );
>#endif /* __cplusplus */
>    ]])
>]])
>%endif
>
>The problem is that I've been long using flex to generate a C skeleton and then compiling it with a C++ compiler. Thus the extern declaration in the generated lexer is #if'ed out since __cplusplus is defined. One might say, well, just don't do that. But AFAICT, this is a sanctioned usage of flex. The flex manual states that it should be possible:
>
>"flex provides two different ways to generate scanners for use with C++. The first way is to simply compile a scanner generated by flex using a C++ compiler instead of a C compiler." [1]
>
>My proposal is to replace:
>
>#ifdef __cplusplus
>extern int isatty M4_YY_PARAMS( int );
>#endif /* __cplusplus */
>
>with a more C/C++ portable construct:
>
>#ifdef __cplusplus
>extern "C"
>{
>#endif /* __cplusplus */
>extern int isatty M4_YY_PARAMS( int );
>#ifdef __cplusplus
>}
>#endif /* __cplusplus */
>
>This solves the problem by allowing both C and C++ compilers to work with generated lex.yy.c files.

If this is a problem, it doesn't sound very cygwin-specific.  I'd
suggest sending it to the upstream maintainers of flex.

See:  http://flex.sourceforge.net/

cgf

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

- Raw text -


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