get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2194406/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2194406,
    "url": "http://patchwork.ozlabs.org/api/patches/2194406/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260208195814.919294-1-ibuclaw@gdcproject.org/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api",
        "name": "GNU Compiler Collection",
        "link_name": "gcc",
        "list_id": "gcc-patches.gcc.gnu.org",
        "list_email": "gcc-patches@gcc.gnu.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260208195814.919294-1-ibuclaw@gdcproject.org>",
    "list_archive_url": null,
    "date": "2026-02-08T19:58:14",
    "name": "[committed] d: Add convenient overload for build_libcall",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "c26eeba013003c23be99544d54f5f5e0cce40072",
    "submitter": {
        "id": 46728,
        "url": "http://patchwork.ozlabs.org/api/people/46728/?format=api",
        "name": "Iain Buclaw",
        "email": "ibuclaw@gdcproject.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260208195814.919294-1-ibuclaw@gdcproject.org/mbox/",
    "series": [
        {
            "id": 491437,
            "url": "http://patchwork.ozlabs.org/api/series/491437/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491437",
            "date": "2026-02-08T19:58:14",
            "name": "[committed] d: Add convenient overload for build_libcall",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/491437/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2194406/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2194406/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gdcproject.org header.i=@gdcproject.org\n header.a=rsa-sha256 header.s=MBO0001 header.b=0sp3Ynoa;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gdcproject.org header.i=@gdcproject.org\n header.a=rsa-sha256 header.s=MBO0001 header.b=0sp3Ynoa",
            "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=gdcproject.org",
            "sourceware.org; spf=pass smtp.mailfrom=gdcproject.org",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=80.241.56.171",
            "outgoing_mbo_mout; dkim=none;\n spf=pass (outgoing_mbo_mout: domain of ibuclaw@gdcproject.org designates\n 2001:67c:2050:b231:465::1 as permitted sender)\n smtp.mailfrom=ibuclaw@gdcproject.org"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f8JZQ2bhCz1xvc\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 09 Feb 2026 06:59:41 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id E4B454793AFD\n\tfor <incoming@patchwork.ozlabs.org>; Sun,  8 Feb 2026 19:59:39 +0000 (GMT)",
            "from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171])\n by sourceware.org (Postfix) with ESMTPS id A2F314793AF8\n for <gcc-patches@gcc.gnu.org>; Sun,  8 Feb 2026 19:58:20 +0000 (GMT)",
            "from smtp1.mailbox.org (smtp1.mailbox.org\n [IPv6:2001:67c:2050:b231:465::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4f8JXn5qDMz9tlh;\n Sun,  8 Feb 2026 20:58:17 +0100 (CET)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org E4B454793AFD",
            "OpenDKIM Filter v2.11.0 sourceware.org A2F314793AF8"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org A2F314793AF8",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org A2F314793AF8",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770580706; cv=none;\n b=YsCeUMatQ3TO7OpDZylc1SdUeVTRnPTjGrwTWWudehFR35THJ/UwL2s6XXUJE2DE0WSXpDJekcpfZfi0GSLx4OhS/+8J+55icCIxi+9QPnGV9ee09UeDbKwJ5KKavEgO41u2oMNQybj+04dk/j+XlP193fqCxk9qzEsWsoHYZ9o=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770580706; c=relaxed/simple;\n bh=u1JcI6E/JcBpzrsPgfh7areoRXJI78nvMepEZHkdJHk=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=J0QBqMIBHhVFEvqj2VBCHO2IAYs6mOFAVRHeAzX6t/ryqvmbSonpEpTH8Od1iBwsShODaB0glCgXABFEjp0iVL9VepqutS1ICM5vwWpQODYilwiGQxpIvpo/uoX4piR3itG52nhtZDJWYMUe40Q7ZzrnFeuKcmZIV7jEo/klpNw=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gdcproject.org;\n s=MBO0001; t=1770580697;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=tiq5rn4JIrUCJ/+5b0ONfzO8CBc0CFIo5Q1bkDlDriY=;\n b=0sp3Ynoa/B9+k3znKv9xWWaL5ZT9JQtoohxD6Lfx3RV8iYoOW7hDeEF9/XX+E8NFLU45XG\n wojX+03OyDnT7BWHk4R2OkZA4quIYHtcPfOteBrKI+sTEv0r4+3Re4wkhUrMuf6bE5OSRY\n hSpCRP0ybaI7i0ITvHurjkH1ku84OTZEVLSmJ5xSRkhQY+s/y20rEDfXA92ri9tsk67ssx\n w5KhliqWBdUtB30DaZxoBTWNXAWTNXv49qm7pq5oaBSpbP1aNrv1M7FLNQ+HVS5Wi4pTtP\n vyOuAsUcNbKIp7f9LEcCvjkSXu+xWy5po1qk6+yOt3tOiEi3++70o5894OMICA==",
        "From": "Iain Buclaw <ibuclaw@gdcproject.org>",
        "To": "gcc-patches@gcc.gnu.org",
        "Cc": "Iain Buclaw <ibuclaw@gdcproject.org>",
        "Subject": "[committed] d: Add convenient overload for build_libcall",
        "Date": "Sun,  8 Feb 2026 20:58:14 +0100",
        "Message-ID": "<20260208195814.919294-1-ibuclaw@gdcproject.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Rspamd-Queue-Id": "4f8JXn5qDMz9tlh",
        "X-BeenThere": "gcc-patches@gcc.gnu.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>",
        "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>",
        "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>",
        "List-Post": "<mailto:gcc-patches@gcc.gnu.org>",
        "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>",
        "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "Hi,\n\nMost generated calls to build_libcall don't require any special\nconversions from the generic type returned by the library. Add an\noverload that calls the library function without doing any nop casts.\n\nRegstrapped on x86_64-linux-gnu, committed to mainline.\n\nRegards,\nIain.\n\n---\ngcc/d/ChangeLog:\n\n\t* d-tree.h (build_libcall): New declaration.\n\t* runtime.cc (build_libcall_1): New function.\n\t(build_libcall): New overload.\n\t* d-codegen.cc (build_assert_call): Call build_libcall without Type\n\targument.\n\t(build_array_bounds_call): Likewise.\n\t(build_bounds_index_condition): Likewise.\n\t(build_bounds_slice_condition): Likewise.\n\t(build_closure): Likewise.\n\t* expr.cc (ExprVisitor::visit): Likewise.\n\t* toir.cc (IRVisitor::visit): Likewise.\n---\n gcc/d/d-codegen.cc | 13 ++++++-------\n gcc/d/d-tree.h     |  1 +\n gcc/d/expr.cc      |  7 +++----\n gcc/d/runtime.cc   | 42 +++++++++++++++++++++++++++++++++++-------\n gcc/d/toir.cc      |  5 ++---\n 5 files changed, 47 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc\nindex b22bdef77ce..791918a1ab5 100644\n--- a/gcc/d/d-codegen.cc\n+++ b/gcc/d/d-codegen.cc\n@@ -1994,9 +1994,9 @@ build_assert_call (const Loc &loc, libcall_fn libcall, tree msg)\n \n \n   if (msg != NULL_TREE)\n-    return build_libcall (libcall, Type::tnoreturn, 3, msg, file, line);\n+    return build_libcall (libcall, 3, msg, file, line);\n   else\n-    return build_libcall (libcall, Type::tnoreturn, 2, file, line);\n+    return build_libcall (libcall, 2, file, line);\n }\n \n /* Builds a CALL_EXPR at location LOC in the source file to execute when an\n@@ -2010,7 +2010,7 @@ build_array_bounds_call (const Loc &loc)\n     return build_call_expr (builtin_decl_explicit (BUILT_IN_TRAP), 0);\n   else\n     {\n-      return build_libcall (LIBCALL_ARRAYBOUNDSP, Type::tnoreturn, 2,\n+      return build_libcall (LIBCALL_ARRAYBOUNDSP, 2,\n \t\t\t    build_filename_from_loc (loc),\n \t\t\t    size_int (loc.linnum ()));\n     }\n@@ -2039,7 +2039,7 @@ build_bounds_index_condition (IndexExp *ie, tree index, tree length)\n     boundserr = build_call_expr (builtin_decl_explicit (BUILT_IN_TRAP), 0);\n   else\n     {\n-      boundserr = build_libcall (LIBCALL_ARRAYBOUNDS_INDEXP, Type::tnoreturn, 4,\n+      boundserr = build_libcall (LIBCALL_ARRAYBOUNDS_INDEXP, 4,\n \t\t\t\t build_filename_from_loc (ie->e2->loc),\n \t\t\t\t size_int (ie->e2->loc.linnum ()),\n \t\t\t\t index, length);\n@@ -2088,8 +2088,7 @@ build_bounds_slice_condition (SliceExp *se, tree lower, tree upper, tree length)\n \t    }\n \t  else\n \t    {\n-\t      boundserr = build_libcall (LIBCALL_ARRAYBOUNDS_SLICEP,\n-\t\t\t\t\t Type::tnoreturn, 5,\n+\t      boundserr = build_libcall (LIBCALL_ARRAYBOUNDS_SLICEP, 5,\n \t\t\t\t\t build_filename_from_loc (se->loc),\n \t\t\t\t\t size_int (se->loc.linnum ()),\n \t\t\t\t\t lower, upper, length);\n@@ -2924,7 +2923,7 @@ build_closure (FuncDeclaration *fd)\n \n       /* Allocate memory for closure.  */\n       tree arg = convert (build_ctype (Type::tsize_t), TYPE_SIZE_UNIT (type));\n-      tree init = build_libcall (LIBCALL_ALLOCMEMORY, Type::tvoidptr, 1, arg);\n+      tree init = build_libcall (LIBCALL_ALLOCMEMORY, 1, arg);\n \n       tree init_exp = build_assign (INIT_EXPR, decl,\n \t\t\t\t    build_nop (TREE_TYPE (decl), init));\ndiff --git a/gcc/d/d-tree.h b/gcc/d/d-tree.h\nindex d4ae94fd693..e6949f37ff2 100644\n--- a/gcc/d/d-tree.h\n+++ b/gcc/d/d-tree.h\n@@ -694,6 +694,7 @@ extern void d_defer_declaration (Declaration *);\n extern void d_finish_compilation (tree *, int);\n \n /* In runtime.cc.  */\n+extern tree build_libcall (libcall_fn, int ...);\n extern tree build_libcall (libcall_fn, Type *, int ...);\n \n /* In typeinfo.cc.  */\ndiff --git a/gcc/d/expr.cc b/gcc/d/expr.cc\nindex 8c068b083e5..75a8b4e726d 100644\n--- a/gcc/d/expr.cc\n+++ b/gcc/d/expr.cc\n@@ -1005,7 +1005,7 @@ public:\n   void visit (ThrowExp *e) final override\n   {\n     tree arg = build_expr_dtor (e->e1);\n-    this->result_ = build_libcall (LIBCALL_THROW, Type::tnoreturn, 1, arg);\n+    this->result_ = build_libcall (LIBCALL_THROW, 1, arg);\n   }\n \n   /* Build a postfix expression.  */\n@@ -1254,7 +1254,7 @@ public:\n \tlibcall_fn libcall = tb1->isClassHandle ()->isInterfaceDeclaration ()\n \t  ? LIBCALL_CALLINTERFACEFINALIZER : LIBCALL_CALLFINALIZER;\n \n-\tthis->result_ = build_libcall (libcall, Type::tvoid, 1, t1);\n+\tthis->result_ = build_libcall (libcall, 1, t1);\n \treturn;\n       }\n     else\n@@ -1764,8 +1764,7 @@ public:\n \t\tif (!cd->isInterfaceDeclaration () && !cd->isCPPclass ())\n \t\t  {\n \t\t    arg = d_save_expr (arg);\n-\t\t    assert_pass = build_libcall (LIBCALL_INVARIANT,\n-\t\t\t\t\t\t Type::tvoid, 1, arg);\n+\t\t    assert_pass = build_libcall (LIBCALL_INVARIANT, 1, arg);\n \t\t  }\n \t      }\n \t    else if (tb1->ty == TY::Tpointer\ndiff --git a/gcc/d/runtime.cc b/gcc/d/runtime.cc\nindex 4fb63f85b5b..5ec59923823 100644\n--- a/gcc/d/runtime.cc\n+++ b/gcc/d/runtime.cc\n@@ -301,24 +301,52 @@ get_libcall (libcall_fn libcall)\n   return libcall_decls[libcall];\n }\n \n-/* Generate a call to LIBCALL, returning the result as TYPE.  NARGS is the\n-   number of call arguments, the expressions of which are provided in `...'.\n+\n+/* Subroutine of build_libcall; generate a call to LIBCALL.  NARGS is the\n+   number of call arguments, the expressions of which are provided in ARGP.\n    This does not perform conversions or promotions on the arguments.  */\n \n-tree\n-build_libcall (libcall_fn libcall, Type *type, int nargs, ...)\n+static tree\n+build_libcall_1 (libcall_fn libcall, int nargs, va_list argp)\n {\n   /* Build the call expression to the runtime function.  */\n   tree decl = get_libcall (libcall);\n   tree *args = XALLOCAVEC (tree, nargs);\n+\n+  for (int i = 0; i < nargs; i++)\n+    args[i] = va_arg (argp, tree);\n+\n+  return build_call_expr_loc_array (input_location, decl, nargs, args);\n+}\n+\n+/* Generate a call to LIBCALL.  NARGS is the number of call arguments, the\n+   expressions of which are provided in `...'.  */\n+\n+tree\n+build_libcall (libcall_fn libcall, int nargs, ...)\n+{\n   va_list ap;\n \n   va_start (ap, nargs);\n-  for (int i = 0; i < nargs; i++)\n-    args[i] = va_arg (ap, tree);\n+\n+  tree result = build_libcall_1 (libcall, nargs, ap);\n   va_end (ap);\n \n-  tree result = build_call_expr_loc_array (input_location, decl, nargs, args);\n+  return result;\n+}\n+\n+/* Generate a call to LIBCALL, returning the result as TYPE.  NARGS is the\n+   number of call arguments, the expressions of which are provided in `...'.  */\n+\n+tree\n+build_libcall (libcall_fn libcall, Type *type, int nargs, ...)\n+{\n+  va_list ap;\n+\n+  va_start (ap, nargs);\n+\n+  tree result = build_libcall_1 (libcall, nargs, ap);\n+  va_end (ap);\n \n   /* Assumes caller knows what it is doing.  */\n   return convert (build_ctype (type), result);\ndiff --git a/gcc/d/toir.cc b/gcc/d/toir.cc\nindex 1ad41cf9368..51f840f3f28 100644\n--- a/gcc/d/toir.cc\n+++ b/gcc/d/toir.cc\n@@ -1241,7 +1241,7 @@ public:\n     else\n       arg = build_nop (build_ctype (get_object_type ()), arg);\n \n-    add_stmt (build_libcall (LIBCALL_THROW, Type::tnoreturn, 1, arg));\n+    add_stmt (build_libcall (LIBCALL_THROW, 1, arg));\n   }\n \n   /* Build a try-catch statement, one of the building blocks for exception\n@@ -1307,8 +1307,7 @@ public:\n \t       the end catch callback.  */\n \t    if (cd->isCPPclass ())\n \t      {\n-\t\ttree endcatch = build_libcall (LIBCALL_CXA_END_CATCH,\n-\t\t\t\t\t       Type::tvoid, 0);\n+\t\ttree endcatch = build_libcall (LIBCALL_CXA_END_CATCH, 0);\n \t\tcatchbody = build2 (TRY_FINALLY_EXPR, void_type_node,\n \t\t\t\t    catchbody, endcatch);\n \t      }\n",
    "prefixes": [
        "committed"
    ]
}