Message ID | 20231102131933.2161191-1-dmalcolm@redhat.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp347930vqu; Thu, 2 Nov 2023 06:20:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0F1xEXUtxvuy1peuAwxgxl94HflsT5h9avhrBeQpxcDXc5V33NYXLq4QV1XXTX18+L206 X-Received: by 2002:ac8:7d04:0:b0:41e:2aab:8dc with SMTP id g4-20020ac87d04000000b0041e2aab08dcmr21101502qtb.37.1698931214970; Thu, 02 Nov 2023 06:20:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698931214; cv=pass; d=google.com; s=arc-20160816; b=AJNC5VdYtfkuTne1QqCHu/h2AnbY4QjMVV9Rp37aAIgSLgJ/8hj7TkTjkHwqpxLQ8L Uc83xhTcxaVRrkXkgDJXWGHlwp2Tk4gEN0Ee2Igti9kS1oHNfCru99h3vy5V5v8jLoMx Fae8oVTzV7fHQEVUKdOsAXrRsHz1fomJ6T8OI2ycTuS76uzqhfGy78OmOjDH8X4RcfTl FlXwFt2bTVwXTUz160Wp8j3c6JDHLsULrXmT7nrlylxw6Izex78V1uTF8647FkrkOCVS o8AXjQxdBOJgXtKqye2ydzW+lExipHzOIUB3ZyPpAEXvpqb/6ja9v44bTkTHQyhyJaoa Eewg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=kkOznWmOp1ijTi3J2JY1fxiF+Z1hQSqkuzm9oqSekSU=; fh=NXemEfxTRbZtBxUkxR2ehQUaYlcDfMdzPkO8MChVQE4=; b=izPWerHJfFKPJYiT7B+6e9GxLMLMkCcWg4mzhik07FY602lIEOTCTDzgywaVa8PLUm 2Bq8lCq7XShJxh4cSUaipDCWCb87TClT4wbIkjq7VidOZS0PpN3EKKXk0vr5iQUQApko OOpxV/HtWRwci0XLaUtD3W7iL+3FDDmiOVSyaq/ZUrc8qmoYYSdOrML/xNqgQel8tDIL sFx1zg42GFVnjaVK+TJ1g65MqQzVM2WRIeMvp620ydXhRuMwT8xdgouECqkD3GtGItYj x0IJMY1wzW39EuEF3CChVdHFsX7EKVSVVh1Iuj9fUGM6GZbUTn6HjLoePgcl6Vhvkoit X04Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DmDmbx4F; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t17-20020a05622a149100b00418194af9ecsi4499422qtx.51.2023.11.02.06.20.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 06:20:14 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DmDmbx4F; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B8A48385782B for <ouuuleilei@gmail.com>; Thu, 2 Nov 2023 13:20:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D40863858D32 for <gcc-patches@gcc.gnu.org>; Thu, 2 Nov 2023 13:19:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D40863858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D40863858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698931189; cv=none; b=LUZNPcmnJotWuMoxHuKVmo+OLNbSzA5y1TDhh0F/jUsXhoZaXFOKb6bFUVE1Kkk/XMe3NaqcBrrFREHn8qQVFAf/5IFUn5BZct2BlCe22jsdjimpkY9vuNsyq4zgPluhYW5NWee8U1tN2w7EkkaC+i8T4OpMmoKIfBhxJQWx8Wo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698931189; c=relaxed/simple; bh=Ivnlan9Ehy9xThDLJp5pl9SDQaETgWotU2CWWxNmSfk=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=E9Z+YZzQyjHtN/AyFKkgay9QKA1saxqU0VFGiRUNf/xvW4pLuiAx1Jt7v2wXvqPAbE3bvtmmtfMtBcwgQX2ua9+lEsZdUUbKmJq+nM//aMq8sbSrXd8FX6KlodbJngmWYQ0qsDxrjBdwc771uUbAOurYFz5HjLI+GJ6lUKRhfIE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698931178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kkOznWmOp1ijTi3J2JY1fxiF+Z1hQSqkuzm9oqSekSU=; b=DmDmbx4F7zRWRJYajIaT7t6IgWTRuzaaBjsJOLvUiEk08tCxa1RTx4w/Awu/LqPZHq2V4g iQVIXpIK3VbsuwD3MwSukSOI+/8Hp6VGNTxBJwhW+R8F4qZddfdTjeFEQbCa5JNBDgn49Z 3fF5jeg81XIuCPJCnfup/enoaNxEaTQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-UqgC39KcOTi57_XvLTGTMA-1; Thu, 02 Nov 2023 09:19:36 -0400 X-MC-Unique: UqgC39KcOTi57_XvLTGTMA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78B4E88CDC0 for <gcc-patches@gcc.gnu.org>; Thu, 2 Nov 2023 13:19:36 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.8.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 514061C060BA; Thu, 2 Nov 2023 13:19:36 +0000 (UTC) From: David Malcolm <dmalcolm@redhat.com> To: gcc-patches@gcc.gnu.org Cc: David Malcolm <dmalcolm@redhat.com> Subject: [PATCH/RFC 0/4] C/C++/diagnostics: various UX improvements Date: Thu, 2 Nov 2023 09:19:29 -0400 Message-Id: <20231102131933.2161191-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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>, <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>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781458497687991112 X-GMAIL-MSGID: 1781458497687991112 |
Series |
C/C++/diagnostics: various UX improvements
|
|
Message
David Malcolm
Nov. 2, 2023, 1:19 p.m. UTC
The following patch kit implements the: #pragma GCC show_layout (struct foo) idea I mentioned in my Cauldron talk (in patch 2), and the other patches implement various related user experience changes I came across when implementing it. Patch 1 reworks how c-pragma.cc parses pragmas, and experiments with adding links to documentation to the diagnostics messages (on a suitably capable terminal). Patch 2 implements the new "show_layout" pragma Patch 3 adds a new mechanism to the diagnostics subsytem for automatically adding documentation links to messages, with enough data to handle the pragmas from patch 1. Patch 4 attempts to automatically populate the URL data for our docs by parsing the results of "make html". Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. I'd like to go ahead with patch 1 and patch 3; patch 2 and patch 4 may need more work, but posting here for feedback. Thoughts? David Malcolm (4): c/c++: rework pragma parsing c: add #pragma GCC show_layout diagnostics: add automatic URL-ification within messages RFC: add contrib/regenerate-index-urls.py contrib/regenerate-index-urls.py | 245 ++ gcc/Makefile.in | 3 +- gcc/analyzer/record-layout.cc | 235 ++ gcc/analyzer/record-layout.h | 4 + gcc/c-family/c-pragma.cc | 641 ++++- gcc/c-family/c-pragma.h | 5 +- gcc/diagnostic.cc | 8 +- gcc/diagnostic.h | 4 + gcc/doc/extend.texi | 49 + gcc/gcc-urlifier.cc | 159 ++ gcc/gcc-urlifier.def | 2532 +++++++++++++++++ gcc/gcc-urlifier.h | 26 + gcc/gcc.cc | 2 + gcc/pretty-print-urlifier.h | 33 + gcc/pretty-print.cc | 242 +- gcc/pretty-print.h | 5 +- gcc/selftest-run-tests.cc | 1 + gcc/selftest.h | 1 + gcc/stor-layout.h | 3 + .../c-c++-common/pragma-message-parsing.c | 21 + .../c-c++-common/pragma-optimize-parsing.c | 16 + .../c-c++-common/pragma-pack-parsing-1.c | 19 + .../c-c++-common/pragma-pack-parsing-2.c | 4 + .../pragma-redefine_extname-parsing.c | 9 + .../c-c++-common/pragma-target-parsing.c | 14 + .../c-c++-common/pragma-visibility-parsing.c | 13 + .../c-c++-common/pragma-weak-parsing.c | 24 + gcc/testsuite/gcc.dg/bad-pragma-locations.c | 22 +- .../gcc.dg/parsing-pragma-show_layout.c | 15 + .../pragma-scalar_storate_order-parsing.c | 8 + gcc/testsuite/gcc.dg/pragma-show_layout-1.c | 12 + gcc/testsuite/gcc.dg/pragma-show_layout-2.c | 184 ++ ...agma-show_layout-infoleak-CVE-2017-18550.c | 175 ++ gcc/testsuite/gcc.dg/sso-6.c | 2 +- gcc/toplev.cc | 2 + 35 files changed, 4589 insertions(+), 149 deletions(-) create mode 100755 contrib/regenerate-index-urls.py create mode 100644 gcc/gcc-urlifier.cc create mode 100644 gcc/gcc-urlifier.def create mode 100644 gcc/gcc-urlifier.h create mode 100644 gcc/pretty-print-urlifier.h create mode 100644 gcc/testsuite/c-c++-common/pragma-message-parsing.c create mode 100644 gcc/testsuite/c-c++-common/pragma-optimize-parsing.c create mode 100644 gcc/testsuite/c-c++-common/pragma-pack-parsing-1.c create mode 100644 gcc/testsuite/c-c++-common/pragma-pack-parsing-2.c create mode 100644 gcc/testsuite/c-c++-common/pragma-redefine_extname-parsing.c create mode 100644 gcc/testsuite/c-c++-common/pragma-target-parsing.c create mode 100644 gcc/testsuite/c-c++-common/pragma-visibility-parsing.c create mode 100644 gcc/testsuite/c-c++-common/pragma-weak-parsing.c create mode 100644 gcc/testsuite/gcc.dg/parsing-pragma-show_layout.c create mode 100644 gcc/testsuite/gcc.dg/pragma-scalar_storate_order-parsing.c create mode 100644 gcc/testsuite/gcc.dg/pragma-show_layout-1.c create mode 100644 gcc/testsuite/gcc.dg/pragma-show_layout-2.c create mode 100644 gcc/testsuite/gcc.dg/pragma-show_layout-infoleak-CVE-2017-18550.c