You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a shadowed local variable in the function linenoiseUtf8NextCharLen. I build with -Wshadow and -Werror, so this warning breaks my build.
Behavior
Building with Clang ("Apple clang version 12.0.0") and -Wshadow produces:
linenoise-mob/utf8.c:468:13: error: declaration shadows a local variable [-Werror,-Wshadow]
int cp;
^
linenoise-mob/utf8.c:459:9: note: previous declaration is here
int cp;
^
Suggested Fix
Delete the duplicate int cp declaration, line 468: the existing cp in the outer scope isn't used again, so there's no harm in reusing it. Either that or rename the second cp to something unique.
(Apologies for not submitting a PR, but it didn't seem worth it to fork the entire repo just to submit a trivial 1-liner.)
Workaround
Update makefile / project to disable -Wshadow for this source file ... but it'd be better if the problem were fixed, since variable shadowing is kind of a footgun.
The text was updated successfully, but these errors were encountered:
There's a shadowed local variable in the function
linenoiseUtf8NextCharLen
. I build with-Wshadow
and-Werror
, so this warning breaks my build.Behavior
Building with Clang ("Apple clang version 12.0.0") and
-Wshadow
produces:Suggested Fix
Delete the duplicate
int cp
declaration, line 468: the existingcp
in the outer scope isn't used again, so there's no harm in reusing it. Either that or rename the secondcp
to something unique.(Apologies for not submitting a PR, but it didn't seem worth it to fork the entire repo just to submit a trivial 1-liner.)
Workaround
Update makefile / project to disable
-Wshadow
for this source file ... but it'd be better if the problem were fixed, since variable shadowing is kind of a footgun.The text was updated successfully, but these errors were encountered: