[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 61/178: build: add picky compiler warning flags for
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 61/178: build: add picky compiler warning flags for gcc 6 and 7 |
Date: |
Wed, 23 May 2018 12:24:56 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit a19fefb0706f939d2df7a76704ee549fecb1c4fd
Author: Eric Gallager <address@hidden>
AuthorDate: Mon Feb 12 01:42:47 2018 -0500
build: add picky compiler warning flags for gcc 6 and 7
---
acinclude.m4 | 0
lib/curl_addrinfo.c | 4 ++--
lib/mime.c | 5 ++++-
lib/tftp.c | 2 +-
lib/timeval.c | 2 +-
m4/curl-compilers.m4 | 17 +++++++++++++++++
6 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
old mode 100755
new mode 100644
diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c
index 95a3f1050..01775f704 100644
--- a/lib/curl_addrinfo.c
+++ b/lib/curl_addrinfo.c
@@ -345,7 +345,7 @@ Curl_he2ai(const struct hostent *he, int port)
addr = (void *)ai->ai_addr; /* storage area for this info */
memcpy(&addr->sin_addr, curr, sizeof(struct in_addr));
- addr->sin_family = (unsigned short)(he->h_addrtype);
+ addr->sin_family = (sa_family_t)(he->h_addrtype);
addr->sin_port = htons((unsigned short)port);
break;
@@ -354,7 +354,7 @@ Curl_he2ai(const struct hostent *he, int port)
addr6 = (void *)ai->ai_addr; /* storage area for this info */
memcpy(&addr6->sin6_addr, curr, sizeof(struct in6_addr));
- addr6->sin6_family = (unsigned short)(he->h_addrtype);
+ addr6->sin6_family = (sa_family_t)(he->h_addrtype);
addr6->sin6_port = htons((unsigned short)port);
break;
#endif
diff --git a/lib/mime.c b/lib/mime.c
index 89819a935..ce56d7873 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -1193,7 +1193,10 @@ CURLcode Curl_mime_duppart(curl_mimepart *dst, const
curl_mimepart *src)
}
/* Duplicate other fields. */
- dst->encoder = src->encoder;
+ if(dst != NULL)
+ dst->encoder = src->encoder;
+ else
+ res = CURLE_WRITE_ERROR;
if(!res)
res = curl_mime_type(dst, src->mimetype);
if(!res)
diff --git a/lib/tftp.c b/lib/tftp.c
index 20dc60040..7fd7b3751 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -1010,7 +1010,7 @@ static CURLcode tftp_connect(struct connectdata *conn,
bool *done)
state->requested_blksize = blksize;
((struct sockaddr *)&state->local_addr)->sa_family =
- (unsigned short)(conn->ip_addr->ai_family);
+ (sa_family_t)(conn->ip_addr->ai_family);
tftp_set_timeouts(state);
diff --git a/lib/timeval.c b/lib/timeval.c
index d11b95197..f4bf83531 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -110,7 +110,7 @@ struct curltime Curl_now(void)
usecs /= 1000;
cnow.tv_sec = usecs / 1000000;
- cnow.tv_usec = usecs % 1000000;
+ cnow.tv_usec = (int)(usecs % 1000000);
return cnow;
}
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index 422946e26..20bdbd706 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -1044,6 +1044,23 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
tmp_CFLAGS="$tmp_CFLAGS -Wdouble-promotion"
fi
#
+ dnl Only gcc 6 or later
+ if test "$compiler_num" -ge "600"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wshift-negative-value"
+ tmp_CFLAGS="$tmp_CFLAGS -Wshift-overflow=2"
+ tmp_CFLAGS="$tmp_CFLAGS -Wnull-dereference"
+ tmp_CFLAGS="$tmp_CFLAGS -Wduplicated-cond"
+ fi
+ #
+ dnl Only gcc 7 or later
+ if test "$compiler_num" -ge "700"; then
+ tmp_CFLAGS="$tmp_CFLAGS -Wduplicated-branches"
+ tmp_CFLAGS="$tmp_CFLAGS -Wrestrict"
+ tmp_CFLAGS="$tmp_CFLAGS -Walloc-zero"
+ tmp_CFLAGS="$tmp_CFLAGS -Wformat-overflow=2"
+ tmp_CFLAGS="$tmp_CFLAGS -Wformat-truncation=2"
+ fi
+ #
fi
#
dnl Do not issue warnings for code in system include paths.
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 41/178: cmake: Add advapi32 as explicit link library for win32, (continued)
- [GNUnet-SVN] [gnurl] 41/178: cmake: Add advapi32 as explicit link library for win32, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 49/178: cookie: case-insensitive hashing for the domains, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 47/178: openssl: provide defines for argument typecasts to build warning-free, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 60/178: configure: detect sa_family_t, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 45/178: cookie: store cookies per top-level-domain-specific hash table, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 58/178: hash: calculate sizes with size_t instead of longs, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 53/178: FTP: allow PASV on IPv6 connections when a proxy is being used, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 42/178: docs: fix CURLINFO_*_T examples use of CURL_FORMAT_CURL_OFF_T, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 62/178: curl_setup: provide a CURL_SA_FAMILY_T type if none exists, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 59/178: tool_operate: Fix retry on FTP 4xx to ignore other protocols, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 61/178: build: add picky compiler warning flags for gcc 6 and 7,
gnunet <=
- [GNUnet-SVN] [gnurl] 46/178: openssl: fix build with LibreSSL 2.7, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 57/178: RELEASE-NOTES: synced, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 54/178: build-openssl.bat: allow custom paths for VS and perl, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 50/178: tls: fix mbedTLS 2.7.0 build + handle sha256 failures, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 52/178: file: restore old behavior for file:////foo/bar URLs, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 69/178: travis: use trusty for coverage build, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 70/178: travis: bump to clang 6 and gcc 7, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 85/178: README.md: add backers and sponsors, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 55/178: winbuild: make the clean target work without build-type, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 44/178: cookies: when reading from a file, only remove_expired once, gnunet, 2018/05/23