Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2218001/?format=api
{ "id": 2218001, "url": "http://patchwork.ozlabs.org/api/patches/2218001/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/acuK3cyeqPOUN0o6@tucnak/", "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": "<acuK3cyeqPOUN0o6@tucnak>", "list_archive_url": null, "date": "2026-03-31T08:50:37", "name": "c++: Use anon enums in eval_data_member_spec", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d57c1b89327d61825476f47ab3328553404db196", "submitter": { "id": 671, "url": "http://patchwork.ozlabs.org/api/people/671/?format=api", "name": "Jakub Jelinek", "email": "jakub@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/acuK3cyeqPOUN0o6@tucnak/mbox/", "series": [ { "id": 498148, "url": "http://patchwork.ozlabs.org/api/series/498148/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498148", "date": "2026-03-31T08:50:37", "name": "c++: Use anon enums in eval_data_member_spec", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498148/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2218001/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2218001/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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=guj1PVOe;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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 (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=guj1PVOe", "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com", "sourceware.org; spf=pass smtp.mailfrom=redhat.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 4flML03N17z1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 19:51:35 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 4E50A4BB58EF\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 08:51:33 +0000 (GMT)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 17A174B92099\n for <gcc-patches@gcc.gnu.org>; Tue, 31 Mar 2026 08:50:44 +0000 (GMT)", "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-hf2R0023Nhy3O2ZEKpOwkg-1; Tue,\n 31 Mar 2026 04:50:42 -0400", "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 7F3C31800359\n for <gcc-patches@gcc.gnu.org>; Tue, 31 Mar 2026 08:50:41 +0000 (UTC)", "from tucnak.zalov.cz (unknown [10.44.32.9])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id B432C19540C4; Tue, 31 Mar 2026 08:50:40 +0000 (UTC)", "from tucnak.zalov.cz (localhost [127.0.0.1])\n by tucnak.zalov.cz (8.18.1/8.18.1) with ESMTPS id 62V8obNW4083563\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Tue, 31 Mar 2026 10:50:37 +0200", "(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 62V8obmP4083562;\n Tue, 31 Mar 2026 10:50:37 +0200" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 4E50A4BB58EF", "OpenDKIM Filter v2.11.0 sourceware.org 17A174B92099" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 17A174B92099", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 17A174B92099", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774947044; cv=none;\n b=uomMNrgtHlAjfvx6r+1LPDll/HfpoH7qFqkmNGgBqo2xxOds7d5m8gn2pksqUjClgM4ODK0/zuJdmvCDt9/z5MtdW7Cm1SdBDFA0NtyzLs8VBFYGNZy943+iDru19/d6Vk6beJKOh7xa6PZxUmL+bp5OJ0wDBlEYcdsFWNpys/4=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774947044; c=relaxed/simple;\n bh=en+ittnRehZ6MDFIvn/cvbnRUNcRDfIOqkdQFoaGHt0=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=MYg95VtsnTvLlEQHi58vq5ArPXv67w45yH8/CCBPc5TpF4Z3iPcxvXjjEnPuU/StyVt53RHIC2fo00gKXwtq/Q3hXN0b7iWAaD8giG++GDgdsiFpd/XbstKxSa9cQqpYF0i8RG4VvCHMTpz0NC65JYujKSNnMKAtyyo9uFaY8uo=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1774947043;\n h=from:from:reply-to:reply-to:subject:subject:date:date:\n message-id:message-id:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type:in-reply-to:in-reply-to: references:references;\n bh=J546f/0BVRIHwIewFhw3Ufd4+WhfWTKAdTcjs+FXDB4=;\n b=guj1PVOe6PFW9zKG83BUSUYTzy4vJ339OVrYJpF4vcSd2cwJYCGgvcu2mW0EGnJHSstBE5\n PWOhZBHljYxfzs9KQjKOXw1BWF016VPqvnEYoIa0EcfqlQYE6Q2g+SH+Y0ABJ6viRqSWup\n SGlc0Y8gcxy0BYJ6HKwzC5vShMN1SbU=", "X-MC-Unique": "hf2R0023Nhy3O2ZEKpOwkg-1", "X-Mimecast-MFC-AGG-ID": "hf2R0023Nhy3O2ZEKpOwkg_1774947041", "Date": "Tue, 31 Mar 2026 10:50:37 +0200", "From": "Jakub Jelinek <jakub@redhat.com>", "To": "Jason Merrill <jason@redhat.com>, Marek Polacek <polacek@redhat.com>", "Cc": "gcc-patches@gcc.gnu.org", "Subject": "[PATCH] c++: Use anon enums in eval_data_member_spec", "Message-ID": "<acuK3cyeqPOUN0o6@tucnak>", "References": "<acpn1XntsMs040St@tucnak>\n <cb8f2c23-8d6c-4d9f-adef-efe866244afc@redhat.com>", "MIME-Version": "1.0", "In-Reply-To": "<cb8f2c23-8d6c-4d9f-adef-efe866244afc@redhat.com>", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "899DTMeD3twS9GvHbDz-Jm5SGkA_TTiDpA8CDUJLjiI_1774947041", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "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>", "Reply-To": "Jakub Jelinek <jakub@redhat.com>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "On Mon, Mar 30, 2026 at 03:46:57PM -0400, Jason Merrill wrote:\n> OK.\n\nCommitted, thanks.\n\n> Maybe it would be helpful to have local enums to name the indices in args?\n\nHere is incremental patch to use local enums for those.\nTested on x86_64-linux, ok for trunk (it conflicts with the annotations\naddition patch, but it can be easily resolved)?\n\n2026-03-31 Jakub Jelinek <jakub@redhat.com>\n\n\t* reflect.cc (eval_data_member_spec): Add anonymous enums for\n\tfields in std::meta::data_member_options and\n\tstd::meta::data_member_options::_Name and use them instead of\n\thardcoded constants.\n\n\n\n\tJakub", "diff": "--- gcc/cp/reflect.cc.jj\t2026-03-31 10:16:11.815877798 +0200\n+++ gcc/cp/reflect.cc\t2026-03-31 10:40:15.047115597 +0200\n@@ -5566,27 +5566,28 @@ eval_data_member_spec (location_t loc, c\n *non_constant_p = true;\n return NULL_TREE;\n }\n- tree args[5] = { type, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE };\n+ enum { m_name = 1, m_alignment, m_bit_width, m_no_unique_address, n_args };\n+ tree args[n_args] = { type, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE };\n for (tree field = next_aggregate_field (TYPE_FIELDS (TREE_TYPE (opts)));\n field; field = next_aggregate_field (DECL_CHAIN (field)))\n if (tree name = DECL_NAME (field))\n {\n \tif (id_equal (name, \"name\"))\n-\t args[1] = field;\n+\t args[m_name] = field;\n \telse if (id_equal (name, \"alignment\"))\n-\t args[2] = field;\n+\t args[m_alignment] = field;\n \telse if (id_equal (name, \"bit_width\"))\n-\t args[3] = field;\n+\t args[m_bit_width] = field;\n \telse if (id_equal (name, \"no_unique_address\"))\n-\t args[4] = field;\n+\t args[m_no_unique_address] = field;\n }\n- for (int i = 1; i < 5; ++i)\n+ for (int i = m_name; i < n_args; ++i)\n {\n if (args[i] == NULL_TREE)\n \tgoto fail;\n tree opt = build3 (COMPONENT_REF, TREE_TYPE (args[i]), opts, args[i],\n \t\t\t NULL_TREE);\n- if (i == 4)\n+ if (i == m_no_unique_address)\n \t{\n \t /* The no_unique_address handling is simple. */\n \t if (TREE_CODE (TREE_TYPE (opt)) != BOOLEAN_TYPE)\n@@ -5628,7 +5629,7 @@ eval_data_member_spec (location_t loc, c\n \t\t\t\t NULL_TREE, tf_warning_or_error);\n if (error_operand_p (deref))\n \tgoto fail;\n- if (i != 1)\n+ if (i != m_name)\n \t{\n \t /* For alignment and bit_width otherwise it should be int. */\n \t if (TYPE_MAIN_VARIANT (TREE_TYPE (deref)) != integer_type_node)\n@@ -5646,27 +5647,29 @@ eval_data_member_spec (location_t loc, c\n /* Otherwise it is a name. */\n if (!CLASS_TYPE_P (TREE_TYPE (deref)))\n \tgoto fail;\n- tree fields[3] = { NULL_TREE, NULL_TREE, NULL_TREE };\n+ enum { m_is_u8, m_u8s, m_s, n_fields };\n+ tree fields[n_fields] = { NULL_TREE, NULL_TREE, NULL_TREE };\n for (tree field = next_aggregate_field (TYPE_FIELDS (TREE_TYPE (deref)));\n \t field; field = next_aggregate_field (DECL_CHAIN (field)))\n \tif (tree name = DECL_NAME (field))\n \t {\n \t if (id_equal (name, \"_M_is_u8\"))\n-\t fields[0] = field;\n+\t fields[m_is_u8] = field;\n \t else if (id_equal (name, \"_M_u8s\"))\n-\t fields[1] = field;\n+\t fields[m_u8s] = field;\n \t else if (id_equal (name, \"_M_s\"))\n-\t fields[2] = field;\n+\t fields[m_s] = field;\n \t }\n- for (int j = 0; j < 3; ++j)\n+ for (int j = 0; j < n_fields; ++j)\n \t{\n \t if (fields[j] == NULL_TREE)\n \t goto fail;\n-\t if (j && j == (fields[0] == boolean_true_node ? 2 : 1))\n+\t if (j != m_is_u8\n+\t && j == (fields[m_is_u8] == boolean_true_node ? m_s : m_u8s))\n \t continue;\n \t tree f = build3 (COMPONENT_REF, TREE_TYPE (fields[j]), deref,\n \t\t\t fields[j], NULL_TREE);\n-\t if (j == 0)\n+\t if (j == m_is_u8)\n \t {\n \t /* The _M_is_u8 handling is simple. */\n \t if (TREE_CODE (TREE_TYPE (f)) != BOOLEAN_TYPE)\n@@ -5679,9 +5682,9 @@ eval_data_member_spec (location_t loc, c\n \t if (TREE_CODE (f) != INTEGER_CST)\n \t\tgoto fail;\n \t if (integer_zerop (f))\n-\t\tfields[0] = boolean_false_node;\n+\t\tfields[m_is_u8] = boolean_false_node;\n \t else\n-\t\tfields[0] = boolean_true_node;\n+\t\tfields[m_is_u8] = boolean_true_node;\n \t continue;\n \t }\n \t /* _M_u8s/_M_s handling is the same except for encoding. */\n@@ -5713,7 +5716,7 @@ eval_data_member_spec (location_t loc, c\n \t || TREE_CODE (TREE_TYPE (f)) != ARRAY_TYPE)\n \t goto fail;\n \t tree eltt = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (f)));\n-\t if (eltt != (j == 1 ? char8_type_node : char_type_node))\n+\t if (eltt != (j == m_u8s ? char8_type_node : char_type_node))\n \t goto fail;\n \t tree field, value;\n \t unsigned k;\n@@ -5794,12 +5797,12 @@ eval_data_member_spec (location_t loc, c\n \t istr.len = strlen (namep) + 1;\n \t istr.text = (const unsigned char *) namep;\n \t if (!cpp_translate_string (parse_in, &istr, &ostr,\n-\t\t\t\t j == 2 ? CPP_STRING : CPP_UTF8STRING,\n+\t\t\t\t j == m_s ? CPP_STRING : CPP_UTF8STRING,\n \t\t\t\t true))\n \t {\n \t if (len >= 64)\n \t\tXDELETEVEC (namep);\n-\t if (j == 2)\n+\t if (j == m_s)\n \t\treturn throw_exception (loc, ctx,\n \t\t\t\t\t\"conversion from ordinary literal \"\n \t\t\t\t\t\"encoding to source charset \"\n@@ -5831,53 +5834,53 @@ eval_data_member_spec (location_t loc, c\n \t }\n \t}\n }\n- if (args[1] == NULL_TREE && args[3] == NULL_TREE)\n+ if (args[m_name] == NULL_TREE && args[m_bit_width] == NULL_TREE)\n return throw_exception (loc, ctx,\n \t\t\t \"neither name nor bit_width specified\",\n \t\t\t fun, non_constant_p, jump_target);\n- if (args[3])\n+ if (args[m_bit_width])\n {\n if (!CP_INTEGRAL_TYPE_P (type) && TREE_CODE (type) != ENUMERAL_TYPE)\n \treturn throw_exception (loc, ctx,\n \t\t\t\t\"bit_width specified with non-integral \"\n \t\t\t\t\"and non-enumeration type\",\n \t\t\t\tfun, non_constant_p, jump_target);\n- if (args[2])\n+ if (args[m_alignment])\n \treturn throw_exception (loc, ctx,\n \t\t\t\t\"both alignment and bit_width specified\",\n \t\t\t\tfun, non_constant_p, jump_target);\n- if (args[4] == boolean_true_node)\n+ if (args[m_no_unique_address] == boolean_true_node)\n \treturn throw_exception (loc, ctx,\n \t\t\t\t\"bit_width specified with \"\n \t\t\t\t\"no_unique_address true\",\n \t\t\t\tfun, non_constant_p, jump_target);\n- if (integer_zerop (args[3]) && args[1])\n+ if (integer_zerop (args[m_bit_width]) && args[m_name])\n \treturn throw_exception (loc, ctx,\n \t\t\t\t\"bit_width 0 with specified name\",\n \t\t\t\tfun, non_constant_p, jump_target);\n- if (tree_int_cst_sgn (args[3]) < 0)\n+ if (tree_int_cst_sgn (args[m_bit_width]) < 0)\n \treturn throw_exception (loc, ctx, \"bit_width is negative\",\n \t\t\t\tfun, non_constant_p, jump_target);\n }\n- if (args[2])\n+ if (args[m_alignment])\n {\n- if (!integer_pow2p (args[2]))\n+ if (!integer_pow2p (args[m_alignment]))\n \treturn throw_exception (loc, ctx,\n \t\t\t\t\"alignment is not power of two\",\n \t\t\t\tfun, non_constant_p, jump_target);\n- if (tree_int_cst_sgn (args[2]) < 0)\n+ if (tree_int_cst_sgn (args[m_alignment]) < 0)\n \treturn throw_exception (loc, ctx, \"alignment is negative\",\n \t\t\t\tfun, non_constant_p, jump_target);\n tree al = cxx_sizeof_or_alignof_type (loc, type, ALIGNOF_EXPR, true,\n \t\t\t\t\t tf_none);\n if (TREE_CODE (al) == INTEGER_CST\n-\t && wi::to_widest (al) > wi::to_widest (args[2]))\n+\t && wi::to_widest (al) > wi::to_widest (args[m_alignment]))\n \treturn throw_exception (loc, ctx,\n \t\t\t\t\"alignment is smaller than alignment_of\",\n \t\t\t\tfun, non_constant_p, jump_target);\n }\n- tree ret = make_tree_vec (5);\n- for (int i = 0; i < 5; ++i)\n+ tree ret = make_tree_vec (n_args);\n+ for (int i = 0; i < n_args; ++i)\n TREE_VEC_ELT (ret, i) = args[i];\n return get_reflection_raw (loc, ret, REFLECT_DATA_MEMBER_SPEC);\n }\n", "prefixes": [] }