From: Lee <ler762@users.sourceforge.net>
Date: Mon, 14 Dec 2020 14:11:30 +0000 (-0500)
Subject: fix compiler warnings about including winsock2.h before windows.h
X-Git-Tag: v_3_0_30~268
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/developer-manual/static/faq/static/@default-cgi@edit-actions-remove-url?a=commitdiff_plain;h=867cd1d8d3a03442c86036fed101c6fcf6c7fd04;p=privoxy.git

fix compiler warnings about including winsock2.h before windows.h

getting plenty too many of these warnings:
i686-w64-mingw32-gcc -c -pipe -O2 -Wshadow -DWINVER=0x501   -mwindows -Wall -Ipcre  actions.c -o actions.o
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/ws2tcpip.h:17,
                 from project.h:95,
                 from actions.c:46:
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
   15 | #warning Please include winsock2.h before windows.h
      |  ^~~~~~~
i686-w64-mingw32-gcc -c -pipe -O2 -Wshadow -DWINVER=0x501   -mwindows -Wall -Ipcre  cgi.c -o cgi.o
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/ws2tcpip.h:17,
                 from project.h:95,
                 from cgi.c:52:
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
   15 | #warning Please include winsock2.h before windows.h
      |  ^~~~~~~
i686-w64-mingw32-gcc -c -pipe -O2 -Wshadow -DWINVER=0x501   -mwindows -Wall -Ipcre  cgiedit.c -o cgiedit.o
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/ws2tcpip.h:17,
                 from project.h:95,
                 from cgiedit.c:57:
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
   15 | #warning Please include winsock2.h before windows.h
      |  ^~~~~~~
---

diff --git a/project.h b/project.h
index 43792dde..14b957f8 100644
--- a/project.h
+++ b/project.h
@@ -59,6 +59,10 @@
    typedef pthread_mutex_t privoxy_mutex_t;
 #else
 #  ifdef _WIN32
+#     include <winsock2.h>
+      /* without winsock2.h I get lots of compiler warnings about
+       * #warning Please include winsock2.h before windows.h
+       */
 #     include <windows.h>
 #  endif
    typedef CRITICAL_SECTION privoxy_mutex_t;