Repository navigation
Add new warnings and silence them - #2307
cooljeanius wants to merge 2 commits into
Conversation
|
Lovely contribution! Let's just see how much trouble we get from them and if they can all land. The current CI failure on windows says: |
Yes I get that here as well. I've searched the SDK and I don't see that type defined anywhere. h_addrtype is a short in Windows, |
|
Looking up, apparently Looking at the ifdefery in some of the configure tests, I guess <winsock2.h> is the equivalent of it... the autoconf script already has a check for <sys/socket.h>, but looking at the Appveyor build log, apparently configuring with cmake doesn't check for it, and I don't know enough about cmake to make it check for it... |
|
Why does it need to be sa_family_t? sockaddr_in |
|
On my system |
Ok. I guess we could typedef it for Windows, but I wonder what to do about other systems that don't have it. |
|
To use this type in the code without friction, I don't see how we can avoid adding #ifdef and/or configure/cmake magic for it. Which of the new compiler flags causes a warning on this line without this change? |
|
It's from -Wconversion, which is actually an old compiler flag, not one of the new ones I added. Maybe I should have saved that part for a separate pull request... |
That makes me even more curious. We build (almost) every commit on macos warning-free so how did you get a warning there that we didn't? |
Old warning flag but new compiler; -Wconversion might have started warning on things it didn't used to warn about in GCC 7 (in which case it might be a GCC bug...) |
There is a problem with the automated macOS builds. The configure script thinks that the compiler is clang. Probably that's true, and clang is used instead of gcc. For example https://travis-ci.org/curl/curl/jobs/341864424 :
The warnings also appear on NetBSD (gcc 5.4.0): https://curl.haxx.se/dev/log.cgi?id=20180215033441-2650#prob1 |
|
It's possible to use a "real" gcc on macOS, see travis-ci/travis-ci#2423 |
|
How about this? At the top of the file somewhere: /* for systems that don't detect this, use a sensible default */
#ifndef CURL_SA_FAMILY_T
#define CURL_SA_FAMILY_T unsigned short
#endifUse Then add the following patch to configure.ac to make it try to detect what type to use for this particular system: diff --git a/configure.ac b/configure.ac
index 798fa5f1e..d1c1a8f93 100755
--- a/configure.ac
+++ b/configure.ac
@@ -3490,10 +3490,30 @@ AC_CHECK_TYPE([bool],[
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#endif
])
+# check for sa_family_t
+AC_CHECK_TYPE(sa_family_t,
+ AC_DEFINE(CURL_SA_FAMILY_T, sa_family_t, [IP address type in sockaddr]),
+ [
+ # The windows name?
+ AC_CHECK_TYPE(ADDRESS_FAMILY,
+ AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]),
+ AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]),
+ [
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+ ])
+ ],
+[
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+])
+
AC_MSG_CHECKING([if time_t is unsigned])
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include <time.h>
#include <limits.h> |
That looks like it would probably work; I don't think I can add that myself though because I forgot the "don't send pull requests from master" rule of thumb and have some other irrelevant commits that would get mixed in if I pushed them like I'd have to if also pushing your patch... |
|
All right, thanks! I took your work and merged it with my polish attempts so the continuation is now in #2463 and this can be closed. |
GCC 6 and 7 added some new warning flags that aren't a part of -Wall or -Wextra, so this pull request adds them to the configure script where the rest of the warnings go. It then also silences the new warnings created by these additions. Built on x86_64-apple-darwin10.8.0 with GCC 7.