>From 7f2bc63991aeed6ddec5f28dc2162a281ff8ee3d Mon Sep 17 00:00:00 2001 Message-Id: From: Stefano Lattarini Date: Mon, 9 Apr 2012 00:17:48 +0200 Subject: [PATCH] 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 --- tests/README | 4 ++-- tests/lex-clean-cxx.test | 2 +- tests/lex-depend-cxx.test | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/README b/tests/README index 33a653c..b7009ca 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 9ff2dbc..4089f0e 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 5249102..8e7a239 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; . -- 1.7.9