X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org X-Mailer: YahooMailWebService/0.7.199 Date: Wed, 4 Jun 2008 17:37:09 -0700 (PDT) From: Dante Allegria Reply-To: danteallegria AT yahoo DOT ca Subject: flex 2.5.35-1: isatty() problem (and solution) To: cygwin AT cygwin DOT com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <100308.36291.qm@web52812.mail.re2.yahoo.com> X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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. Thanks, dante 1. http://www.gnu.org/software/flex/manual/html_chapter/flex_19.html#SEC19 __________________________________________________________________ Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php -- 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/