websocketpp icon indicating copy to clipboard operation
websocketpp copied to clipboard

Compiling with -Wshadow causes warnings/errors

Open giszo opened this issue 12 years ago • 7 comments

I am trying to use websocketpp in an application that is compiled with -Wshadow and -Werror. Compilation fails because -Wshadow triggers some warnings in websocketpp.

giszo avatar Jan 29 '14 15:01 giszo

The latest commit on the master branch should compile cleanly (library + all examples) on llvm/clang and gcc with -Wshadow. I've also added -Wshadow to the list of warnings that the development test suite uses.

Let me know if this does not fix your issue.

zaphoyd avatar Feb 02 '14 17:02 zaphoyd

Unfortunately I still have compilation errors after pulling the latest version of master branch. See my errors in the following file: http://minimaldiff.hu/zeppelin/shadow_errors.txt

giszo avatar Feb 02 '14 17:02 giszo

Taking a look..

zaphoyd avatar Feb 02 '14 17:02 zaphoyd

hrm.. the remaining cases are cases where a variable shadows a method. Clang and GCC 4.8+ do not emit a warning for this but it looks like GCC <=4.7 does.

zaphoyd avatar Feb 02 '14 17:02 zaphoyd

Actually I am using GCC 4.8.2 with -Wall, -Werror and -Wshadow. You can see the full command line in the file I previously referenced

giszo avatar Feb 02 '14 17:02 giszo

The changelog for GCC 4.8 claims that these cases should not trigger warnings, but I've confirmed that it isn't actually the case.I've pushed another update that also changes the cases where variables shadow functions. Can you confirm that this solves your warning issue?

zaphoyd avatar Feb 02 '14 21:02 zaphoyd

It works like a charm now, thank you! :)

giszo avatar Feb 02 '14 21:02 giszo