diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index 270f05653b..36ce76b18f 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -436,6 +436,10 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND MSVC) endforeach() endif() +if(DOS AND CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0) + list(APPEND _picky "-Wno-arith-conversion") # Avoid warnings in DJGPP's built-in FD_SET() macro +endif() + if(_picky_nocheck OR _picky) set(_picky_tmp "${_picky_nocheck}" "${_picky}") string(REPLACE ";" " " _picky_tmp "${_picky_tmp}") diff --git a/configure.ac b/configure.ac index b4485e7889..00696689bd 100644 --- a/configure.ac +++ b/configure.ac @@ -598,6 +598,15 @@ if test "$compiler_id" = "INTEL_UNIX_C"; then # fi +case $host in + *msdosdjgpp) + if test "$compiler_num" -ge "1000"; then + dnl Avoid warnings in DJGPP's built-in FD_SET() macro + CFLAGS="$CFLAGS -Wno-arith-conversion" + fi + ;; +esac + CURL_CFLAG_EXTRAS="" if test "$want_werror" = "yes"; then CURL_CFLAG_EXTRAS="-Werror" diff --git a/docs/examples/sendrecv.c b/docs/examples/sendrecv.c index 21a09b6584..5e4ef10b05 100644 --- a/docs/examples/sendrecv.c +++ b/docs/examples/sendrecv.c @@ -36,9 +36,6 @@ */ #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wsign-conversion" -#ifdef __DJGPP__ -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif #elif defined(_MSC_VER) #pragma warning(disable:4127) /* conditional expression is constant */ #endif diff --git a/lib/cshutdn.c b/lib/cshutdn.c index 84e5b2a116..b2c62e1309 100644 --- a/lib/cshutdn.c +++ b/lib/cshutdn.c @@ -480,17 +480,10 @@ void Curl_cshutdn_setfds(struct cshutdn *cshutdn, curl_socket_t sock = ps.sockets[i]; if(!FDSET_SOCK(sock)) continue; -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif if(ps.actions[i] & CURL_POLL_IN) FD_SET(sock, read_fd_set); if(ps.actions[i] & CURL_POLL_OUT) FD_SET(sock, write_fd_set); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if((ps.actions[i] & (CURL_POLL_OUT | CURL_POLL_IN)) && ((int)sock > *maxfd)) *maxfd = (int)sock; diff --git a/lib/multi.c b/lib/multi.c index 901f1b6deb..e6b2d19041 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1246,17 +1246,10 @@ CURLMcode curl_multi_fdset(CURLM *m, if(!FDSET_SOCK(ps.sockets[i])) /* pretend it does not exist */ continue; -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif if(ps.actions[i] & CURL_POLL_IN) FD_SET(ps.sockets[i], read_fd_set); if(ps.actions[i] & CURL_POLL_OUT) FD_SET(ps.sockets[i], write_fd_set); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if((int)ps.sockets[i] > this_max_fd) this_max_fd = (int)ps.sockets[i]; } diff --git a/src/tool_cb_rea.c b/src/tool_cb_rea.c index 4683f70691..85b60864f9 100644 --- a/src/tool_cb_rea.c +++ b/src/tool_cb_rea.c @@ -65,14 +65,7 @@ static bool waitfd(int waitms, int fd) timeout.tv_usec = (int)((waitms % 1000) * 1000); FD_ZERO(&bits); -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(fd, &bits); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(!select(fd + 1, &bits, NULL, NULL, &timeout)) return TRUE; /* timeout */ return FALSE; diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c index f41530e385..c2d1d3375b 100644 --- a/tests/libtest/lib530.c +++ b/tests/libtest/lib530.c @@ -233,14 +233,7 @@ static void t530_updateFdSet(struct t530_Sockets *sockets, fd_set *fdset, { int i; for(i = 0; i < sockets->count; ++i) { -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sockets->sockets[i], fdset); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(*maxFd < sockets->sockets[i] + 1) { *maxFd = sockets->sockets[i] + 1; } diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c index 1ba6b947fa..4ac7b903bd 100644 --- a/tests/libtest/lib582.c +++ b/tests/libtest/lib582.c @@ -180,14 +180,7 @@ static void t582_updateFdSet(struct t582_Sockets *sockets, fd_set *fdset, { int i; for(i = 0; i < sockets->count; ++i) { -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sockets->sockets[i], fdset); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(*maxFd < sockets->sockets[i] + 1) { *maxFd = sockets->sockets[i] + 1; } diff --git a/tests/libtest/lib758.c b/tests/libtest/lib758.c index f6f371948e..13f83526da 100644 --- a/tests/libtest/lib758.c +++ b/tests/libtest/lib758.c @@ -279,14 +279,7 @@ static void t758_updateFdSet(struct t758_Sockets *sockets, fd_set *fdset, { int i; for(i = 0; i < sockets->count; ++i) { -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sockets->sockets[i], fdset); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(*maxFd < sockets->sockets[i] + 1) { *maxFd = sockets->sockets[i] + 1; } diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index cff3d497ea..784bab4c3e 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -675,14 +675,7 @@ static bool mqttd_incoming(curl_socket_t listenfd) FD_ZERO(&fds_err); /* there is always a socket to wait for */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sockfd, &fds_read); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif do { /* select() blocking behavior call on blocking descriptors please */ diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 01548f173d..fb1282df03 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -953,14 +953,7 @@ static bool juggle(curl_socket_t *sockfdp, FD_ZERO(&fds_write); FD_ZERO(&fds_err); -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET((curl_socket_t)fileno(stdin), &fds_read); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif switch(*mode) { @@ -969,14 +962,7 @@ static bool juggle(curl_socket_t *sockfdp, /* server mode */ sockfd = listenfd; /* there is always a socket to wait for */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sockfd, &fds_read); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif maxfd = (int)sockfd; break; @@ -990,14 +976,7 @@ static bool juggle(curl_socket_t *sockfdp, } else { /* there is always a socket to wait for */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sockfd, &fds_read); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif maxfd = (int)sockfd; } break; @@ -1007,14 +986,7 @@ static bool juggle(curl_socket_t *sockfdp, sockfd = *sockfdp; /* sockfd turns CURL_SOCKET_BAD when our connection has been closed */ if(CURL_SOCKET_BAD != sockfd) { -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sockfd, &fds_read); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif maxfd = (int)sockfd; } else { diff --git a/tests/server/socksd.c b/tests/server/socksd.c index 556fb47c62..91f8c119d9 100644 --- a/tests/server/socksd.c +++ b/tests/server/socksd.c @@ -649,37 +649,16 @@ static bool socksd_incoming(curl_socket_t listenfd) FD_ZERO(&fds_err); /* there is always a socket to wait for */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sockfd, &fds_read); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif for(i = 0; i < 2; i++) { if(c[i].used) { curl_socket_t fd = c[i].clientfd; -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(fd, &fds_read); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if((int)fd > maxfd) maxfd = (int)fd; fd = c[i].remotefd; -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(fd, &fds_read); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if((int)fd > maxfd) maxfd = (int)fd; } diff --git a/tests/server/sws.c b/tests/server/sws.c index 59f41c8e03..224cc9d888 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -1118,14 +1118,7 @@ static int sws_get_request(curl_socket_t sock, struct sws_httprequest *req) FD_ZERO(&input); FD_ZERO(&output); got = 0; -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(sock, &input); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif do { logmsg("Wait until readable"); rc = select((int)sock + 1, &input, &output, NULL, &timeout); @@ -1321,14 +1314,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port) timeout.tv_sec = 1; /* 1000 ms */ FD_ZERO(&output); -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(serverfd, &output); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif while(1) { rc = select((int)serverfd + 1, NULL, &output, NULL, &timeout); if(rc < 0 && SOCKERRNO != SOCKEINTR) @@ -1453,14 +1439,7 @@ static void http_connect(curl_socket_t *infdp, /* listener socket is monitored to allow client to establish secondary tunnel only when this tunnel is not established and primary one is fully operational */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(rootfd, &input); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif maxfd = rootfd; } @@ -1470,28 +1449,14 @@ static void http_connect(curl_socket_t *infdp, if(clientfd[i] != CURL_SOCKET_BAD) { if(poll_client_rd[i]) { /* unless told not to do so, monitor readability */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(clientfd[i], &input); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(clientfd[i] > maxfd) maxfd = clientfd[i]; } if(poll_client_wr[i] && toc[i]) { /* unless told not to do so, monitor writability if there is data ready to be sent to client */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(clientfd[i], &output); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(clientfd[i] > maxfd) maxfd = clientfd[i]; } @@ -1500,28 +1465,14 @@ static void http_connect(curl_socket_t *infdp, if(serverfd[i] != CURL_SOCKET_BAD) { if(poll_server_rd[i]) { /* unless told not to do so, monitor readability */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(serverfd[i], &input); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(serverfd[i] > maxfd) maxfd = serverfd[i]; } if(poll_server_wr[i] && tos[i]) { /* unless told not to do so, monitor writability if there is data ready to be sent to server */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(serverfd[i], &output); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(serverfd[i] > maxfd) maxfd = serverfd[i]; } @@ -2343,14 +2294,7 @@ static int test_sws(int argc, char *argv[]) for(socket_idx = 0; socket_idx < num_sockets; ++socket_idx) { /* Listen on all sockets */ -#ifdef __DJGPP__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Warith-conversion" -#endif FD_SET(all_sockets[socket_idx], &input); -#ifdef __DJGPP__ -#pragma GCC diagnostic pop -#endif if(all_sockets[socket_idx] > maxfd) maxfd = all_sockets[socket_idx]; }