Show a cover letter.

GET /api/covers/818650/?format=api
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 818650,
    "url": "http://patchwork.ozlabs.org/api/covers/818650/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/cover/1506434179-2736-1-git-send-email-dmalcolm@redhat.com/",
    "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": "<1506434179-2736-1-git-send-email-dmalcolm@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-26T13:56:17",
    "name": "[0/2] Re: [PATCH] C/C++: add fix-it hints for various missing symbols",
    "submitter": {
        "id": 24465,
        "url": "http://patchwork.ozlabs.org/api/people/24465/?format=api",
        "name": "David Malcolm",
        "email": "dmalcolm@redhat.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/gcc/cover/1506434179-2736-1-git-send-email-dmalcolm@redhat.com/mbox/",
    "series": [
        {
            "id": 5146,
            "url": "http://patchwork.ozlabs.org/api/series/5146/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=5146",
            "date": "2017-09-26T13:56:17",
            "name": "Re: [PATCH] C/C++: add fix-it hints for various missing symbols",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/5146/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/covers/818650/comments/",
    "headers": {
        "Return-Path": "<gcc-patches-return-462982-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-462982-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=\"qEmHqZ9I\"; dkim-atps=neutral",
            "sourceware.org; auth=none",
            "ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=dmalcolm@redhat.com"
        ],
        "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 3y1jDB5lH9z9sPr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 23:56:25 +1000 (AEST)",
            "(qmail 122940 invoked by alias); 26 Sep 2017 13:56:16 -0000",
            "(qmail 122928 invoked by uid 89); 26 Sep 2017 13:56:15 -0000",
            "from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 26 Sep 2017 13:56:13 +0000",
            "from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.11])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id 3B0F47EA99\tfor\n\t<gcc-patches@gcc.gnu.org>; Tue, 26 Sep 2017 13:56:12 +0000 (UTC)",
            "from c64.redhat.com (ovpn-112-11.phx2.redhat.com [10.3.112.11])\tby\n\tsmtp.corp.redhat.com (Postfix) with ESMTP id 111D16F95E;\n\tTue, 26 Sep 2017 13:56:10 +0000 (UTC)"
        ],
        "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:from\n\t:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=wyjQIi1o8Yr0Ltwa8iy75uFPaemgTVe6vnH6PvDunT/PVQwTaWiT9\n\tZZmRumgCpL6FMKtCJ4g5pxmUUgqV/nQdN8D2zauMqLBWm6peh2gXcGJC7oIw1wLR\n\tytZ67ANiOEsbwTkBAE6nkMNNBH/pp+iuS12tW0WfAHzIWHVR2KqRzs=",
        "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:from\n\t:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-type:content-transfer-encoding; s=default;\n\tbh=teAEf8yJMVohJBHYR3LnKAaoIcs=; b=qEmHqZ9Ib+Y+mF6rNhvU6D00ml+I\n\t3Nvc0YiDwIKx3dyhvs4Ev4HfI23GB6LeEFvs/FlJpk83TjUpeGxjGFls3SWryyFW\n\th/EJkRA9McLXQoXdhDRF2ypb+YQ/pL82kpMgzLxs/uwaDcI73mJkKyG/RwKcwLXy\n\t8wSAdnropHMyELA=",
        "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=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=headache,\n\tUD:m",
        "X-HELO": "mx1.redhat.com",
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 3B0F47EA99",
        "From": "David Malcolm <dmalcolm@redhat.com>",
        "To": "Jeff Law <law@redhat.com>,\tgcc-patches@gcc.gnu.org",
        "Cc": "David Malcolm <dmalcolm@redhat.com>",
        "Subject": "[PATCH 0/2] Re: [PATCH] C/C++: add fix-it hints for various missing\n\tsymbols",
        "Date": "Tue, 26 Sep 2017 09:56:17 -0400",
        "Message-Id": "<1506434179-2736-1-git-send-email-dmalcolm@redhat.com>",
        "In-Reply-To": "<1499107059-28855-1-git-send-email-dmalcolm@redhat.com>",
        "References": "<1499107059-28855-1-git-send-email-dmalcolm@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-IsSubscribed": "yes"
    },
    "content": "On Mon, 2017-08-28 at 09:22 -0600, Jeff Law wrote:\n> On 07/03/2017 12:37 PM, David Malcolm wrote:\n> > This patch improves our C/C++ frontends' handling of missing\n> > symbols, by making c_parser_require and cp_parser_require use\n> > \"better\" locations for the diagnostic, and insert fix-it hints,\n> > under certain circumstances (see the comments in the patch for\n> > full details).\n> > \n> > For example, for this code with a missing semicolon:\n> > \n> >   $ cat test.c\n> >   int missing_semicolon (void)\n> >   {\n> >     return 42\n> >   }\n> > \n> > trunk currently emits:\n> > \n> >   test.c:4:1: error: expected ‘;’ before ‘}’ token\n> >    }\n> >    ^\n> > \n> > This patch adds a fix-it hint for the missing semicolon, and puts\n> > the error at the location of the missing semicolon, printing the\n> > followup token as a secondary location:\n> > \n> >   test.c:3:12: error: expected ‘;’ before ‘}’ token\n> >      return 42\n> >               ^\n> >               ;\n> >    }\n> >    ~\n> > \n> > More examples can be seen in the test cases.\n> > \n> > For reference, clang prints the following:\n> > \n> >   test.c:3:12: error: expected ';' after return statement\n> >     return 42\n> >              ^\n> >              ;\n> > \n> > i.e. describing what syntactic thing came before, which\n> > I think is likely to be more meaningful to the user.\n> > \n> > clang can also print notes about matching opening symbols\n> > e.g. the note here:\n> > \n> >   missing-symbol-2.c:25:22: error: expected ']'\n> >     const char test [42;\n> >                        ^\n> >   missing-symbol-2.c:25:19: note: to match this '['\n> >     const char test [42;\n> >                     ^\n> > which, although somewhat redundant for this example, seems much\n> > more\n> > useful if there's non-trivial nesting of constructs, or more than a\n> > few\n> > lines separating the open/close symbols (e.g. showing a stray\n> > \"namespace {\"\n> > that the user forgot to close).\n> > \n> > I'd like to implement both of these ideas as followups, but in\n> > the meantime, is the fix-it hint patch OK for trunk?\n> > (successfully bootstrapped & regrtested on x86_64-pc-linux-gnu)\n> > \n> > gcc/c-family/ChangeLog:\n> > \t* c-common.c (c_parse_error): Add RICHLOC param, and use it\n> > rather\n> > \tthan implicitly using input_location.\n> > \t(enum missing_token_insertion_kind): New enum.\n> > \t(get_missing_token_insertion_kind): New function.\n> > \t(maybe_suggest_missing_token_insertion): New function.\n> > \t* c-common.h (c_parse_error): Add RICHLOC param.\n> > \t(maybe_suggest_missing_token_insertion): New decl.\n> > \n> > gcc/c/ChangeLog:\n> > \t* c-parser.c (struct c_parser): Add \"previous_token_loc\" field.\n> > \t(c_parser_consume_token): Set parser->previous_token_loc.\n> > \t(c_parser_error): Rename to...\n> > \t(c_parser_error_richloc): ...this, making static, and adding\n> > \t\"richloc\" parameter, passing it to the c_parse_error call,\n> > \trather than calling c_parser_set_source_position_from_token.\n> > \t(c_parser_error): Reintroduce, reimplementing in terms of the\n> > \tabove.\n> > \t(c_parser_require): Add \"type_is_unique\" param.  Use\n> > \tc_parser_error_richloc rather than c_parser_error, calling\n> > \tmaybe_suggest_missing_token_insertion.\n> > \t(c_parser_parms_list_declarator): Override default value of new\n> > \t\"type_is_unique\" param to c_parser_require.\n> > \t(c_parser_asm_statement): Likewise.\n> > \t* c-parser.h (c_parser_require): Add \"type_is_unique\" param,\n> > \tdefaulting to true.\n> > \n> > gcc/cp/ChangeLog:\n> > \t* parser.c (cp_parser_error): Add rich_location to call to\n> > \tc_parse_error.\n> > \t(get_required_cpp_ttype): New function.\n> > \t(cp_parser_required_error): Remove calls to cp_parser_error,\n> > \tinstead setting a non-NULL gmsgid, and handling it if set by\n> > \tcalling c_parse_error, potentially with a fix-it hint.\n> > \n> > gcc/testsuite/ChangeLog:\n> > \t* c-c++-common/cilk-plus/AN/parser_errors.c: Update expected\n> > \toutput to reflect changes to reported locations of missing\n> > \tsymbols.\n> > \t* c-c++-common/cilk-plus/AN/parser_errors2.c: Likewise.\n> > \t* c-c++-common/cilk-plus/AN/parser_errors3.c: Likewise.\n> > \t* c-c++-common/cilk-plus/AN/pr61191.c: Likewise.\n> > \t* c-c++-common/gomp/pr63326.c: Likewise.\n> > \t* c-c++-common/missing-symbol.c: New test case.\n> > \t* g++.dg/cpp1y/digit-sep-neg.C: Update expected output to\n> > reflect\n> > \tchanges to reported locations of missing symbols.\n> > \t* g++.dg/cpp1y/pr65202.C: Likewise.\n> > \t* g++.dg/other/do1.C: Likewise.\n> > \t* g++.dg/missing-symbol-2.C: New test case.\n> > \t* g++.dg/parse/error11.C: Update expected output to reflect\n> > \tchanges to reported locations of missing symbols.\n> > \t* g++.dg/parse/pragma2.C: Likewise.\n> > \t* g++.dg/template/error11.C: Likewise.\n> > \t* gcc.dg/missing-symbol-2.c: New test case.\n> > \t* gcc.dg/missing-symbol-3.c: New test case.\n> > \t* gcc.dg/noncompile/940112-1.c: Update expected output to\n> > reflect\n> > \tchanges to reported locations of missing symbols.\n> > \t* gcc.dg/noncompile/971104-1.c: Likewise.\n> > \t* obj-c++.dg/exceptions-6.mm: Likewise.\n> > \t* obj-c++.dg/pr48187.mm: Likewise.\n> > \t* objc.dg/exceptions-6.m: Likewise.\n> \n> AFAICT, this never got moved forward after the comments from Richard\n> and\n> Joseph.\n\n\nHere's an updated version of the patch, addressing the various issues\nraised.\n\n\n> > +}\n> > +\n> > +/* Given RICHLOC, a location for a diagnostic describing a missing\n> > token\n> > +   of kind TOKEN_TYPE, potentially add a fix-it hint suggesting\n> > the\n> > +   insertion of the token.\n> > +\n> > +   The location of the attemped fix-it hint depends on TOKEN_TYPE:\n> \n> s/attemped/attempted/\n\nFixed.\n\n> > +\n> > +  if (gmsgid)\n> > +    {\n> > +      /* Emulate rest of cp_parser_error.  */\n> > +      cp_token *token = cp_lexer_peek_token (parser->lexer);\n> > +      cp_lexer_set_source_position_from_token (token);\n> > +\n> > +      rich_location richloc (line_table, input_location);\n> \n> So is it worth trying to factor the bits you want to emulate from\n> cp_parser_error so that they're shared?  Or just a comment in\n> cp_parser_error in the hopes that if someone changes it in a\n> meaningful\n> way they'll know to come back here and potentially update this\n> routine?\n\nI ended up factoring out the shared bits into a new subroutine\n(patch 1 of the kit).\n\n> In general though it looks really good.  I think we just want to make\n> a\n> decision whether or not there's some way to avoid a long term\n> maintenance headache noted immediately above.\n> \n> jeff\n> Jeff\n\nThanks.  Here's an updated version of the patch, split out as a \ntwo patch kit.\n\nPatch 1 implements the cleanup of the duplicated code.\nPatch 2 implements the fix-it hints.\n\nAre they OK for trunk?\n\nDave\n\nDavid Malcolm (2):\n  C++: avoid partial duplicate implementation of cp_parser_error\n  C/C++: add fix-it hints for various missing symbols (v2)\n\n gcc/c-family/c-common.c                            | 158 +++++++++++++++\n gcc/c-family/c-common.h                            |   3 +\n gcc/c/c-parser.c                                   |  29 ++-\n gcc/c/c-parser.h                                   |   3 +-\n gcc/cp/parser.c                                    | 214 ++++++++++++++-------\n .../c-c++-common/cilk-plus/AN/parser_errors.c      |   4 +-\n .../c-c++-common/cilk-plus/AN/parser_errors2.c     |   3 +-\n .../c-c++-common/cilk-plus/AN/parser_errors3.c     |   3 +-\n gcc/testsuite/c-c++-common/cilk-plus/AN/pr61191.c  |   3 +-\n gcc/testsuite/c-c++-common/gomp/pr63326.c          |  22 +--\n gcc/testsuite/c-c++-common/missing-close-symbol.c  |   2 +\n gcc/testsuite/c-c++-common/missing-symbol.c        |  35 ++--\n gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C         |   4 +-\n gcc/testsuite/g++.dg/cpp1y/pr65202.C               |   4 +-\n gcc/testsuite/g++.dg/missing-symbol-2.C            |  58 ++++++\n gcc/testsuite/g++.dg/other/do1.C                   |   4 +-\n gcc/testsuite/g++.dg/parse/error11.C               |   2 +-\n gcc/testsuite/g++.dg/parse/pragma2.C               |   4 +-\n gcc/testsuite/g++.dg/template/error11.C            |   2 +-\n gcc/testsuite/gcc.dg/missing-symbol-2.c            |  71 +++++++\n gcc/testsuite/gcc.dg/missing-symbol-3.c            |  50 +++++\n gcc/testsuite/gcc.dg/noncompile/940112-1.c         |   4 +-\n gcc/testsuite/gcc.dg/noncompile/971104-1.c         |   4 +-\n gcc/testsuite/obj-c++.dg/exceptions-6.mm           |   6 +-\n gcc/testsuite/obj-c++.dg/pr48187.mm                |   8 +-\n gcc/testsuite/objc.dg/exceptions-6.m               |   4 +-\n 26 files changed, 574 insertions(+), 130 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/missing-symbol-2.C\n create mode 100644 gcc/testsuite/gcc.dg/missing-symbol-2.c\n create mode 100644 gcc/testsuite/gcc.dg/missing-symbol-3.c"
}