[d] Committed ensure all unittests are registered against the original module.

Message ID CABOHX+e=_Xn1Jw0ROYf6UmB1LLuRQgFU8cKa6oeraFwZy0MTqw@mail.gmail.com
State New
Headers show
Series
  • [d] Committed ensure all unittests are registered against the original module.
Related show

Commit Message

Iain Buclaw April 21, 2019, 7:13 a.m.
Hi,

This patch is a follow-up fix for PR d/89255, as any unittest
functions registered against the testing module when compiling with
-fbuilding-libphobos-tests are ignored during the generation of the
ModuleInfo data.

Regression tested on x86_64-linux-gnu.

Committed to trunk as r270477.

-- 
Iain
---
gcc/d/ChangeLog:

2019-04-21  Iain Buclaw  <ibuclaw@gdcproject.org>

        * modules.cc (register_module_decl): Don't register unittests against
        the ModuleInfo symbol for -fbuilding-libphobos-tests.

---

Patch

diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc
index 315f5d82356..35050c8e17a 100644
--- a/gcc/d/modules.cc
+++ b/gcc/d/modules.cc
@@ -836,7 +836,8 @@  register_module_decl (Declaration *d)
 	 compiling in unittests are kept track of separately so they are
 	 not omitted when compiling with -fbuilding-libphobos-tests.  */
       module_info *minfo;
-      if (flag_building_libphobos_tests && DECL_IN_UNITTEST_CONDITION_P (decl))
+      if (flag_building_libphobos_tests && !fd->isUnitTestDeclaration ()
+	  && DECL_IN_UNITTEST_CONDITION_P (decl))
 	minfo = current_testing_module;
       else
 	minfo = current_moduleinfo;