[bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

2023-01-14 Thread Karl Berry
The *command line option* --never-interactive was added
in version 2.5.6 (along with long command line options in general).
That version was released somewhere between 2002-04-19 and 2002-04-23;

I guess 20 years ago is long enough, barely :). Though if it's just as
easy to use the %option, why not ... since we already have to assume
flex (specifically) either way ... --thanks, karl.






[bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

2023-01-14 Thread Zack Weinberg
On Fri, Jan 13, 2023, at 6:33 PM, Karl Berry wrote:
>> your patch *and* consistently test flex with "--never-interactive".
>
> Making flex non-interactive sounds desirable in any case, but
> --never-interactive is not mentioned in the 2.6.0 --help message.
> Instead there is -B (--batch), although --never-interactive is
> recognized, I can see experimentally.

--never-interactive is documented in the Texinfo manual ("Options
Affecting Scanner Behavior" node).  It looks to me like the --help
output intentionally lists only the most commonly used options.

--never-interactive and --batch are technically orthogonal.  I don't
know any reason a *real* scanner would want to use --never-interactive
*without* --batch.  However, to address the specific problem with *test*
scanners we are discussing here, --never-interactive is what we want,
because --never-interactive is the option that makes the generated code
not call isatty().

> I do not know when --never-interactive, or any of its variants, was
> implemented. We should check that before using it ...

I'm pleasantly surprised to report that the Git repo for flex at
 has history going back all the way
to 1987.

The *feature* of optionally not calling isatty() on the input file
has been present since version 2.5.1 (released 1995-03-28), in the
form of `%option {always,never}-interactive` directives inside the
scanner.  The *command line option* --never-interactive was added
in version 2.5.6 (along with long command line options in general).
That version was released somewhere between 2002-04-19 and 2002-04-23;
the exact date is not recorded anywhere I can find.

zw





[bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

2023-01-13 Thread Karl Berry
> your patch *and* consistently test flex with "--never-interactive".

Making flex non-interactive sounds desirable in any case, but
--never-interactive is not mentioned in the 2.6.0 --help message.

Instead there is -B (--batch), although --never-interactive is
recognized, I can see experimentally.

I do not know when --never-interactive, or any of its variants, was
implemented. We should check that before using it ... --thanks, karl.





[bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

2023-01-13 Thread Mike Frysinger
On 13 Jan 2023 13:49, Frederic Berat wrote:
> I probably won't be able to do so before next week at least.
> If you happen to have time (and be willing) to do it earlier, don't
> hesitate ;)

that timeframe is fine.  as you can see, we take a long view in Automake.
-mike


signature.asc
Description: PGP signature


[bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

2023-01-13 Thread Frederic Berat
I probably won't be able to do so before next week at least.
If you happen to have time (and be willing) to do it earlier, don't
hesitate ;)

On Fri, Jan 13, 2023 at 7:31 AM Mike Frysinger  wrote:

> On Mon, 12 Dec 2022 15:20:46 -0500, Zack Weinberg wrote:
> > On 2022-12-12 2:07 AM, Frederic Berat wrote:
> > >
> > > 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".
> > >
> > > 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.
> >
> > I'm guessing that the idea here was to avoid using unistd.h on platforms
> > that don't supply that header at all.  I suggest that we should apply
> > your patch *and* consistently test flex with "--never-interactive".
>
> sounds fine.  want to update your patch Frederic ?
> -mike
>
>
>
>


[bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

2023-01-12 Thread Mike Frysinger
On Mon, 12 Dec 2022 15:20:46 -0500, Zack Weinberg wrote:
> On 2022-12-12 2:07 AM, Frederic Berat wrote:
> > 
> > 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".
> >
> > 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.
>
> I'm guessing that the idea here was to avoid using unistd.h on platforms 
> that don't supply that header at all.  I suggest that we should apply 
> your patch *and* consistently test flex with "--never-interactive".

sounds fine.  want to update your patch Frederic ?
-mike





[bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

2022-12-12 Thread Zack Weinberg

On 2022-12-12 2:07 AM, Frederic Berat wrote:


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".

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.


I'm guessing that the idea here was to avoid using unistd.h on platforms 
that don't supply that header at all.  I suggest that we should apply 
your patch *and* consistently test flex with "--never-interactive".


zw





[bug#59994] [PATCH] tests: Don't try to prevent flex to include unistd.h

2022-12-12 Thread Frederic Berat
From: Frédéric Bérat 

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' comme