From: Mathieu Lirzin Date: Thu, 18 Jan 2018 22:51:49 +0000 (+0100) Subject: tests: Fix various 'flex' compilation issues X-Git-Tag: v1.16~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=826408a7f6ca4c39ff7b7ac9952c05f48110748f;p=thirdparty%2Fautomake.git tests: Fix various 'flex' compilation issues * t/lex-clean-cxx.sh (parsefoo.lxx): Declare 'yylex': (mainfoo.cc): Make declaration compatible with C++. * t/lex-depend-cxx.sh (joe.ll): Declare 'yylex'. * t/silent-many-languages.sh (Makefile.am, sub/Makefile.am): Link -lfl only with 'fo2' and 'sub/ba2' which are the only program needing it. (foo5.l): Define 'isatty'. (foo6.y): Declare 'yylex'. --- diff --git a/t/lex-clean-cxx.sh b/t/lex-clean-cxx.sh index 838e80380..9b27319ad 100644 --- a/t/lex-clean-cxx.sh +++ b/t/lex-clean-cxx.sh @@ -53,6 +53,8 @@ END cat > parsefoo.lxx << 'END' %{ +#define YY_DECL int yylex (void) +extern "C" YY_DECL; #define YY_NO_UNISTD_H 1 int isatty (int fd) { return 0; } %} @@ -69,10 +71,10 @@ cp parsefoo.lxx parsebar.ll cat > mainfoo.cc << 'END' // This file should contain valid C++ but invalid C. +extern "C" int yylex (void); using namespace std; int main (int argc, char **argv) { - extern int yylex (void); return yylex (); } END diff --git a/t/lex-depend-cxx.sh b/t/lex-depend-cxx.sh index d8b7887be..b6efeb02f 100644 --- a/t/lex-depend-cxx.sh +++ b/t/lex-depend-cxx.sh @@ -46,6 +46,8 @@ END cat > joe.ll << 'END' %{ +#define YY_DECL int yylex (void) +extern "C" YY_DECL; #define YY_NO_UNISTD_H 1 int isatty (int fd) { return 0; } %} diff --git a/t/silent-many-languages.sh b/t/silent-many-languages.sh index 3fd863819..487ce9285 100644 --- a/t/silent-many-languages.sh +++ b/t/silent-many-languages.sh @@ -131,9 +131,9 @@ fo2_FFLAGS = $(AM_FFLAGS) fo2_FCFLAGS = $(AM_FCFLAGS) fo2_YFLAGS = -v fo2_LFLAGS = -n +fo2_LDADD = $(LEXLIB) SUBDIRS = sub AM_YFLAGS = -d -LDADD = $(LEXLIB) BUILT_SOURCES = foo6.h EOF @@ -149,8 +149,8 @@ ba2_FFLAGS = $(AM_FFLAGS) ba2_FCFLAGS = $(AM_FCFLAGS) ba2_YFLAGS = -v ba2_LFLAGS = -n +ba2_LDADD = $(LEXLIB) AM_YFLAGS = -d -LDADD = $(LEXLIB) BUILT_SOURCES = baz6.h EOF @@ -173,6 +173,7 @@ EOF cat > foo5.l <<'EOF' %{ #define YY_NO_UNISTD_H 1 +int isatty (int fd) { return 0; } %} %% "END" return EOF; @@ -186,6 +187,7 @@ int yywrap (void) EOF cat > foo6.y <<'EOF' %{ +extern int yylex (void); void yyerror (char *s) {} %} %token EOF