Subject: [PATCH] tests: Don't try to prevent flex to include unistd.h
From: Frederic Berat <[email-masked]>
To: [email-masked]
Cc: Frédéric Bérat <[email-masked]>
Date: Mon, 12 Dec 2022 08:07:52 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

From: Frédéric Bérat <[email-masked]>

Hello,

This patch is mainly a proposal. While the macro can simply be removed
as explained below, another possibility it to add a flex option
"--never-interactive" to prevent flex to make use of "isatty".

-- 8< --

This is related to an effort to prepare Automake for future GCC/Clang
versions which set c99 as default standard to be used.

Future version of flex make the "NO_UNISTD" flag a no-op, and include
unistd.h by default.

In current version of flex, not having this header leads to implicit
function declarations that are not compatible with c99 standard.

On top of that, while flex dedicated test were having this macro set,
the yacc ones didn't have it despise their use of Flex. Thus, if this
macro was ever useful, it looks like nobody actually cared.

---
 t/cond35.sh       | 3 ---
 t/lex-clean.sh    | 3 ---
 t/lex-depend.sh   | 3 ---
 t/lex-header.sh   | 3 ---
 t/lex-lib.sh      | 3 ---
 t/lex-libobj.sh   | 3 ---
 t/lex-line.sh     | 3 ---
 t/lex-multiple.sh | 3 ---
 t/lex-nodist.sh   | 3 ---
 t/lex-noyywrap.sh | 3 ---
 t/lex3.sh         | 3 ---
 t/lex5.sh         | 3 ---
 t/lexvpath.sh     | 9 ---------
 t/silent-lex.sh   | 3 ---
 14 files changed, 48 deletions(-)

diff --git a/t/cond35.sh b/t/cond35.sh
index bad133970..435e02ffc 100644
--- a/t/cond35.sh
+++ b/t/cond35.sh
@@ -58,9 +58,6 @@ $FGREP 'tparse.h' Makefile.in # For debugging.
 test $($FGREP -c 'tparse.h:' Makefile.in) -eq 1
 
 cat > tscan.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"   return EOF;
 %%
diff --git a/t/lex-clean.sh b/t/lex-clean.sh
index e53da8fd2..6ab451173 100644
--- a/t/lex-clean.sh
+++ b/t/lex-clean.sh
@@ -52,9 +52,6 @@ LDADD = $(LEXLIB)
 END
 
 cat > lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
diff --git a/t/lex-depend.sh b/t/lex-depend.sh
index c6fde8c1f..7fbf60370 100644
--- a/t/lex-depend.sh
+++ b/t/lex-depend.sh
@@ -42,9 +42,6 @@ test-obj-updated: joe.$(OBJEXT)
 END
 
 cat > joe.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "foo" return EOF;
 .
diff --git a/t/lex-header.sh b/t/lex-header.sh
index 73beb95b6..46e8be60c 100644
--- a/t/lex-header.sh
+++ b/t/lex-header.sh
@@ -45,9 +45,6 @@ END
 
 cat > lexer.l << 'END'
 %option noyywrap
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
diff --git a/t/lex-lib.sh b/t/lex-lib.sh
index a251534d5..4ec75abe4 100644
--- a/t/lex-lib.sh
+++ b/t/lex-lib.sh
@@ -47,9 +47,6 @@ int yywrap (void)
 END
 
 cat > foo.l <<'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
diff --git a/t/lex-libobj.sh b/t/lex-libobj.sh
index 5d4c13ebd..50ac10bb0 100644
--- a/t/lex-libobj.sh
+++ b/t/lex-libobj.sh
@@ -45,9 +45,6 @@ int yywrap (void)
 END
 
 cat > foo.l <<'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
diff --git a/t/lex-line.sh b/t/lex-line.sh
index ef2a2a808..6107d0664 100644
--- a/t/lex-line.sh
+++ b/t/lex-line.sh
@@ -57,9 +57,6 @@ dir/quux.@OBJEXT@: dir/quux.c
 END
 
 cat > zardoz.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"  return EOF;
 .
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
index bf119ec84..5f4695deb 100644
--- a/t/lex-multiple.sh
+++ b/t/lex-multiple.sh
@@ -76,9 +76,6 @@ int main (int argc, char *argv[])
 END
 
 cat > 0.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "VANILLA" { printf (":%s:\n", yytext); return 121; }
 . { printf (":%s:\n", yytext); return 1; }
diff --git a/t/lex-nodist.sh b/t/lex-nodist.sh
index 187dd5437..4a4d0f01c 100644
--- a/t/lex-nodist.sh
+++ b/t/lex-nodist.sh
@@ -45,9 +45,6 @@ check-local: test-build test-dist
 lexer.l:
 	rm -f $@ $@-t
 	:; { : \
-	  && echo '%{' \
-	  && echo '#define YY_NO_UNISTD_H 1' \
-	  && echo '%}' \
 	  && echo '%%' \
 	  && echo '"GOOD" return EOF;' \
 	  && echo '.'; \
diff --git a/t/lex-noyywrap.sh b/t/lex-noyywrap.sh
index c11813429..0451dbcf5 100644
--- a/t/lex-noyywrap.sh
+++ b/t/lex-noyywrap.sh
@@ -37,9 +37,6 @@ END
 
 cat > foo.l << 'END'
 %option noyywrap
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
diff --git a/t/lex3.sh b/t/lex3.sh
index 7de5fe2a6..9e54e7abf 100644
--- a/t/lex3.sh
+++ b/t/lex3.sh
@@ -33,9 +33,6 @@ foo_SOURCES = foo.l
 END
 
 cat > foo.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
diff --git a/t/lex5.sh b/t/lex5.sh
index 0563a35ee..da354e2ac 100644
--- a/t/lex5.sh
+++ b/t/lex5.sh
@@ -36,9 +36,6 @@ END
 mkdir foo
 
 cat > foo/foo.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"   return EOF;
 .
diff --git a/t/lexvpath.sh b/t/lexvpath.sh
index 84187a916..33fab0a80 100644
--- a/t/lexvpath.sh
+++ b/t/lexvpath.sh
@@ -44,9 +44,6 @@ END
 
 # Original lexer, with a "foobar" comment
 cat > lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
@@ -89,9 +86,6 @@ $sleep
 
 # New lexer, with 'fubar' comment.
 cat > ../lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
@@ -112,9 +106,6 @@ $sleep
 
 # New lexer, with 'maude' comment.
 cat > ../lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
diff --git a/t/silent-lex.sh b/t/silent-lex.sh
index f319eee93..c15a30a9d 100644
--- a/t/silent-lex.sh
+++ b/t/silent-lex.sh
@@ -50,9 +50,6 @@ LDADD = $(LEXLIB)
 EOF
 
 cat > foo.l <<'EOF'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"   return EOF;
 .
-- 
2.38.1