From b6cf78ea43d348f29f89988f31062493e0329370 Mon Sep 17 00:00:00 2001 From: Keith Marshall Date: Sun, 3 Feb 2019 15:47:20 +0000 Subject: [PATCH] Clean up winsock default version selection stratagem. --- ChangeLog | 18 +++++++++++++++ mingwrt/ChangeLog | 18 --------------- w32api/ChangeLog | 19 +++++++++++++++ w32api/include/_winsock.h | 59 ----------------------------------------------- w32api/include/nspapi.h | 14 ++++++----- w32api/include/windows.h | 10 ++++---- w32api/include/winsock.h | 35 +++++++++++++++++++++++++--- w32api/include/winsock2.h | 9 +++++++- w32api/include/wsnetbs.h | 5 ++-- w32api/tests/headers.at | 1 - 10 files changed, 94 insertions(+), 94 deletions(-) delete mode 100644 w32api/include/_winsock.h diff --git a/ChangeLog b/ChangeLog index 4635b9c..88f7edf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2019-02-02 Keith Marshall + + Add build option for sample distribution. + + * configure.ac (lua): Add AC_PATH_PROG check; assign result to... + (LUA): ...this new AC_SUBST propagated macro definition. + + * Makefile.in (dist): Add dependencies on... + (dist-prepare, dist-extra): ...these new goals; implement... + (dist-prepare): ...to initialize an empty staging directory, and... + (dist-extra): ...incorporate optional distributable components. + (features.stamp): New optional goal; selected by definition of... + (FEATURES): ...this user specified macro, nominally defined by... + (option, options): ...evaluation of command line assignment. + (features.lua, features.unsupported): New prerequisite goals. + (WSL_TMPDIR, FEATURES_H_INITIALIZE, FEATURES_CFG, LUA, LUACMD) + (TODAY, ISSUE): New supporting macros; define them. + 2019-01-22 Keith Marshall Adjust repository version following WSL-5.2.1 release. diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog index a79e3dc..9e450d1 100644 --- a/mingwrt/ChangeLog +++ b/mingwrt/ChangeLog @@ -1,21 +1,3 @@ -2019-02-02 Keith Marshall - - Add build option for sample distribution. - - * configure.ac (lua): Add AC_PATH_PROG check; assign result to... - (LUA): ...this new AC_SUBST propagated macro definition. - - * Makefile.in (dist): Add dependencies on... - (dist-prepare, dist-extra): ...these new goals; implement... - (dist-prepare): ...to initialize an empty staging directory, and... - (dist-extra): ...incorporate optional distributable components. - (features.stamp): New optional goal; selected by definition of... - (FEATURES): ...this user specified macro, nominally defined by... - (option, options): ...evaluation of command line assignment. - (features.lua, features.unsupported): New prerequisite goals. - (WSL_TMPDIR, FEATURES_H_INITIALIZE, FEATURES_CFG, LUA, LUACMD) - (TODAY, ISSUE): New supporting macros; define them. - 2019-01-22 Keith Marshall Prepare and publish MinGW.org WSL-5.2.1 release. diff --git a/w32api/ChangeLog b/w32api/ChangeLog index a51ea0e..a300647 100644 --- a/w32api/ChangeLog +++ b/w32api/ChangeLog @@ -1,3 +1,22 @@ +2019-02-03 Keith Marshall + + Clean up winsock default version selection stratagem. + + * include/winsock.h [_WINSOCK_H]: Defer definition until within new + internal recursion breaking retest block; following evaluation of... + [__USE_MINGW_WINSOCK_DEFAULT]: ...this, whence may be + included, reproducing the original version selection logic from... + * include/_winsock.h: ...here; file is now obsolete; delete it. + + * include/winsock2.h (__USE_MINGW_WINSOCK_DEFAULT): Undefine it, + before including + + * include/windows.h include/nspapi.h include/wsnetbs.h: Define... + (__USE_MINGW_WINSOCK_DEFAULT): ...this, and then include + instead of deleted file <_winsock.h> + + * tests/headers.at: Regenerated. + 2019-01-22 Keith Marshall Prepare and publish MinGW.org WSL-5.2.1 release. diff --git a/w32api/include/_winsock.h b/w32api/include/_winsock.h deleted file mode 100644 index 8395338..0000000 --- a/w32api/include/_winsock.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * _winsock.h - * - * A private system header, included wherever other system headers may - * require declaration of the WinSock API, without explicitly specifying - * a particular WinSock version dependency. - * - * - * $Id$ - * - * Written by Keith Marshall - * Copyright (C) 2017, MinGW.org Project - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ -#ifndef _WINSOCK_H -#pragma GCC system_header - -/* The WinSock API dependency may be satisfied by including either - * or ; note that, regardless of whichever of these alternatives we - * choose, _WINSOCK_H will become defined, thus satisfying the repeat inclusion - * guard for this header file itself, without any requirement for us to provide - * an explicit definition herein. - */ -#include -#if _WIN32_WINNT >= _WIN32_WINNT_NT4 -/* When the target operating system is WinNT4, or later, we prefer to support - * the WinSock v2 API, by default; (this is consistent with the default choice - * which was traditionally specified within MinGW.org's )... - */ -#include - -#else -/* ...whereas, for operating systems predating WinNT4, we elect to offer - * support for only WinSock v1.1 - */ -#include -#endif - -#endif /* !_WINSOCK_H: $RCSfile$: end of file */ diff --git a/w32api/include/nspapi.h b/w32api/include/nspapi.h index c4c060b..2055970 100644 --- a/w32api/include/nspapi.h +++ b/w32api/include/nspapi.h @@ -7,7 +7,7 @@ * $Id$ * * Written by Anders Norlander - * Copyright (C) 1998, 1999, 2002, 2004, 2017, MinGW.org Project + * Copyright (C) 1998, 1999, 2002, 2004, 2017, 2019, MinGW.org Project * * * Permission is hereby granted, free of charge, to any person obtaining a @@ -42,12 +42,14 @@ * the full content, we must process the WinSock API declarations from * or , BEFORE we define the repeat * inclusion guard, so that may, if necessary, recurse to - * access the selectively exposed content. Inclusion of the following - * private header will declare the necessary WinSock API, choosing to - * include either or by default, on the same - * basis as the similar choice made in + * access the selectively exposed content. Inclusion of "winsock.h", + * subject to the __USE_MINGW_WINSOCK_DEFAULT feature test, declares + * the necessary WinSock API, choosing between the WinSock v1.1 API, + * and the WinSock v2 API, on the same basis as the similar choice + * made in */ -#include "_winsock.h" +#define __USE_MINGW_WINSOCK_DEFAULT +#include "winsock.h" /* We can now be confident that the WinSock API has been appropriately * declared; we may now define the repeat inclusion guard. diff --git a/w32api/include/windows.h b/w32api/include/windows.h index f196cd2..c79b1eb 100644 --- a/w32api/include/windows.h +++ b/w32api/include/windows.h @@ -6,7 +6,7 @@ * $Id$ * * Written by Anders Norlander - * Copyright (C) 1998-2003, 2006, 2007, 2016, 2017, MinGW.org Project + * Copyright (C) 1998-2003, 2006, 2007, 2016, 2017, 2019, MinGW.org Project * * * Permission is hereby granted, free of charge, to any person obtaining a @@ -76,13 +76,15 @@ #endif #if defined __USE_W32_SOCKETS \ || ! (defined __CYGWIN__ || defined __MSYS__ || defined _UWIN) - /* The WinSock API should be declared; including the following - * private header file will make an informed choice between the + /* The WinSock API should be declared; including , + * under the control of the __USE_MINGW_WINSOCK_DEFAULT feature + * test, will ensure that we make an informed choice between the * WinSock v1.1 API, as declared in , and WinSock v2, * as declared in , as the preferred default level * of WinSock API support to be offered. */ -# include "_winsock.h" +# define __USE_MINGW_WINSOCK_DEFAULT +# include "winsock.h" /* * FIXME: strict Microsoft compatibility may require inclusion * of here as well; however, this has been observed diff --git a/w32api/include/winsock.h b/w32api/include/winsock.h index 08967b3..26dab07 100644 --- a/w32api/include/winsock.h +++ b/w32api/include/winsock.h @@ -9,7 +9,7 @@ * $Id$ * * Adaptation by Anders Norlander - * Copyright (C) 1998-2004, 2012, 2016, 2017, MinGW.org Project. + * Copyright (C) 1998-2004, 2012, 2016, 2017, 2019, MinGW.org Project. * * Portions Copyright (C) 1980, 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -44,8 +44,35 @@ */ #ifndef _WINSOCK_H #pragma GCC system_header -#define _WINSOCK_H +#ifdef __USE_MINGW_WINSOCK_DEFAULT +/* This is default inclusion of by , (or some other + * W32API header; there is no sane reason for __USE_MINGW_WINSOCK_DEFAULT to + * have been defined, otherwise). Whereas Microsoft would simply default to + * using WinSock v1.1, MinGW may choose an alternative default. + */ +#include +#if _WIN32_WINNT >= _WIN32_WINNT_NT4 +/* When the target operating system is WinNT4, or later, we prefer to support + * the WinSock v2 API, by default; (this is consistent with the default choice + * which was traditionally specified within MinGW.org's ). + */ +#include "winsock2.h" + +#endif /* __USE_MINGW_WINSOCK_DEFAULT for Win-NT4 and later */ +#endif /* __USE_MINGW_WINSOCK_DEFAULT (any Windows version) */ + +/* If "winsock2.h" was included, to satisfy the __USE_MINGW_WINSOCK_DEFAULT + * condition, then the remainder of this file has already been processed, due + * to reinclusion by "winsock2.h"; test _WINSOCK_H again to prevent redundant + * reprocessing, (which may be potentially harmful)... + */ +#ifndef _WINSOCK_H +/* ...but, when _WINSOCK_H hasn't been defined yet, then this is our first + * opportunity to process this content; activate the guard, and + * proceed to process it now. + */ +#define _WINSOCK_H #define _GNU_H_WINDOWS32_SOCKETS #define __WINSOCK_H_SOURCED__ 1 @@ -677,7 +704,9 @@ _END_C_DECLS * references to the mswsock extensions. */ #include -#endif + +#endif /* !_WINSOCK2_H */ +#endif /* !_WINSOCK_H redundancy check */ #undef __WINSOCK_H_SOURCED__ #endif /* _WINSOCK_H: $RCSfile$: end of file */ diff --git a/w32api/include/winsock2.h b/w32api/include/winsock2.h index cdd1843..3e365e4 100644 --- a/w32api/include/winsock2.h +++ b/w32api/include/winsock2.h @@ -10,7 +10,7 @@ * * Contributed by the WINE Project. * Adaptation by Mumit Khan - * Copyright (C) 1998-2005, 2011, 2016, 2017, MinGW.org Project + * Copyright (C) 1998-2005, 2011, 2016, 2017, 2019, MinGW.org Project * * * Permission is hereby granted, free of charge, to any person obtaining a @@ -42,6 +42,13 @@ #pragma GCC system_header #define _WINSOCK2_H +/* This is MinGW's preferred WinSock default choice; having made it, we + * MUST now ensure that the __USE_MINGW_WINSOCK_DEFAULT selector doesn't + * persist beyond this point, since it would interfere with inclusion of + * common content from + */ +#undef __USE_MINGW_WINSOCK_DEFAULT + #ifdef _WINSOCK_H /* included prematurely */ /* Oops! appears to have been included already, which now * precludes any use of WinSock v2 protocol. diff --git a/w32api/include/wsnetbs.h b/w32api/include/wsnetbs.h index 9914efc..c69f75e 100644 --- a/w32api/include/wsnetbs.h +++ b/w32api/include/wsnetbs.h @@ -6,7 +6,7 @@ * $Id$ * * Written by Kai Henningsen - * Copyright (C) 2002, 2017, MinGW.org Project + * Copyright (C) 2002, 2017, 2019, MinGW.org Project * * * Permission is hereby granted, free of charge, to any person obtaining a @@ -41,7 +41,8 @@ #ifndef RC_INVOKED -#include "_winsock.h" +#define __USE_MINGW_WINSOCK_DEFAULT +#include "winsock.h" typedef struct sockaddr_nb { short snb_family; diff --git a/w32api/tests/headers.at b/w32api/tests/headers.at index 5edc831..9069693 100644 --- a/w32api/tests/headers.at +++ b/w32api/tests/headers.at @@ -255,7 +255,6 @@ winreg.h dnl winresrc.h dnl winsnmp.h dnl winsock2.h dnl -_winsock.h dnl winsock.h dnl winspool.h dnl winsvc.h dnl -- 2.11.0