-
Notifications
You must be signed in to change notification settings - Fork 536
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
Type of yy_n_chars changed to yy_size_t causes warnings with comparison to zero #53
Comments
I see that on line 178 of src/flexdef.h, yy_n_chars is declared with typ int. Any objections if I close this issue given that? |
Hi, Hmm. I still see yy_n_chars only defined in src/FlexLexer.h and src/flex.skl; and the latter still defines it as yy_size_t. I just pulled froim master. Am I missing something? Manoj
|
The example file (credit.l) still creates a .c file that runs into the gcc diagnostics. Perhaps I built from the wrong branch, I'll check when I get back home Manoj |
Ah, I only noticed the flexlexer.h declaration. The flex.skl stuff needs to change. |
Also, what's the gcclint command you're using? I'm not finding that as a standard command. |
Sorry. I should have mentioned what I use for linting: #!/bin/bash
if [ -x /bin/tempfile ]; then
gfile=`tempfile -p tcap -m 0600 `.o;
else
set -e
mkdir /tmp/glint$$
gfile=/tmp/glint$$/gfile.o
fi
# -std=gnu99
exec gcc -std=c99 -pedantic -Wextra -Wall -Wformat=2 -Wno-format-extra-args \
-Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum \
-Wunused -Wstrict-overflow=5 -Wfloat-equal -Wundef -Wno-endif-labels\
-Wshadow -Wunsafe-loop-optimizations -Wpointer-arith \
-Wbad-function-cast -Wc++-compat -Wcast-qual -Wcast-align \
-Wwrite-strings -Wconversion -Wlogical-op -Waggregate-return \
-Wpacked -Wpadded -Wunreachable-code -Winline -Wvariadic-macros \
-Wvla -Wvolatile-register-var -Wstack-protector \
-Woverlength-strings -Wmissing-declarations -Wmissing-parameter-type\
-Wmissing-prototypes -Wnested-externs -Wold-style-declaration \
-Wold-style-definition -Wstrict-prototypes -Wpointer-sign \
-fshort-enums -fno-common -fstack-protector \
-D_FORTIFY_SOURCE=2 -Dgets=DONT_USE_GETS -Dlint -O2 -g \
-o $gfile -c $*
if test -f $gfile; then
rm -f $gfile
fi
if [ -d /tmp/glint$$ ]; then
rmdir /tmp/glint$$
fi |
Hi,
This was reported by a Debian user in Bug 770161
In version 2.5.35 the type of yy_n_chars is int, while in 2.5.39 the type is yy_size_t. The yy_size_t is internal type mapped to size_t which is unsigned. The YY_INPUT macro contains following code:
then the macro is then invoked:
So the code casts signed result of read() to unsigned and then compare if it's lower than 0.
Manoj
Here is how to reproduce:
credit.l.txt
The text was updated successfully, but these errors were encountered: