From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1059) id D26713857C55; Fri, 9 Oct 2020 14:48:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D26713857C55 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Nathan Sidwell To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/c++-modules] Clean up mangling documentation X-Act-Checkin: gcc X-Git-Author: Nathan Sidwell X-Git-Refname: refs/heads/devel/c++-modules X-Git-Oldrev: 563a32906fb6d869f74c245c5c6e51e6d8887a21 X-Git-Newrev: 8047291fa52c57f51a13bec41f29728f839153dc Message-Id: <20201009144823.D26713857C55@sourceware.org> Date: Fri, 9 Oct 2020 14:48:23 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2020 14:48:23 -0000 https://gcc.gnu.org/g:8047291fa52c57f51a13bec41f29728f839153dc commit 8047291fa52c57f51a13bec41f29728f839153dc Author: Nathan Sidwell Date: Fri Oct 9 06:44:01 2020 -0700 Clean up mangling documentation gcc/cp/ * mangle.c (write_module): Update grammar description. * module.cc (module_state::mangle): Clarify why partitions might be significant. Diff: --- ChangeLog.modules | 6 ++++++ gcc/cp/mangle.c | 18 +++++++++--------- gcc/cp/module.cc | 3 ++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ChangeLog.modules b/ChangeLog.modules index e27864f54aa..4279182e909 100644 --- a/ChangeLog.modules +++ b/ChangeLog.modules @@ -1,5 +1,11 @@ 2020-10-09 Nathan Sidwell + Clean up mangling documentation + gcc/cp/ + * mangle.c (write_module): Update grammar description. + * module.cc (module_state::mangle): Clarify why partitions might + be significant. + Clean up some c-family pieces gcc/ * langhooks.h (struct lang_hooks): Replace diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 7b0ad0ce2f0..6f9c93cb571 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -862,15 +862,15 @@ mangle_identifier (char c, tree id) write_source_name (id); } -/* If the outermost non-namespace context (including DECL itself) is a - non-exported module decl, mangle the module information. - - ::= W + E - - FIXME: Module mangling is not fully baked. How moduleness sticks - to regular back-references is tricky. Namespaces cannot have - moduleness, but classes can. However, both are mangled the same, - so the demangler doesn't have a clue. +/* If the outermost non-namespace context (including DECL itself) is + a module-linkage decl, mangle the module information. For module + global initializers we need to include the partition part. + + ::= W + E + :: + || _ ;; short backref + || W _ ;; long backref + || P ;; partition introducer */ static void diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index b241b44b41e..e7dda8e63e9 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -13682,7 +13682,8 @@ module_state::mangle (bool include_partition) if (include_partition || !is_partition ()) { char p = 0; - if (is_partition () && !(parent && parent->is_partition ())) + // Partitions are significant for global initializer functions + if (is_partition () && !parent->is_partition ()) p = 'P'; substs.safe_push (this); subst = substs.length ();