public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* c++: Another solaris header use [PR 98315]
@ 2020-12-16 19:57 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-12-16 19:57 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

Rather than early-include sys/socket.h,	let's allow the	includer to
tell cody no networking.

	libcody/
         * cody.hh: Allow user to set CODY_NETWORKING.
         gcc/cp/
         * mapper-resolver.cc: Remove early include of
         sys/socket.h.  Specify no CODY_NETWORKING instead.
         * module.cc: Specify no CODY_NETWORKING.

pushing to trunk
-- 
Nathan Sidwell

[-- Attachment #2: sol3.diff --]
[-- Type: text/x-patch, Size: 1825 bytes --]

diff --git i/gcc/cp/mapper-resolver.cc w/gcc/cp/mapper-resolver.cc
index 8e968c52556..53c482441b4 100644
--- i/gcc/cp/mapper-resolver.cc
+++ w/gcc/cp/mapper-resolver.cc
@@ -21,13 +21,9 @@ along with GCC; see the file COPYING3.  If not see
 /* Forward to the resolver in c++tools.  */
 
 #include "config.h"
-#if defined (__unix__)
-// Solaris11's socket header used bcopy, which we poison.  cody.hh
-// will include it later under the above check
-#include <sys/socket.h>
-#endif
-
 #define INCLUDE_ALGORITHM
 #include "system.h"
 
+// We don't want or need to be aware of networking
+#define CODY_NETWORKING 0
 #include "../../c++tools/resolver.cc"
diff --git i/gcc/cp/module.cc w/gcc/cp/module.cc
index e9ea18636b4..2318489d9d4 100644
--- i/gcc/cp/module.cc
+++ w/gcc/cp/module.cc
@@ -207,7 +207,6 @@ Classes used:
 
 #define _DEFAULT_SOURCE 1 /* To get TZ field of struct tm, if available.  */
 #include "config.h"
-
 #include "system.h"
 #include "coretypes.h"
 #include "cp-tree.h"
@@ -229,6 +228,8 @@ Classes used:
 #include "attribs.h"
 #include "intl.h"
 #include "langhooks.h"
+/* This TU doesn't need or want to see the networking.  */
+#define CODY_NETWORKING 0
 #include "mapper-client.h"
 
 #if HAVE_MMAP_FILE && _POSIX_MAPPED_FILES > 0
diff --git i/libcody/cody.hh w/libcody/cody.hh
index 31d9c182cbe..789ce9e70b7 100644
--- i/libcody/cody.hh
+++ w/libcody/cody.hh
@@ -5,6 +5,9 @@
 #ifndef CODY_HH
 #define CODY_HH 1
 
+// If the user specifies this as non-zero, it must be what we expect,
+// generally only good for requesting no networking
+#if !defined (CODY_NETWORKING)
 // Have a known-good list of networking systems
 #if defined (__unix__) || defined (__MACH__)
 #define CODY_NETWORKING 1
@@ -15,6 +18,7 @@
 #undef CODY_NETWORKING
 #define CODY_NETWORKING 0
 #endif
+#endif
 
 // C++
 #include <memory>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-16 19:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 19:57 c++: Another solaris header use [PR 98315] Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).