Hi all,
On FreeBSD, the Autoconf port was recently updated to 2.71. This had
the side-effect that our automated CI builds failed on that platform
because our lexers were not generated anymore.
As it turned out, the reason is that we build with -Werror in CFLAGS
(passed directly to the configure script) and that, in turn, caused
AC_PROG_LEX to fail the detection of the lex library (which we don't
actually need as our lexers set `%option noyywrap` and I passed noyywrap
also to the AC_PROG_LEX macro - still, the script looks for a library).
This wasn't an issue with Autoconf 2.69 that was used before.
When building without -Werror I see this:
checking for flex... flex
checking for lex output file root... lex.yy
checking for lex library... none needed
With -Werror included in CFLAGS the result is this:
checking for flex... flex
checking for lex output file root... lex.yy
checking for lex library... not found
configure: WARNING: required lex library not found; giving up on flex
This is caused by the following warnings turned errors from the
generated lexer:
lex.yy.c:673:13: error: misleading indentation; statement is not part of
the previous 'if' [-Werror,-Wmisleading-indentation]
if ( ! (yy_state_buf) )
^
lex.yy.c:671:9: note: previous statement is here
if ( ! (yy_state_buf) )
^
lex.yy.c:1107:3: error: misleading indentation; statement is not part of
the previous 'if' [-Werror,-Wmisleading-indentation]
return yy_is_jam ? 0 : yy_current_state;
^
lex.yy.c:1104:2: note: previous statement is here
if ( ! yy_is_jam )
^
Note that these warnings are not triggered for our own lexers,
presumably because we don't use REJECT, which seems to generate the
above code. That is, building with -Werror works just fine if the
library check is bypassed.
So I wonder how we should workaround this. In particular, if anybody
has any recommendations on how to handle -Werror when we explicitly want
to fail our automated builds based on warnings without affecting the
tests in configure. Is there a proper way to do this with Autoconf?
Should we e.g. add a --enable-werror option (that modifies CFLAGS late
in the script)? Or provide something like EXTRA_CFLAGS (which would
again get added to CFLAGS late in the script)?
Thanks,
Tobias