The Wayback Machine - https://web.archive.org/web/20201107082134/https://github.com/uNetworking/uWebSockets/issues/1080
Skip to content
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

Fix pedantic warnings #1080

Open
major-mayer opened this issue Jul 7, 2020 · 2 comments
Open

Fix pedantic warnings #1080

major-mayer opened this issue Jul 7, 2020 · 2 comments

Comments

@major-mayer
Copy link

@major-mayer major-mayer commented Jul 7, 2020

Hi,
first of all, thanks for this great library.
When i compile it, i noticed that it produces one warning, which spams the logs a bit, because there are many references after it.

lib\uWebSockets\src\WebSocketContext.h(326,47): warning C4018: '<': signed/unsigned mismatch

It's no big deal an not crucial, but i just wanted to inform you that the warning is produced in case you didn't notice.

I am using MSVC 19 (C++20 standard).
Greetings

@yesudeep
Copy link

@yesudeep yesudeep commented Jul 7, 2020

Thank you for the awesome library. Adding another mismatched sign comparison reported in a different file by GCC 10.1.1 on Linux:

INFO: From Compiling third_party/cc/test/uwebsockets_example.cc:
In file included from bazel-out/k8-fastbuild/bin/external/uwebsockets/_virtual_includes/uwebsockets/uwebsockets/HttpParser.h:31,
                 from bazel-out/k8-fastbuild/bin/external/uwebsockets/_virtual_includes/uwebsockets/uwebsockets/HttpResponseData.h:23,
                 from bazel-out/k8-fastbuild/bin/external/uwebsockets/_virtual_includes/uwebsockets/uwebsockets/HttpContext.h:25,
                 from bazel-out/k8-fastbuild/bin/external/uwebsockets/_virtual_includes/uwebsockets/uwebsockets/App.h:24,
                 from third_party/cc/test/uwebsockets_example.cc:7:
bazel-out/k8-fastbuild/bin/external/uwebsockets/_virtual_includes/uwebsockets/uwebsockets/ProxyParser.h: In member function 'std::pair<bool, unsigned int> uWS::ProxyParser::parse(std::string_view)':
bazel-out/k8-fastbuild/bin/external/uwebsockets/_virtual_includes/uwebsockets/uwebsockets/ProxyParser.h:136:27: warning: comparison of integer expressions of different signedness: 'std::basic_string_view<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  136 |         if (data.length() < 16 + hostLength) {
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
@alexhultman
Copy link
Member

@alexhultman alexhultman commented Jul 8, 2020

If you enable -Wsign-conversion you'll see about 60-90 of those. The thing is, these warnings are not default in GCC or Clang, so I haven't put any time into fixing them.

Then we have the time when someone with very strong opinions about warnings made a PR to "fix" them, only to mess up logic and break the whole project. So I take caution rushing to "fix" non-default warnings just for the sake of it. I would like to spend some time and go over them, but that takes time.

@alexhultman alexhultman changed the title Warning "signed/unsigned mismatch" Fix pedantic warnings Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.