Skip to contentSkip to conversation

GRUB 2.00 build and flex-2.5.37

DISCUSSION Bruce Dubbs 3 participants 3 messages Aug 5, 2012 – Jan 3, 2013

lore
Share & tools
lore
#0 lore raw

The latest flex makes the GRUB-2.00 build fail. I can work around the issues with --disable-werror, but grub-core/script/yylex.l causes two warnings that do not work with -Werror.

./grub-core/script/yylex.l: At top level:
grub_script.yy.c:2351:13: error: 'yy_fatal_error' defined but not used

This can be fixed by removing #define YY_FATAL_ERROR(msg) in yylex.l.

grub_script.yy.c: In function 'yy_scan_bytes':
grub_script.yy.c:2296:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

This one is a little more difficult because it is generated by flex. I don't know how to fix this except with a sed after grub_script.yy.c is generated by flex.

The gcc version -s 4.7.1.

-- Bruce

#1 lore raw
Quoted 8 lines · Bruce Dubbs

The latest flex makes the GRUB-2.00 build fail. I can work around the issues with --disable-werror, but grub-core/script/yylex.l causes two warnings that do not work with -Werror.

./grub-core/script/yylex.l: At top level:
grub_script.yy.c:2351:13: error: 'yy_fatal_error' defined but not used

This can be fixed by removing #define YY_FATAL_ERROR(msg) in yylex.l.

That would be incorrect; the default implementation of yy_fatal_error uses fprintf, which is not valid in parts of GRUB that need to run freestanding. More correct would probably be to insert an artificial reference to yy_fatal_error, since flex offers no way to suppress its definition.

Quoted 7 lines

grub_script.yy.c: In function 'yy_scan_bytes':
grub_script.yy.c:2296:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

This one is a little more difficult because it is generated by flex. I don't know how to fix this except with a sed after grub_script.yy.c is generated by flex.

I tried to reproduce this and the other warning with flex 2.5.37 and GCC 4.7.2 and couldn't, so I'm reluctant to make a change that I can't test. Can you still reproduce this? If so, could you attach your generated grub_script.yy.c?

Signature · 1 line
Colin Watson                                       [[email protected]]
#2 lore raw
Quoted 8 lines · Colin Watson
Quoted 7 lines · Bruce Dubbs

The latest flex makes the GRUB-2.00 build fail. I can work around the issues with --disable-werror, but grub-core/script/yylex.l causes two warnings that do not work with -Werror.

./grub-core/script/yylex.l: At top level:
grub_script.yy.c:2351:13: error: 'yy_fatal_error' defined but not used

Quoted 8 lines
Quoted 1 line

This can be fixed by removing #define YY_FATAL_ERROR(msg) in yylex.l.

That would be incorrect; the default implementation of yy_fatal_error uses fprintf, which is not valid in parts of GRUB that need to run freestanding. More correct would probably be to insert an artificial reference to yy_fatal_error, since flex offers no way to suppress its definition.

It's ok to make such warnings non-breaking by corresponding #pragma. In fact we already have:
#pragma GCC diagnostic ignored "-Wunused-function"
So the report is obviously for some older version.

Quoted 13 lines
Quoted 7 lines

grub_script.yy.c: In function 'yy_scan_bytes':
grub_script.yy.c:2296:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

This one is a little more difficult because it is generated by flex. I don't know how to fix this except with a sed after grub_script.yy.c is generated by flex.

I tried to reproduce this and the other warning with flex 2.5.37 and GCC 4.7.2 and couldn't, so I'm reluctant to make a change that I can't test. Can you still reproduce this? If so, could you attach your generated grub_script.yy.c?

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko