[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Build fails with flex 2.6.4 and -Werror

From: Timotej Lazar
Subject: Build fails with flex 2.6.4 and -Werror
Date: Sun, 4 Jun 2017 19:05:38 +0200


Building GRUB using the default configuration (-Werror -Wunused-value)
fails with flex >2.6.3.

The problem is with the script lexer, which defines fprintf to 0. The
replacement triggers -Wunused-value in the default flex template for
yy_fatal_error. In previous versions of the template the fprintf call
was cast to void, which silenced the warning. However, the cast was
removed in the latest version of flex.

I’m attaching a patch to fix this by replacing fprintf with grub_printf
instead. Alternatively, fprintf could be #defined to ((void)0), but that
might break if the flex template changes to not ignore the return value.
Another option would be to add a #pragma in yylex.l to ignore unused
values. In any case, the lexer overrides yy_fatal_error, so this code is
never actually executed, only compiled.

Timotej Lazar

Attachment: 0001-lexer-fix-a-define-to-avoid-unused-value-warning.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]