Netdev List
 help / color / mirror / Atom feed
* [PATCH] tc: fix build with flex>=2.6.5
@ 2026-11-12  8:41 ojab
  2026-11-16 19:41 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: ojab @ 2026-11-12  8:41 UTC (permalink / raw)
  To: netdev; +Cc: ojab

Since flex-2.6.5 [1] `yyunput` takes a single argument and build fails
with:
```
emp_ematch.l:35:69: error: macro ‘yyunput’ passed 2 arguments, but takes just 1
   35 |  static void __attribute__ ((unused)) yyunput (int c,char *buf_ptr  );
      |                                                                     ^
emp_ematch.lex.c:466:9: note: macro ‘yyunput’ defined here
  466 | #define yyunput(c) yyunput_r( c, (yytext_ptr)  )
      |         ^~~~~~~
emp_ematch.l:35:39: error: variable or field ‘yyunput’ declared void
   35 |  static void __attribute__ ((unused)) yyunput (int c,char *buf_ptr  );
      |                                       ^~~~~~~
emp_ematch.lex.c:1836:13: warning: ‘yyunput_r’ defined but not used [-Wunused-function]
 1836 | static void yyunput_r (int c, char * yy_bp )
      |             ^~~~~~~~~
make[1]: *** [../config.mk:34: emp_ematch.lex.o] Error 1
```

Use new `YY_NO_YYUNPUT` to silence redefinition warning in this case
and skip `__attribute__ ((unused))`.

[1] https://github.com/westes/flex/commit/721622ea6e6aaf3aa7e55d939679f21e98b76d86

Signed-off-by: ojab <ojab@ojab.ru>
---
 tc/emp_ematch.l | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tc/emp_ematch.l b/tc/emp_ematch.l
index 2f4926d4..c6fd907e 100644
--- a/tc/emp_ematch.l
+++ b/tc/emp_ematch.l
@@ -10,6 +10,7 @@
 
  #define NEXT_EM_ARG() do { ematch_argc--; ematch_argv++; } while(0);
 
+ #define YY_NO_YYUNPUT 1
  #define YY_INPUT(buf, result, max_size)				\
  {									\
  next:									\
@@ -32,7 +33,9 @@
 	}								\
  }
 
- static void __attribute__ ((unused)) yyunput (int c,char *buf_ptr  );
+ #ifndef yyunput
+ static void __attribute__ ((unused)) yyunput (int c, char *buf_ptr);
+ #endif
  static void __attribute__ ((unused)) yy_push_state (int  new_state );
  static void __attribute__ ((unused)) yy_pop_state  (void);
  static int  __attribute__ ((unused)) yy_top_state (void );
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tc: fix build with flex>=2.6.5
  2026-11-12  8:41 [PATCH] tc: fix build with flex>=2.6.5 ojab
@ 2026-11-16 19:41 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-11-16 19:41 UTC (permalink / raw)
  To: ojab; +Cc: netdev

On Thu, 12 Nov 2026 08:41:07 +0000
ojab <ojab@ojab.ru> wrote:

> Since flex-2.6.5 [1] `yyunput` takes a single argument and build fails
> with:
> ```
> emp_ematch.l:35:69: error: macro ‘yyunput’ passed 2 arguments, but takes just 1
>    35 |  static void __attribute__ ((unused)) yyunput (int c,char *buf_ptr  );
>       |                                                                     ^
> emp_ematch.lex.c:466:9: note: macro ‘yyunput’ defined here
>   466 | #define yyunput(c) yyunput_r( c, (yytext_ptr)  )
>       |         ^~~~~~~
> emp_ematch.l:35:39: error: variable or field ‘yyunput’ declared void
>    35 |  static void __attribute__ ((unused)) yyunput (int c,char *buf_ptr  );
>       |                                       ^~~~~~~
> emp_ematch.lex.c:1836:13: warning: ‘yyunput_r’ defined but not used [-Wunused-function]
>  1836 | static void yyunput_r (int c, char * yy_bp )
>       |             ^~~~~~~~~
> make[1]: *** [../config.mk:34: emp_ematch.lex.o] Error 1
> ```
> 
> Use new `YY_NO_YYUNPUT` to silence redefinition warning in this case
> and skip `__attribute__ ((unused))`.
> 
> [1] https://github.com/westes/flex/commit/721622ea6e6aaf3aa7e55d939679f21e98b76d86
> 
> Signed-off-by: ojab <ojab@ojab.ru>
> ---

There are couple of concerns with this patch.

First, Signed-off-by should be a "Known identity" not short alias because it is interpreted
as Developers Certificate of Origin. If you resend, please use something more than just "ojab".

Also, it looks like flex version 2.6.5 change was later reverted.
AI discovered:
  flex 2.6.5 renamed yyunput() to yyunput_r(), but 2.6.12 reverted that
  and restored the 2.6.4 behaviour (flex commit 160a160). Every version
  in that window, 2.6.5 through 2.6.15, was tagged within the last week;
  flex had been on 2.6.4 since 2017. So this works around a rename that
  upstream has already backed out, in releases no distro ships.

Bottom line: don't use development versions of flex

NAK

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-16 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12  8:41 [PATCH] tc: fix build with flex>=2.6.5 ojab
2026-11-16 19:41 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox