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

Bug#625357: jigit: ftbfs with gcc-4.6 -Werror



tags 625357 - moreinfo
retitle 62537 gcc -Wunused-but-set-variable warning is confusing
# bad error message
severity 625357 minor
quit

Steve McIntyre wrote:

>     error = add_md5_entry(UNKNOWN, md5, file_name);
>     return 0;
> }
>
> To explain a bit more: the warning reported by gcc (unhelpfully)
> points at the declaration/initialisation of "error", which led me to
> (incorrectly) think that it was complaining about set-but-unused for
> the initialisation. With minor tweaks, I can see that it's complaining
> about the return value from add_md5_entry() being ignored but doesn't
> *say* that. :-(

Ah, I see and I think I agree.  The current message

 test.c:3:6: warning: variable ‘x’ set but not used [-Wunused-but-set-variable]
 
places the emphasis on the assignment (which is not worth warning
about), when the warning is instead supposed to be about the variable
(which is never used).  Something like

 test.c:3:6: warning: unused variable ‘x’ [-Wunused-but-set-variable]

would be much clearer.

Will think more and then work on a patch.  Thanks for your patient
explanations.



Reply to: