From: Stefano Lattarini Date: Sun, 8 Apr 2012 22:17:48 +0000 (+0200) Subject: tests: avoid spurious failures with non-flex 'lex' programs and C++ X-Git-Tag: v1.11b~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=v1.11-2128-g7f2bc63;p=thirdparty%2Fautomake.git tests: avoid spurious failures with non-flex 'lex' programs and C++ This change fixes automake bug#11185. The commit v1.11-2058-g6f4b08d of 06-03-2012, "tests: explicitly state that our lexers do not require unistd.h" has broken the tests 'lex-clean-cxx.test' and 'lex-depend-cxx.test' on Solaris, where lex is not flex and does not understand the "%option never-interactive" directive. Remove the use of this directive, resorting to defining a dummy 'isatty()' function instead to keep the flex-generated tests able to compile also on MinGW/MSYS. * tests/lex-clean-cxx.test (parsefoo.lxx): Define a dummy 'isatty()' function. * tests/lex-depend-cxx.test (joe.ll): Likewise. * tests/README: Adjust. Fix an unrelated typo since we are at it. Co-authored-by: Peter Rosin Signed-off-by: Stefano Lattarini --- diff --git a/tests/README b/tests/README index 33a653c71..b7009ca7a 100644 --- a/tests/README +++ b/tests/README @@ -268,9 +268,9 @@ Do %{ #define YY_NO_UNISTD_H 1 %} - to accomodate non-ANSI systems, since GNU flex generates code that + to accommodate non-ANSI systems, since GNU flex generates code that includes unistd.h otherwise. Also add: - %option never-interactive + static int isatty (int fd) { return 0; } to the definitions section if the generated code is to be compiled by a C++ compiler, for similar reasons (i.e., the isatty(3) function from that same unistd.h header would be required otherwise). diff --git a/tests/lex-clean-cxx.test b/tests/lex-clean-cxx.test index 9ff2dbc00..4089f0e2b 100755 --- a/tests/lex-clean-cxx.test +++ b/tests/lex-clean-cxx.test @@ -55,8 +55,8 @@ END cat > parsefoo.lxx << 'END' %{ #define YY_NO_UNISTD_H 1 +static int isatty (int fd) { return 0; } %} -%option never-interactive %% "GOOD" return EOF; . diff --git a/tests/lex-depend-cxx.test b/tests/lex-depend-cxx.test index 52491022b..8e7a2391c 100755 --- a/tests/lex-depend-cxx.test +++ b/tests/lex-depend-cxx.test @@ -48,8 +48,8 @@ END cat > joe.ll << 'END' %{ #define YY_NO_UNISTD_H 1 +static int isatty (int fd) { return 0; } %} -%option never-interactive %% "foo" return EOF; .