[gcc/devel/c++-modules] Adjust c++tools

Nathan Sidwell nathan@gcc.gnu.org
Wed Nov 11 17:55:10 GMT 2020


https://gcc.gnu.org/g:257f541310744f517df55da7cae686d66e458c6f

commit 257f541310744f517df55da7cae686d66e458c6f
Author: Nathan Sidwell <nathan@acm.org>
Date:   Wed Nov 11 06:25:33 2020 -0800

    Adjust c++tools
    
            * Makefile.def (c++tools): Depends on gcc
            * Makefile.in: Rebuilt
            c++tools/
            * mapper.h: Rename to ...
            * resolver.h: ... here.  Move mapper-client to
            gcc/cp/mapper-client.h
            * resolver.cc: Adjust.
            * configure.ac: Fix extraneous ]
            * configure: Rebuilt.
            gcc/cp/
            * mapper-client.h: New, split from c++tools/mapper.h.
            * mapper-client.cc: Adjust.
            * mapper-resolver.cc: Adjust.
            * module.cc: Adjust.

Diff:
---
 ChangeLog.modules                 | 16 ++++++++++
 Makefile.def                      |  3 +-
 Makefile.in                       |  2 +-
 c++tools/configure                |  2 +-
 c++tools/configure.ac             |  2 +-
 c++tools/resolver.cc              |  6 +++-
 c++tools/{mapper.h => resolver.h} | 45 ++--------------------------
 c++tools/server.cc                |  9 +++++-
 gcc/cp/mapper-client.cc           |  4 ++-
 gcc/cp/mapper-client.h            | 63 +++++++++++++++++++++++++++++++++++++++
 gcc/cp/mapper-resolver.cc         |  1 +
 gcc/cp/module.cc                  |  2 +-
 12 files changed, 105 insertions(+), 50 deletions(-)

diff --git a/ChangeLog.modules b/ChangeLog.modules
index 07e1637107c..86456e5203e 100644
--- a/ChangeLog.modules
+++ b/ChangeLog.modules
@@ -1,5 +1,21 @@
 2020-11-10  Nathan Sidwell  <nathan@acm.org>
 
+	Adjust c++tools
+	* Makefile.def (c++tools): Depends on gcc
+	* Makefile.in: Rebuilt
+	c++tools/
+	* mapper.h: Rename to ...
+	* resolver.h: ... here.  Move mapper-client to
+	gcc/cp/mapper-client.h
+	* resolver.cc: Adjust.
+	* configure.ac: Fix extraneous ]
+	* configure: Rebuilt.
+	gcc/cp/
+	* mapper-client.h: New, split from c++tools/mapper.h.
+	* mapper-client.cc: Adjust.
+	* mapper-resolver.cc: Adjust.
+	* module.cc: Adjust.
+
 	c++tools/
 	* mapper.h (class mapper_client): Add flag support.
 	gcc/cp/
diff --git a/Makefile.def b/Makefile.def
index 55bfa30fe35..6e98d2d3340 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -392,7 +392,8 @@ dependencies = { module=all-lto-plugin; on=all-libiberty-linker-plugin; };
 dependencies = { module=configure-libcc1; on=configure-gcc; };
 dependencies = { module=all-libcc1; on=all-gcc; };
 
-dependencies = { module=all-c++tools; on=all-libcody; };
+// we want version.o from gcc, and implicitly depend on libcody
+dependencies = { module=all-c++tools; on=all-gcc; };
 dependencies = { module=all-gotools; on=all-target-libgo; };
 
 dependencies = { module=all-utils; on=all-libiberty; };
diff --git a/Makefile.in b/Makefile.in
index 9211f331166..1438c324216 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -61662,7 +61662,7 @@ configure-m4: stage_last
 all-gnattools: maybe-all-target-libstdc++-v3
 configure-libcc1: maybe-configure-gcc
 all-libcc1: maybe-all-gcc
-all-c++tools: maybe-all-libcody
+all-c++tools: maybe-all-gcc
 all-utils: maybe-all-libiberty
 configure-gdb: maybe-all-intl
 configure-gdb: maybe-all-bfd
diff --git a/c++tools/configure b/c++tools/configure
index 0b304fbe63f..738b51a3a37 100755
--- a/c++tools/configure
+++ b/c++tools/configure
@@ -2683,7 +2683,7 @@ $as_echo_n "checking maintainer-mode... " >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $maintainer_mode" >&5
 $as_echo "$maintainer_mode" >&6; }
 test "$maintainer_mode" = yes && MAINTAINER=yes
-]
+
 
 # Check if O_CLOEXEC is defined by fcntl
 ac_ext=c
diff --git a/c++tools/configure.ac b/c++tools/configure.ac
index 74ffa028dba..8d882e541df 100644
--- a/c++tools/configure.ac
+++ b/c++tools/configure.ac
@@ -62,7 +62,7 @@ esac
 AC_MSG_CHECKING([maintainer-mode])
 AC_MSG_RESULT([$maintainer_mode])
 test "$maintainer_mode" = yes && MAINTAINER=yes
-AC_SUBST(MAINTAINER)]
+AC_SUBST(MAINTAINER)
 
 # Check if O_CLOEXEC is defined by fcntl
 AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [
diff --git a/c++tools/resolver.cc b/c++tools/resolver.cc
index 5f6a1924a12..193520bb45b 100644
--- a/c++tools/resolver.cc
+++ b/c++tools/resolver.cc
@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 
-#include "mapper.h"
+#include "resolver.h"
 // C++
 #include <algorithm>
 // C
@@ -32,6 +32,10 @@ along with GCC; see the file COPYING3.  If not see
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#ifndef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#endif
+
 module_resolver::module_resolver (bool map, bool xlate)
   : default_map (map), default_translate (xlate)
 {
diff --git a/c++tools/mapper.h b/c++tools/resolver.h
similarity index 77%
rename from c++tools/mapper.h
rename to c++tools/resolver.h
index 5df56e35cea..daee0f18872 100644
--- a/c++tools/mapper.h
+++ b/c++tools/resolver.h
@@ -18,18 +18,15 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#ifndef GXX_RESOLVER_H
+#define GXX_RESOLVER_H 1
+
 // Mapper interface for client and server bits
 #include "cody.hh"
 // C++
 #include <string>
 #include <map>
 
-#ifndef IS_DIR_SEPARATOR
-#define IS_DIR_SEPARATOR(C) ((C) == '/')
-#endif
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
 // This is a GCC class, so GCC coding conventions on new bits.  
 class module_resolver : public Cody::Resolver
 {
@@ -102,40 +99,4 @@ private:
   int cmi_response (Cody::Server *s, std::string &module);
 };
 
-#ifdef MAPPER_FOR_GCC
-#ifndef HAVE_SIGHANDLER_T
-typedef void (*sighandler_t) (int);
-#endif
-
-class module_client : public Cody::Client
-{
-  pex_obj *pex = nullptr;
-  sighandler_t sigpipe = SIG_IGN;
-  Cody::Flags flags = Cody::Flags::None;
-
-public:
-  module_client (Cody::Server *s)
-    : Client (s)
-  {
-  }
-  module_client (pex_obj *pex, int fd_from, int fd_to);
-
-  module_client (int fd_from, int fd_to)
-    : Client (fd_from, fd_to)
-  {
-  }
-
-public:
-  Cody::Flags get_flags () const
-  {
-    return flags;
-  }
-
-public:
-  static module_client *open_module_client (location_t loc, const char *option,
-					    void (*set_repo) (const char *),
-					    char const *);
-  static void close_module_client (location_t loc, module_client *);
-};
-
 #endif
diff --git a/c++tools/server.cc b/c++tools/server.cc
index 6ea788d90fa..6457dc5b878 100644
--- a/c++tools/server.cc
+++ b/c++tools/server.cc
@@ -19,7 +19,7 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
-#include "mapper.h"
+#include "resolver.h"
 
 // C++
 #include <set>
@@ -84,6 +84,13 @@ along with GCC; see the file COPYING3.  If not see
 #define O_CLOEXEC 0
 #endif
 
+#ifndef IS_DIR_SEPARATOR
+#define IS_DIR_SEPARATOR(C) ((C) == '/')
+#endif
+#ifndef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#endif
+
 #ifdef NETWORKING
 struct netmask {
   in6_addr addr;
diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc
index a9b86acbad5..22605ca8cf9 100644
--- a/gcc/cp/mapper-client.cc
+++ b/gcc/cp/mapper-client.cc
@@ -23,9 +23,11 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "line-map.h"
 #include "diagnostic-core.h"
-#include "mapper.h"
+#include "mapper-client.h"
 #include "intl.h"
 
+#include "../../c++tools/resolver.h"
+
 module_client::module_client (pex_obj *p, int fd_from, int fd_to)
   : Client (fd_from, fd_to), pex (p)
 {
diff --git a/gcc/cp/mapper-client.h b/gcc/cp/mapper-client.h
new file mode 100644
index 00000000000..ca1a0aa5509
--- /dev/null
+++ b/gcc/cp/mapper-client.h
@@ -0,0 +1,63 @@
+/* C++ modules.  Experimental!	-*- c++ -*-
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   Written by Nathan Sidwell <nathan@acm.org> while at FaceBook
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+/* Forward to the header in c++tools.  */
+
+#ifndef MAPPER_CLIENT_H
+#define MAPPER_CLIENT_H 1
+
+#include "cody.hh"
+
+#ifndef HAVE_SIGHANDLER_T
+typedef void (*sighandler_t) (int);
+#endif
+
+class module_client : public Cody::Client
+{
+  pex_obj *pex = nullptr;
+  sighandler_t sigpipe = SIG_IGN;
+  Cody::Flags flags = Cody::Flags::None;
+
+public:
+  module_client (Cody::Server *s)
+    : Client (s)
+  {
+  }
+  module_client (pex_obj *pex, int fd_from, int fd_to);
+
+  module_client (int fd_from, int fd_to)
+    : Client (fd_from, fd_to)
+  {
+  }
+
+public:
+  Cody::Flags get_flags () const
+  {
+    return flags;
+  }
+
+public:
+  static module_client *open_module_client (location_t loc, const char *option,
+					    void (*set_repo) (const char *),
+					    char const *);
+  static void close_module_client (location_t loc, module_client *);
+};
+
+#endif
diff --git a/gcc/cp/mapper-resolver.cc b/gcc/cp/mapper-resolver.cc
index 0cf603469d4..02ec48c61ea 100644
--- a/gcc/cp/mapper-resolver.cc
+++ b/gcc/cp/mapper-resolver.cc
@@ -23,4 +23,5 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #define INCLUDE_ALGORITHM
 #include "system.h"
+
 #include "../../c++tools/resolver.cc"
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index ab95774a05b..7b9ef54db03 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -228,7 +228,7 @@ Classes used:
 #include "attribs.h"
 #include "intl.h"
 #include "langhooks.h"
-#include "mapper.h"
+#include "mapper-client.h"
 
 #if HAVE_MMAP_FILE && _POSIX_MAPPED_FILES > 0
 /* mmap, munmap.  */


More information about the Gcc-cvs mailing list