-Wunused-but-set-variable
bobhairgrove opened this issue · 1 comments
bobhairgrove commented
There is an "unused but set variable" warning from gcc when compiling libcsv:
libcsv.c: In function ‘csv_fini’:
libcsv.c:163:7: warning: variable ‘pstate’ set but not used [-Wunused-but-set-variable]
int pstate = p->pstate;
If you could fix this, it will compile without any warnings.
Suggestion: go to line 171 in libcsv.c and change this line:
if (p->pstate == FIELD_BEGUN && p->quoted && p->options & CSV_STRICT && p->options & CSV_STRICT_FINI) {
to this:
if (pstate == FIELD_BEGUN && p->quoted && p->options & CSV_STRICT && p->options & CSV_STRICT_FINI) {
I ran it through the preprocessor by doing gcc -E -o libcsv_pre.c libcsv.c
and compared the preprocessed source with the original. Indeed, pstate
is set several times in code generated by macros, so just removing line 163 isn't the best option. However, its value is never read, AFAICT.
Did you originally intend to set the parser's p->pstate
from the local variable before returning, or before calling one of the callbacks?
rgamble commented
Fixed in merged commit 44f79cf4
.