From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 32E253858409 for ; Wed, 6 Sep 2023 14:12:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 32E253858409 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694009543; 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: in-reply-to:in-reply-to:references:references; bh=MrIcrqhPBsscjlYhHuoTi4yjsmqzs2/s4dIEZb9UzpQ=; b=KFWZZ91lryKTuBYf4OEN5zLmAnA2SDQvDeExIRC8orov+nl6P/Smja3mWzqsMmWOuPNohQ rnCw0y1RW/YeEdu57p5C0uA89yMyZsaJ8NlLrl3SWBLgl4uzRrx+xAdweyzmFXsvHynm9m buD6C0TvHE5kf2DJYtIxf6QnOQF+CYc= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-16xpFTDeMlmnFr3ysFOT8w-1; Wed, 06 Sep 2023 10:12:21 -0400 X-MC-Unique: 16xpFTDeMlmnFr3ysFOT8w-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-76f2bd12e39so337290285a.2 for ; Wed, 06 Sep 2023 07:12:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694009541; x=1694614341; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TVVdMreLkaQEm9kOa3nbQXy/mTIjLZPbIqo2O80PJ+o=; b=GuYYpok2WIGbLooicyB2OHH2wchCVYME8DH4fDhBca2p4uPG/+EDvGfl0suBv+GjNK VHeQk9DutqfjSuGa9oVx48pSuksc7ofSr2wE0cEKZOgC0Jpr3PuMTz9zt1mcE79XbjQy dFS4iNC9/E7oATmJp70DHnVrF0FlXE+DfAI2+WoqF93w8HJPToM8I1qWC02Rxm4LvZ8K WmBkU49enxQ+k89Jh3iF4/A9hip0UV1V+uEw9w6xrDP+De4LKq6yODorDkdWxU+tp+7o Zl/avZWBfVYtHiDVsUp8vOo8Iaj359EcUFUJsZBomWyYRq1fJTRLd/HOmJ+mi9c2EeB3 tarw== X-Gm-Message-State: AOJu0Yz5y8nddU6Qmi47RvnihmZnvqf+l2PNcDve+m2UccFux12zlZsq v9yPiLt60durgndo8w/U85mAZEQPAgzZG45CqZpwAIbnn7Zh/CdzQRX5vvDqp7ZJvpqmJsvSZ2Z n4JYRcGpgfGZqkj3l0PiNkQ== X-Received: by 2002:a05:620a:17a0:b0:767:96e2:7dc with SMTP id ay32-20020a05620a17a000b0076796e207dcmr18117286qkb.49.1694009540931; Wed, 06 Sep 2023 07:12:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZB7EUNvt+3NBgXtdFQdr9xiePKAzL6dWPZ/UMjUyAhAGLqEhtWLdn8tikfE2cU8OZ1XmKAQ== X-Received: by 2002:a05:620a:17a0:b0:767:96e2:7dc with SMTP id ay32-20020a05620a17a000b0076796e207dcmr18117265qkb.49.1694009540665; Wed, 06 Sep 2023 07:12:20 -0700 (PDT) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id c6-20020ae9e206000000b00767e98535b7sm4985701qkc.67.2023.09.06.07.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Sep 2023 07:12:20 -0700 (PDT) Message-ID: <7439d81e420de0081658509755a3aa3e55375d39.camel@redhat.com> Subject: Re: [PATCH 1/2] diagnostics: add error_meta From: David Malcolm To: Arthur Cohen , gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org Date: Wed, 06 Sep 2023 10:12:18 -0400 In-Reply-To: <20230906135303.3643659-2-arthur.cohen@embecosm.com> References: <20230906135303.3643659-1-arthur.cohen@embecosm.com> <20230906135303.3643659-2-arthur.cohen@embecosm.com> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 2023-09-06 at 15:53 +0200, Arthur Cohen wrote: > From: David Malcolm I guess I can review this patch :) Needs a ChangeLog entry, so here's one: gcc/ChangeLog =09* diagnostic-core.h (error_meta): New decl. =09* diagnostic.cc (error_meta): New. Also, needs a signed-off-by, so here's one: Signed-off-by: David Malcolm OK for trunk with those added. Thanks Dave >=20 > --- > =C2=A0gcc/diagnostic-core.h |=C2=A0 3 +++ > =C2=A0gcc/diagnostic.cc=C2=A0=C2=A0=C2=A0=C2=A0 | 15 +++++++++++++++ > =C2=A02 files changed, 18 insertions(+) >=20 > diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h > index 7334c79e8e6..c9e27fd2e6e 100644 > --- a/gcc/diagnostic-core.h > +++ b/gcc/diagnostic-core.h > @@ -92,6 +92,9 @@ extern void error_n (location_t, unsigned > HOST_WIDE_INT, const char *, > =C2=A0extern void error_at (location_t, const char *, ...) > ATTRIBUTE_GCC_DIAG(2,3); > =C2=A0extern void error_at (rich_location *, const char *, ...) > =C2=A0=C2=A0 ATTRIBUTE_GCC_DIAG(2,3); > +extern void error_meta (rich_location *, const diagnostic_metadata > &, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0const cha= r *, ...) > +=C2=A0 ATTRIBUTE_GCC_DIAG(3,4); > =C2=A0extern void fatal_error (location_t, const char *, ...) > ATTRIBUTE_GCC_DIAG(2,3) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ATTRIBUTE_NORETURN; > =C2=A0/* Pass one of the OPT_W* from options.h as the second parameter.= =C2=A0 > */ > diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc > index c523f215bae..65c0cfbf11a 100644 > --- a/gcc/diagnostic.cc > +++ b/gcc/diagnostic.cc > @@ -2108,6 +2108,21 @@ error_at (rich_location *richloc, const char > *gmsgid, ...) > =C2=A0=C2=A0 va_end (ap); > =C2=A0} > =C2=A0 > +/* Same as above, but with metadata.=C2=A0 */ > + > +void > +error_meta (rich_location *richloc, const diagnostic_metadata > &metadata, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const char = *gmsgid, ...) > +{ > +=C2=A0 gcc_assert (richloc); > + > +=C2=A0 auto_diagnostic_group d; > +=C2=A0 va_list ap; > +=C2=A0 va_start (ap, gmsgid); > +=C2=A0 diagnostic_impl (richloc, &metadata, -1, gmsgid, &ap, DK_ERROR); > +=C2=A0 va_end (ap); > +} > + > =C2=A0/* "Sorry, not implemented."=C2=A0 Use for a language feature which= is > =C2=A0=C2=A0=C2=A0 required by the relevant specification but not impleme= nted by > GCC. > =C2=A0=C2=A0=C2=A0 An object file will not be produced.=C2=A0 */