Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sign-compare compiler warning #61

Closed
cgzones opened this issue Feb 26, 2016 · 11 comments
Closed

sign-compare compiler warning #61

cgzones opened this issue Feb 26, 2016 · 11 comments
Assignees

Comments

@cgzones
Copy link

cgzones commented Feb 26, 2016

https://github.com/westes/flex/blob/master/src/flex.skl#L1781 is raising sign-compare warnings with flex 2.6.0 on debian sid for me:

gcc-5 / gcc-6:

<stdout>: In function ‘yy_get_next_buffer’:
<stdout>:1113:44: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

clang-3.8:

<stdout>:1113:44: warning: comparison of integers of different signs: 'int' and 'yy_size_t' (aka 'unsigned long') [-Wsign-compare]
        if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
@westes
Copy link
Owner

westes commented Feb 26, 2016

This should be resolved in current master. Your report mentions 2.6.0, so please check this against the current tip of master.

@westes westes self-assigned this Feb 26, 2016
@westes
Copy link
Owner

westes commented Feb 26, 2016

What flex are you using in the build of selinux?

On Friday, 26 February 2016, 10:25 am -0800, cgzones notifications@github.com wrote:

i still get the same warning (different line number) with the latest git.

my steps:

git clone https://github.com/westes/flex
cd flex/
./autogen.sh
./configure
make
cd ../

git clone https://github.com/SELinuxProject/selinux
cd selinux/
make DESTDIR=$(pwd)/build install

result:

cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o ../cil/src/cil_lexer.o ../cil/src/cil_lexer.c
<stdout>: In function ‘yy_get_next_buffer’:
<stdout>:1113:44: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

Reply to this email directly or view it on GitHub:
#61 (comment)

Will Estes
westes575@gmail.com

@cgzones
Copy link
Author

cgzones commented Feb 26, 2016

i still get the same warning (different line number) with the latest git.

my steps:

git clone https://github.com/westes/flex
cd flex/
./autogen.sh
./configure
make
cd ../

git clone https://github.com/SELinuxProject/selinux
source='LEX = flex'
replace='LEX = ..\/..\/..\/flex\/src\/flex'
sed -i "s/${source}/${replace}/g" selinux/libsepol/src/Makefile
cd selinux/
make DESTDIR=$(pwd)/build install

result:

../../../flex/src/flex -t ../cil/src/cil_lexer.l > ../cil/src/cil_lexer.c
cc -Werror -Wall -W -Wundef -Wshadow -Wmissing-format-attribute -O2 -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o ../cil/src/cil_lexer.o ../cil/src/cil_lexer.c
<stdout>: In function ‘yy_get_next_buffer’:
<stdout>:1098:44: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

sorry, i posted a previous version of this post earlier, which used an old version of flex

@westes
Copy link
Owner

westes commented Feb 26, 2016

Thanks for the clarification. You should now see this compile. I get no output from the compilation command with the change I just committed and pushed.

@cgzones
Copy link
Author

cgzones commented Feb 26, 2016

Thanks, it works now

@cgzones cgzones closed this as completed Feb 26, 2016
@grahamc
Copy link

grahamc commented Oct 1, 2016

Hi @westes, can you provide a patch NixOS could apply to 2.6.1 to resolve this? We tried applying 3946924ed5e77420c453bf841603c7278766093abut it doesn't apply cleanly. We're finding we'll need to patch several packages with -Wno-error=sign-compare but would prefer applying a patch to flex itself.

/cc NixOS/nixpkgs#19129

@vcunat
Copy link

vcunat commented Oct 1, 2016

BTW, it's not just NixOS. I believe e.g. Debian (still) suffers from this as well on 2.6.1: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835542#59

@RalphCorderoy
Copy link

Regarding the 2.6.1 problem, I've opened #97.

@df7cb
Copy link

df7cb commented Dec 30, 2016

I'll be pushing oftc@8d18a80 to Debian to fix this in 2.6.1.

@vcunat
Copy link

vcunat commented Dec 30, 2016

I just wonder, why not 2.6.3 directly?

@westes
Copy link
Owner

westes commented Dec 31, 2016 via email

soonho-tri added a commit to dreal/dreal4 that referenced this issue Oct 3, 2017
Ubuntu-16.04 uses flex-2.6.0 which causes a compiler warning.

See westes/flex#61
eric-s-raymond added a commit to eric-s-raymond/flex that referenced this issue Oct 5, 2020
They were: geneol, fulltable, eecs, and debug.

To accomplish this, dataend's emission of trailing } needed to be
suppressable.

Also, remove a %% mark that is no longer required.

This doesn't change any of the generated tables, but does change the
orer in which they're generated, froducing large diffs in the
generated test code that don't actually mean anything.  The reason for
this is that tables used to come out in a variable order as functions
like geneecs were called ar variable times depending on the
compressuion mode.  Now, instead, the order is fixed by where the
tanle-body macros these functions define are expanded.

More methods remain to be turnerd into macro generators.

westes#61 in the retargeting patch series, following an unnumbered
bugfix patch that I shipped in too much of a hurry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants