https://gcc.gnu.org/g:424c6c88038ef13364e6e7e74e2389923d95396e

commit r15-9404-g424c6c88038ef13364e6e7e74e2389923d95396e
Author: Iain Buclaw <ibuc...@gdcproject.org>
Date:   Sun Apr 13 00:48:45 2025 +0200

    d: Fix importC cannot find input file __importc_builtins.d [PR119761]
    
    Synchronizes the D runtime library with upstream druntime 09ed02ce56,
    and fixes a rename of the importC module missed in the r15-6559 merge.
    
            PR d/119761
    
    libphobos/ChangeLog:
    
            * libdruntime/MERGE: Merge upstream druntime 09ed02ce56.
            * libdruntime/Makefile.am (DRUNTIME_DISOURCES): Rename __builtins.di
            to __importc_builtins.di.
            * libdruntime/Makefile.in: Regenerate.
            * libdruntime/__builtins.di: Move to...
            * libdruntime/__importc_builtins.di: ...here.
    
    gcc/testsuite/ChangeLog:
    
            * gdc.dg/import-c/import-c.exp: New test.
            * gdc.dg/import-c/pr119761.d: New test.
            * gdc.dg/import-c/pr119761c.c: New test.

Diff:
---
 gcc/testsuite/gdc.dg/import-c/import-c.exp         | 29 ++++++++++++++++++++++
 gcc/testsuite/gdc.dg/import-c/pr119761.d           |  2 ++
 gcc/testsuite/gdc.dg/import-c/pr119761c.c          |  4 +++
 libphobos/libdruntime/MERGE                        |  2 +-
 libphobos/libdruntime/Makefile.am                  |  2 +-
 libphobos/libdruntime/Makefile.in                  |  2 +-
 .../{__builtins.di => __importc_builtins.di}       | 10 ++++++--
 7 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/gdc.dg/import-c/import-c.exp 
b/gcc/testsuite/gdc.dg/import-c/import-c.exp
new file mode 100644
index 000000000000..53d1478d071b
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/import-c/import-c.exp
@@ -0,0 +1,29 @@
+#   Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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/>.
+
+# Load support procs.
+load_lib gdc-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+gdc-dg-runtest [lsort \
+       [glob -nocomplain $srcdir/$subdir/*.d ] ] "" \
+       "-I $srcdir/$subdir -finclude-imports"
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gdc.dg/import-c/pr119761.d 
b/gcc/testsuite/gdc.dg/import-c/pr119761.d
new file mode 100644
index 000000000000..20eff314a83d
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/import-c/pr119761.d
@@ -0,0 +1,2 @@
+// { dg-do compile }
+import pr119761c;
diff --git a/gcc/testsuite/gdc.dg/import-c/pr119761c.c 
b/gcc/testsuite/gdc.dg/import-c/pr119761c.c
new file mode 100644
index 000000000000..522f1bf9bf84
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/import-c/pr119761c.c
@@ -0,0 +1,4 @@
+int f119761(const char *, ...)
+{
+  return 0;
+}
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 00c85187b6de..840f8dd4f9d9 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-c6863be7206eef3c393726363a480baf0a0c6530
+09ed02ce56ea5bf3e59f21ee0390cd85eb8bfaa7
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
diff --git a/libphobos/libdruntime/Makefile.am 
b/libphobos/libdruntime/Makefile.am
index 9adb5034b088..4098310888fe 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -445,4 +445,4 @@ DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \
        core/sys/windows/winuser.d core/sys/windows/winver.d \
        core/sys/windows/wtsapi32.d core/sys/windows/wtypes.d
 
-DRUNTIME_DISOURCES = __builtins.di __main.di
+DRUNTIME_DISOURCES = __importc_builtins.di __main.di
diff --git a/libphobos/libdruntime/Makefile.in 
b/libphobos/libdruntime/Makefile.in
index 8f8072c6dc9e..1c0fa546dbbf 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -1126,7 +1126,7 @@ DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \
        core/sys/windows/winuser.d core/sys/windows/winver.d \
        core/sys/windows/wtsapi32.d core/sys/windows/wtypes.d
 
-DRUNTIME_DISOURCES = __builtins.di __main.di
+DRUNTIME_DISOURCES = __importc_builtins.di __main.di
 all: all-am
 
 .SUFFIXES:
diff --git a/libphobos/libdruntime/__builtins.di 
b/libphobos/libdruntime/__importc_builtins.di
similarity index 93%
rename from libphobos/libdruntime/__builtins.di
rename to libphobos/libdruntime/__importc_builtins.di
index b4fef091b5f4..9493962e4689 100644
--- a/libphobos/libdruntime/__builtins.di
+++ b/libphobos/libdruntime/__importc_builtins.di
@@ -3,10 +3,10 @@
  * The purpose is to make it unnecessary to hardwire them into the compiler.
  * As the leading double underscore suggests, this is for internal use only.
  *
- * Copyright: Copyright Digital Mars 2022
+ * Copyright: Copyright D Language Foundation 2022-2025
  * License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
  * Authors:   Walter Bright
- * Source: $(DRUNTIMESRC __builtins.d)
+ * Source: $(DRUNTIMESRC __importc_builtins.di)
  */
 
 
@@ -86,6 +86,12 @@ version (DigitalMars)
         return core.bitop.bswap(value);
     }
 
+    uint  __builtin__popcount()(ulong value)
+    {
+        import core.bitop;
+        return core.bitop._popcnt(value);
+    }
+
     // Lazily imported on first use
     private alias c_long = imported!"core.stdc.config".c_long;

Reply via email to