OSDN Git Service

Clean up winsock default version selection stratagem.
authorKeith Marshall <keith@users.osdn.me>
Sun, 3 Feb 2019 15:47:20 +0000 (15:47 +0000)
committerKeith Marshall <keith@users.osdn.me>
Sun, 3 Feb 2019 15:47:20 +0000 (15:47 +0000)
ChangeLog
mingwrt/ChangeLog
w32api/ChangeLog
w32api/include/_winsock.h [deleted file]
w32api/include/nspapi.h
w32api/include/windows.h
w32api/include/winsock.h
w32api/include/winsock2.h
w32api/include/wsnetbs.h
w32api/tests/headers.at

index 4635b9c..88f7edf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2019-02-02  Keith Marshall  <keith@users.osdn.me>
+
+       Add build option for <features.h> 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  <keith@users.osdn.me>
 
        Adjust repository version following WSL-5.2.1 release.
index a79e3dc..9e450d1 100644 (file)
@@ -1,21 +1,3 @@
-2019-02-02  Keith Marshall  <keith@users.osdn.me>
-
-       Add build option for <features.h> 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  <keith@users.osdn.me>
 
        Prepare and publish MinGW.org WSL-5.2.1 release.
index a51ea0e..a300647 100644 (file)
@@ -1,3 +1,22 @@
+2019-02-03  Keith Marshall  <keith@users.osdn.me>
+
+       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 <winsock2.h> 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 <winsock.h>
+
+       * include/windows.h include/nspapi.h include/wsnetbs.h: Define...
+       (__USE_MINGW_WINSOCK_DEFAULT): ...this, and then include <winsock.h>
+       instead of deleted file <_winsock.h>
+
+       * tests/headers.at: Regenerated.
+
 2019-01-22  Keith Marshall  <keith@users.osdn.me>
 
        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 (file)
index 8395338..0000000
+++ /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 <keith@users.osdn.me>
- * 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 <winsock.h>
- * or <winsock2.h>; 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 <sdkddkver.h>
-#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 <windows.h>)...
- */
-#include <winsock2.h>
-
-#else
-/* ...whereas, for operating systems predating WinNT4, we elect to offer
- * support for only WinSock v1.1
- */
-#include <winsock.h>
-#endif
-
-#endif /* !_WINSOCK_H: $RCSfile$: end of file */
index c4c060b..2055970 100644 (file)
@@ -7,7 +7,7 @@
  * $Id$
  *
  * Written by Anders Norlander <anorland@hem2.passagen.se>
- * 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
  * the full content, we must process the WinSock API declarations from
  * <winsock.h> or <winsock2.h>, BEFORE we define the <nspapi.h> repeat
  * inclusion guard, so that <winsock2.h> 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 <winsock.h> or <winsock2.h> by default, on the same
- * basis as the similar choice made in <windows.h>
+ * 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 <windows.h>
  */
-#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 <nspapi.h> repeat inclusion guard.
index f196cd2..c79b1eb 100644 (file)
@@ -6,7 +6,7 @@
  * $Id$
  *
  * Written by Anders Norlander <anorland@hem2.passagen.se>
- * 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
 #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 <winsock.h>,
+  * 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 <winsock.h>, and WinSock v2,
   * as declared in <winsock2.h>, 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 <mswsock.h> here as well; however, this has been observed
index 08967b3..26dab07 100644 (file)
@@ -9,7 +9,7 @@
  * $Id$
  *
  * Adaptation by Anders Norlander <anorland@hem2.passagen.se>
- * 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.
  */
 #ifndef _WINSOCK_H
 #pragma GCC system_header
-#define _WINSOCK_H
 
+#ifdef __USE_MINGW_WINSOCK_DEFAULT
+/* This is default inclusion of <winsock.h> by <windows.h>, (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 <sdkddkver.h>
+#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 <windows.h>).
+ */
+#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 <winsock.h> 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 <mswsock.h>
-#endif
+
+#endif /* !_WINSOCK2_H */
+#endif /* !_WINSOCK_H redundancy check */
 
 #undef __WINSOCK_H_SOURCED__
 #endif /* _WINSOCK_H: $RCSfile$: end of file */
index cdd1843..3e365e4 100644 (file)
@@ -10,7 +10,7 @@
  *
  * Contributed by the WINE Project.
  * Adaptation by Mumit Khan <khan@xraylith.wisc.edu>
- * 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
 #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 <winsock.h>
+ */
+#undef __USE_MINGW_WINSOCK_DEFAULT
+
 #ifdef _WINSOCK_H  /* included prematurely */
 /* Oops!  <winsock.h> appears to have been included already, which now
  * precludes any use of WinSock v2 protocol.
index 9914efc..c69f75e 100644 (file)
@@ -6,7 +6,7 @@
  * $Id$
  *
  * Written by Kai Henningsen <kai-henningsen@users.sourceforge.net>
- * 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;
index 5edc831..9069693 100644 (file)
@@ -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