Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/812874/?format=api
{ "id": 812874, "url": "http://patchwork.ozlabs.org/api/patches/812874/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/ec80ea8d-5348-9fed-3cfc-3e9500666cfb@acm.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": "<ec80ea8d-5348-9fed-3cfc-3e9500666cfb@acm.org>", "list_archive_url": null, "date": "2017-09-12T14:28:20", "name": "move sorted field handling to C FE", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "17cb9cdc0201c135a79ab565d5e2e2f6847780db", "submitter": { "id": 9970, "url": "http://patchwork.ozlabs.org/api/people/9970/?format=api", "name": "Nathan Sidwell", "email": "nathan@acm.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/ec80ea8d-5348-9fed-3cfc-3e9500666cfb@acm.org/mbox/", "series": [ { "id": 2717, "url": "http://patchwork.ozlabs.org/api/series/2717/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=2717", "date": "2017-09-12T14:28:20", "name": "move sorted field handling to C FE", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2717/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/812874/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/812874/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-461931-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461931-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"X6FKcMkf\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xs6bl1HY9z9sNV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 00:28:34 +1000 (AEST)", "(qmail 56128 invoked by alias); 12 Sep 2017 14:28:27 -0000", "(qmail 56116 invoked by uid 89); 12 Sep 2017 14:28:26 -0000", "from mail-yw0-f176.google.com (HELO mail-yw0-f176.google.com)\n\t(209.85.161.176) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 12 Sep 2017 14:28:24 +0000", "by mail-yw0-f176.google.com with SMTP id v72so26465891ywa.3 for\n\t<gcc-patches@gcc.gnu.org>; Tue, 12 Sep 2017 07:28:24 -0700 (PDT)", "from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254?\n\t([2620:10d:c091:200::a68b]) by smtp.googlemail.com with\n\tESMTPSA id k189sm3990956ywc.18.2017.09.12.07.28.22\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256\n\tbits=128/128); Tue, 12 Sep 2017 07:28:22 -0700 (PDT)" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:to:cc\n\t:from:subject:message-id:date:mime-version:content-type; q=dns;\n\ts=default; b=L9/QKa/5JZ70jV/T/8Q2LaQq//LCeCG6dgdQTZ1ttHOqbkK8CV\n\t6Di51BLGAxOvqkM4VeJOV0xOIKdVq7WQ9Scma5vij5O4eoXT/S/kk8p3GyNd1YQB\n\tQzC/0HoSVPCAfEd4TZyayXJORisrGnJvEufm9KL/id0/y7T7L+zFl4EmE=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:to:cc\n\t:from:subject:message-id:date:mime-version:content-type; s=\n\tdefault; bh=6FGG7Ctb+qbWopxz2AwN6frrimA=; b=X6FKcMkf8Kh/FfyihCM+\n\tzh38fltUUp/3lQbNYoimSj5L6opj/h3dv1BVIV+QkmQVeaGszJ4PLMnSuxwq+Nqb\n\t5a+YoE65nvpnCtnk+Yot35DcBhLTh2WlaADjRG863YQycuJUIUAjM5/Z5VWfun9b\n\tndwBeswxKB12kFeBjuyJI2s=", "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>", "Sender": "gcc-patches-owner@gcc.gnu.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-10.6 required=5.0 tests=BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=", "X-HELO": "mail-yw0-f176.google.com", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:sender:to:cc:from:subject:message-id:date\n\t:user-agent:mime-version:content-language;\n\tbh=uwlcHi0MLT084GVTMKGga4BFIRXTvbV98GpyU51Zu9k=;\n\tb=iNFv5f8J89BZj3QZ+XvIvni6hiX6vvJwGdHW+hBWphpJzZcJyveRBo40ZDr9W1qNxO\n\tWAsFD+EYEQJRetGkWBhBp0JhJPisIuLzWmNR1t6XkVxR3r9unugXzUVBHT3EvGDf4wAb\n\tfYnmywlInoyO8VWRcIDNqzrciHa1ziDGOd+cGRGngXZK2/tzuKY0y6Lg64oODae2kZv6\n\tvIlPtsyHwowFsmPoyT7FmwyxAzHP1LU3IX9DYvqdRcw/4Utcn3AywBSWrrtdoPSpwO67\n\tx4e7HbCR4IFIIIdL/QtLh5rVOg+88iwYI7GY7TBAlEIePniR9ZzkKwu9Fv0Y2MxY7YhG\n\teiow==", "X-Gm-Message-State": "AHPjjUjdzgm7HRw1oxgsW02kcAyFElSFJDFDdtWXSGyamwjDTyxxbupv\tN6NePn2HJrrwoK7b", "X-Google-Smtp-Source": "ADKCNb7rid/EPxUoQnIZQ7O2dsImSLMdc/uXZ5aQWJszo3XV2CVGW/K5+uTAmqpZDzP+wWjtnyk3lA==", "X-Received": "by 10.13.234.9 with SMTP id t9mr12611364ywe.80.1505226503044;\n\tTue, 12 Sep 2017 07:28:23 -0700 (PDT)", "To": "GCC Patches <gcc-patches@gcc.gnu.org>", "Cc": "Joseph Myers <joseph@codesourcery.com>", "From": "Nathan Sidwell <nathan@acm.org>", "Subject": "[PATCH] move sorted field handling to C FE", "Message-ID": "<ec80ea8d-5348-9fed-3cfc-3e9500666cfb@acm.org>", "Date": "Tue, 12 Sep 2017 10:28:20 -0400", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.2.1", "MIME-Version": "1.0", "Content-Type": "multipart/mixed;\n\tboundary=\"------------070F70117864DED8EF432316\"" }, "content": "Now that I've excised sorted fields from the C++ FE (as a distinct \nconcept), we can move some helper functions from c-family/ to c/\n\nthis patch does exactly that. Applied to trunk.\n\n\nnathan", "diff": "2017-09-12 Nathan Sidwell <nathan@acm.org>\n\n\tc-family/\n\t* c-common.c (field_decl_cmp, resort_data, resort_field_decl_cmp,\n\tresort_sorted_fields): Move to c/c-decl.c.\n\t* c-common.h (field_decl_cmp, resort_sorted_fields): Delete.\n\t(struct sorted_fields_type): Move to c/c-lang.h.\n\n\tc/\n\t* c-decl.c (field_decl_cmp, resort_data, resort_field_decl_cmp,\n\tresort_sorted_fields): Moved from c-family/c-common.c.\n\t* c-lang.h (struct sorted_fields_type): Moved from c-family/c-common.h.\n\nIndex: c/c-decl.c\n===================================================================\n--- c/c-decl.c\t(revision 252007)\n+++ c/c-decl.c\t(working copy)\n@@ -7840,6 +7840,26 @@ warn_cxx_compat_finish_struct (tree fiel\n b->in_struct = 0;\n }\n \n+/* Function to help qsort sort FIELD_DECLs by name order. */\n+\n+static int\n+field_decl_cmp (const void *x_p, const void *y_p)\n+{\n+ const tree *const x = (const tree *) x_p;\n+ const tree *const y = (const tree *) y_p;\n+\n+ if (DECL_NAME (*x) == DECL_NAME (*y))\n+ /* A nontype is \"greater\" than a type. */\n+ return (TREE_CODE (*y) == TYPE_DECL) - (TREE_CODE (*x) == TYPE_DECL);\n+ if (DECL_NAME (*x) == NULL_TREE)\n+ return -1;\n+ if (DECL_NAME (*y) == NULL_TREE)\n+ return 1;\n+ if (DECL_NAME (*x) < DECL_NAME (*y))\n+ return -1;\n+ return 1;\n+}\n+\n /* Fill in the fields of a RECORD_TYPE or UNION_TYPE node, T.\n LOC is the location of the RECORD_TYPE or UNION_TYPE's definition.\n FIELDLIST is a chain of FIELD_DECL nodes for the fields.\n@@ -8165,6 +8185,53 @@ finish_struct (location_t loc, tree t, t\n return t;\n }\n \n+static struct {\n+ gt_pointer_operator new_value;\n+ void *cookie;\n+} resort_data;\n+\n+/* This routine compares two fields like field_decl_cmp but using the\n+pointer operator in resort_data. */\n+\n+static int\n+resort_field_decl_cmp (const void *x_p, const void *y_p)\n+{\n+ const tree *const x = (const tree *) x_p;\n+ const tree *const y = (const tree *) y_p;\n+\n+ if (DECL_NAME (*x) == DECL_NAME (*y))\n+ /* A nontype is \"greater\" than a type. */\n+ return (TREE_CODE (*y) == TYPE_DECL) - (TREE_CODE (*x) == TYPE_DECL);\n+ if (DECL_NAME (*x) == NULL_TREE)\n+ return -1;\n+ if (DECL_NAME (*y) == NULL_TREE)\n+ return 1;\n+ {\n+ tree d1 = DECL_NAME (*x);\n+ tree d2 = DECL_NAME (*y);\n+ resort_data.new_value (&d1, resort_data.cookie);\n+ resort_data.new_value (&d2, resort_data.cookie);\n+ if (d1 < d2)\n+ return -1;\n+ }\n+ return 1;\n+}\n+\n+/* Resort DECL_SORTED_FIELDS because pointers have been reordered. */\n+\n+void\n+resort_sorted_fields (void *obj,\n+\t\t void * ARG_UNUSED (orig_obj),\n+\t\t gt_pointer_operator new_value,\n+\t\t void *cookie)\n+{\n+ struct sorted_fields_type *sf = (struct sorted_fields_type *) obj;\n+ resort_data.new_value = new_value;\n+ resort_data.cookie = cookie;\n+ qsort (&sf->elts[0], sf->len, sizeof (tree),\n+\t resort_field_decl_cmp);\n+}\n+\n /* Lay out the type T, and its element type, and so on. */\n \n static void\nIndex: c/c-lang.h\n===================================================================\n--- c/c-lang.h\t(revision 252007)\n+++ c/c-lang.h\t(working copy)\n@@ -22,6 +22,13 @@ along with GCC; see the file COPYING3.\n \n #include \"c-family/c-common.h\"\n \n+/* In a RECORD_TYPE, a sorted array of the fields of the type, not a\n+ tree for size reasons. */\n+struct GTY(()) sorted_fields_type {\n+ int len;\n+ tree GTY((length (\"%h.len\"))) elts[1];\n+};\n+\n struct GTY(()) lang_type {\n /* In a RECORD_TYPE, a sorted array of the fields of the type. */\n struct sorted_fields_type * GTY ((reorder (\"resort_sorted_fields\"))) s;\nIndex: c-family/c-common.c\n===================================================================\n--- c-family/c-common.c\t(revision 252007)\n+++ c-family/c-common.c\t(working copy)\n@@ -309,7 +309,6 @@ static bool check_case_bounds (location_\n \n static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT);\n static bool nonnull_check_p (tree, unsigned HOST_WIDE_INT);\n-static int resort_field_decl_cmp (const void *, const void *);\n \n /* Reserved words. The third field is a mask: keywords are disabled\n if they match the mask.\n@@ -5871,73 +5870,6 @@ check_builtin_function_arguments (locati\n }\n }\n \n-/* Function to help qsort sort FIELD_DECLs by name order. */\n-\n-int\n-field_decl_cmp (const void *x_p, const void *y_p)\n-{\n- const tree *const x = (const tree *) x_p;\n- const tree *const y = (const tree *) y_p;\n-\n- if (DECL_NAME (*x) == DECL_NAME (*y))\n- /* A nontype is \"greater\" than a type. */\n- return (TREE_CODE (*y) == TYPE_DECL) - (TREE_CODE (*x) == TYPE_DECL);\n- if (DECL_NAME (*x) == NULL_TREE)\n- return -1;\n- if (DECL_NAME (*y) == NULL_TREE)\n- return 1;\n- if (DECL_NAME (*x) < DECL_NAME (*y))\n- return -1;\n- return 1;\n-}\n-\n-static struct {\n- gt_pointer_operator new_value;\n- void *cookie;\n-} resort_data;\n-\n-/* This routine compares two fields like field_decl_cmp but using the\n-pointer operator in resort_data. */\n-\n-static int\n-resort_field_decl_cmp (const void *x_p, const void *y_p)\n-{\n- const tree *const x = (const tree *) x_p;\n- const tree *const y = (const tree *) y_p;\n-\n- if (DECL_NAME (*x) == DECL_NAME (*y))\n- /* A nontype is \"greater\" than a type. */\n- return (TREE_CODE (*y) == TYPE_DECL) - (TREE_CODE (*x) == TYPE_DECL);\n- if (DECL_NAME (*x) == NULL_TREE)\n- return -1;\n- if (DECL_NAME (*y) == NULL_TREE)\n- return 1;\n- {\n- tree d1 = DECL_NAME (*x);\n- tree d2 = DECL_NAME (*y);\n- resort_data.new_value (&d1, resort_data.cookie);\n- resort_data.new_value (&d2, resort_data.cookie);\n- if (d1 < d2)\n- return -1;\n- }\n- return 1;\n-}\n-\n-/* Resort DECL_SORTED_FIELDS because pointers have been reordered. */\n-\n-void\n-resort_sorted_fields (void *obj,\n-\t\t void * ARG_UNUSED (orig_obj),\n-\t\t gt_pointer_operator new_value,\n-\t\t void *cookie)\n-{\n- struct sorted_fields_type *sf = (struct sorted_fields_type *) obj;\n- resort_data.new_value = new_value;\n- resort_data.cookie = cookie;\n- qsort (&sf->elts[0], sf->len, sizeof (tree),\n-\t resort_field_decl_cmp);\n-}\n-\n /* Subroutine of c_parse_error.\n Return the result of concatenating LHS and RHS. RHS is really\n a string literal, its first character is indicated by RHS_START and\nIndex: c-family/c-common.h\n===================================================================\n--- c-family/c-common.h\t(revision 252007)\n+++ c-family/c-common.h\t(working copy)\n@@ -493,13 +493,6 @@ extern const unsigned int num_c_common_r\n \n extern GTY(()) tree c_global_trees[CTI_MAX];\n \n-/* In a RECORD_TYPE, a sorted array of the fields of the type, not a\n- tree for size reasons. */\n-struct GTY(()) sorted_fields_type {\n- int len;\n- tree GTY((length (\"%h.len\"))) elts[1];\n-};\n-\n /* Mark which labels are explicitly declared.\n These may be shadowed, and may be referenced from nested functions. */\n #define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)\n@@ -597,9 +590,6 @@ extern tree build_array_notation_expr (l\n extern tree build_array_notation_ref (location_t, tree, tree, tree, tree, tree);\n extern tree build_indirect_ref (location_t, tree, ref_operator);\n \n-extern int field_decl_cmp (const void *, const void *);\n-extern void resort_sorted_fields (void *, void *, gt_pointer_operator,\n-\t\t\t\t void *);\n extern bool has_c_linkage (const_tree decl);\n extern bool c_decl_implicit (const_tree);\n \f\n", "prefixes": [] }