-
Notifications
You must be signed in to change notification settings - Fork 695
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
Remaining -Wconversion warnings #748
Comments
Ignore everything in date.h. We did not write it; it was imported from some other place. I should move it from "include/pistache" into "include/pistache/thirdparty". I've not dug into the code (this is just a drive-by comment), but I'm surprised about the warning for the "auto promise =". Why did the compiler fail to create the desired type? Does this warning occur on both GCC-9 and Clang-? |
I run gcc 7, I don't have the other environments, sorry. Actually, it was my commit a couple of weeks ago that added -Wconversion - maybe we need to remove it eventually? |
I found that the following change fixes the warning in async.h: diff --git a/src/common/http.cc b/src/common/http.cc
index b8728aa..499f352 100644
--- a/src/common/http.cc
+++ b/src/common/http.cc
@@ -794,7 +794,7 @@ Async::Promise<ssize_t> ResponseWriter::putOnWire(const char *data,
auto fd = peer()->fd();
return transport_->asyncWrite(fd, buffer)
- .then<std::function<Async::Promise<ssize_t>(int)>,
+ .then<std::function<Async::Promise<ssize_t>(ssize_t)>,
std::function<void(std::exception_ptr &)>>(
[=](int /*l*/) {
return Async::Promise<ssize_t>([=]( I don't know if it's a correct one though. |
The change below fixes the warning happening in date.h. I've checked the latest version of date.h in the source location - they suppress the warning the similar way, only locally in the file itself. diff --git a/src/common/http_defs.cc b/src/common/http_defs.cc
index 31e3e76..30019cd 100644
--- a/src/common/http_defs.cc
+++ b/src/common/http_defs.cc
@@ -8,7 +8,14 @@
#include <iostream>
#include <pistache/common.h>
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
#include <pistache/date.h>
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
#include <pistache/http_defs.h>
namespace Pistache { |
Fix a warning about problematic conversion from 'long int' to 'int' appearing when compiling http.cc with -wConversion flag
Suppress warnings originating in date.h. The similar suppression appears in the newer version of date.h appearing in its original repository https://github.com/HowardHinnant/date
This PR breaks all travis builds. For example: https://travis-ci.org/github/oktal/pistache/jobs/674003067 |
Suppress warnings originating in date.h. The similar suppression appears in the newer version of date.h appearing in its original repository https://github.com/HowardHinnant/date
* Fix -wConversion warning in async.h #748 Fix a warning about problematic conversion from 'long int' to 'int' appearing when compiling http.cc with -wConversion flag * Suppress -wConversion warnings in date.h #748 Suppress warnings originating in date.h. The similar suppression appears in the newer version of date.h appearing in its original repository https://github.com/HowardHinnant/date Co-authored-by: Michael Tseitlin <michael.tseitlin@concertio.com>
Hi,
After my PR introducing -Wconversion compilation flag a couple of weeks ago, there still remain a couple of warnings that I don't know how to resolve:
This is conversion warning from "unsigned char" to bitfield 'unsigned char:4'. There is already
static_cast<decltype(index_)>
- apparently this doesn't work. It looks like the following fixes these warnings:Any comments?
This one deals with hard core templating in Pistache, and I'm didn't succeed to get to the root.
Thanks a lot
The text was updated successfully, but these errors were encountered: