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

gcc6 warnings #91

Closed
amerlyq opened this issue Aug 2, 2016 · 6 comments
Closed

gcc6 warnings #91

amerlyq opened this issue Aug 2, 2016 · 6 comments

Comments

@amerlyq
Copy link

amerlyq commented Aug 2, 2016

Problem in noexcept + throw

./ext/curlcpp/src/cookie.cpp: In member function ‘curl::cookie* curl::cookie::set_secure(unsigned int)’:
./ext/curlcpp/src/cookie.cpp:114:95: warning: throw will always call terminate() [-Wterminate]
         throw new curl_easy_exception("The security can be 0 (false) or 1 (true)",__FUNCTION__);

Crotch (maybe logically there must be some else routine):

diff --git i/include/cookie.h w/include/cookie.h
index cf2f639..76ccf53 100644
--- i/include/cookie.h
+++ w/include/cookie.h
@@ -94,3 +94,3 @@ namespace curl {
          */
-        cookie *set_secure(const unsigned int) NOEXCEPT;
+        cookie *set_secure(const unsigned int) ;
         /**
@@ -166,2 +166,2 @@ namespace curl {

-#endif //CURLCPP_COOKIE_H
\ No newline at end of file
+#endif //CURLCPP_COOKIE_H
diff --git i/src/cookie.cpp w/src/cookie.cpp
index 939b1e3..e0cfccc 100644
--- i/src/cookie.cpp
+++ w/src/cookie.cpp
@@ -107,3 +107,3 @@ curl::cookie *curl::cookie::set_secure(const char *secure) NOEXCEPT {
 // Implementation of set_secure method.
-curl::cookie *curl::cookie::set_secure(const unsigned int secure) NOEXCEPT {
+curl::cookie *curl::cookie::set_secure(const unsigned int secure) {
     if (secure == 0) {
@amerlyq
Copy link
Author

amerlyq commented Aug 2, 2016

Reordered initialization troubles

In file included from ./ext/curlcpp/include/cookie_datetime.h:29:0,
                 from ./ext/curlcpp/include/cookie.h:32,
                 from ./ext/curlcpp/include/curl_cookie.h:34,
                 from ./ext/curlcpp/src/curl_cookie.cpp:8:
./ext/curlcpp/include/cookie_date.h: In constructor ‘curl::cookie_date::cookie_date()’:
./ext/curlcpp/include/cookie_date.h:121:21: warning: ‘curl::cookie_date::week_day’ will be initialized after [-Wreorder]
         std::string week_day;
                     ^~~~~~~~
./ext/curlcpp/include/cookie_date.h:113:22: warning:   ‘unsigned int curl::cookie_date::day’ [-Wreorder]
         unsigned int day;
                      ^~~
./ext/curlcpp/include/cookie_date.h:64:9: warning:   when initialized here [-Wreorder]
         cookie_date() : week_day("Mon"), day(1), month("Jan"), year(1970) {}
         ^~~~~~~~~~~
In file included from ./ext/curlcpp/include/cookie_datetime.h:29:0,
                 from ./ext/curlcpp/include/cookie.h:32,
                 from ./ext/curlcpp/src/cookie.cpp:6:
./ext/curlcpp/include/cookie_date.h: In constructor ‘curl::cookie_date::cookie_date()’:
./ext/curlcpp/include/cookie_date.h:121:21: warning: ‘curl::cookie_date::week_day’ will be initialized after [-Wreorder]
         std::string week_day;
                     ^~~~~~~~
./ext/curlcpp/include/cookie_date.h:113:22: warning:   ‘unsigned int curl::cookie_date::day’ [-Wreorder]
         unsigned int day;
                      ^~~
./ext/curlcpp/include/cookie_date.h:64:9: warning:   when initialized here [-Wreorder]
         cookie_date() : week_day("Mon"), day(1), month("Jan"), year(1970) {}
         ^~~~~~~~~~~
[ 80%] Building CXX object ext/curlcpp/src/CMakeFiles/curlcpp.dir/cookie_datetime.cpp.obj
In file included from ./ext/curlcpp/src/cookie_date.cpp:6:0:
./ext/curlcpp/include/cookie_date.h: In constructor ‘curl::cookie_date::cookie_date()’:
./ext/curlcpp/include/cookie_date.h:121:21: warning: ‘curl::cookie_date::week_day’ will be initialized after [-Wreorder]
         std::string week_day;
                     ^~~~~~~~
./ext/curlcpp/include/cookie_date.h:113:22: warning:   ‘unsigned int curl::cookie_date::day’ [-Wreorder]
         unsigned int day;
                      ^~~
./ext/curlcpp/include/cookie_date.h:64:9: warning:   when initialized here [-Wreorder]
         cookie_date() : week_day("Mon"), day(1), month("Jan"), year(1970) {}
         ^~~~~~~~~~~
In file included from ./ext/curlcpp/include/cookie_datetime.h:29:0,
                 from ./ext/curlcpp/src/cookie_datetime.cpp:6:
./ext/curlcpp/include/cookie_date.h: In constructor ‘curl::cookie_date::cookie_date()’:
./ext/curlcpp/include/cookie_date.h:121:21: warning: ‘curl::cookie_date::week_day’ will be initialized after [-Wreorder]
         std::string week_day;
                     ^~~~~~~~
./ext/curlcpp/include/cookie_date.h:113:22: warning:   ‘unsigned int curl::cookie_date::day’ [-Wreorder]
         unsigned int day;
                      ^~~
./ext/curlcpp/include/cookie_date.h:64:9: warning:   when initialized here [-Wreorder]
         cookie_date() : week_day("Mon"), day(1), month("Jan"), year(1970) {}
         ^~~~~~~~~~~

@amerlyq
Copy link
Author

amerlyq commented Sep 21, 2016

Order was fixed, but what about noexcept + throw problem mentioned in first post?

@JosephP91
Copy link
Owner

@amerlyq ops, didn't see it! Can you tell me if now it is fixed?

@amerlyq
Copy link
Author

amerlyq commented Sep 21, 2016

I hope it wasn't a mistake to delete test/... file in that commit...
And, however I suggested removing noexcept as ad hoc method, I treat it as crotch.
As fixing domain -- like using bool for security -- is more reasonable than introducing chain reaction of removing noexcept in dependent code.

@JosephP91
Copy link
Owner

Sorry, my mistake with test/custom_request.cpp. It has been restored now.

@amerlyq
Copy link
Author

amerlyq commented Sep 21, 2016

Please, reconsider about logic of function/class instead of blindly
removing noexcept. Because it may backslash in the future. Again)

On Wed, Sep 21, 2016, 23:08 Giuseppe notifications@github.com wrote:

Sorry, my mistake with test/custom_request.cpp. It has been restored now.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#91 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFdvMEydpQx6FzfS4jHpUX3F2_PBd4kZks5qsY7TgaJpZM4Ja5aY
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants