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/

Reply via email to