From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 05A273858401 for ; Wed, 6 Sep 2023 14:20:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05A273858401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4013454fa93so36563705e9.0 for ; Wed, 06 Sep 2023 07:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694010053; x=1694614853; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=W6qk+PaWMvYv5/Gf5AbRVIa5BaIEH1jHNE9KN1yNBCo=; b=aEZkG+ofBmfx+VxKC2CCi2yRFgvxCzwfSdiXLx9h4kLPX949IsC2G7OT9OR9TVESJf 1LKXgplgv9zx4js9JsEQK5ywXAKC4sUaBGY/jRIx6rdvtQIMJnr+HLOIbTBniTHIeNTf lYkwvn1wClAt5/znxrQEYaWuRH8zbQG0Qdd6EKahyerxAjP9dCOzuLmZXloNr17k/8Oy G8W3nGpczwRWSSmFmTwkLh294LNT9XMPCChgy9fu8HjLepBUV16rW4wi9GtcxzQn6viY wBQ4YMkavUYrwA+7Xd+cehLccfs3InbqsR6OgjfvB2j3HrN7bvKFSE5P3Hf1qKwC+Izi Ql1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694010053; x=1694614853; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W6qk+PaWMvYv5/Gf5AbRVIa5BaIEH1jHNE9KN1yNBCo=; b=jS0x+fF/U4j+jozlbol/jCwx51EUr3I/X+h5g2fWBYCbxJ4fhNqDpRHilw142CCkGR W4yCHqUUlD1PxQLQ9RnnP2msrGdlf7WVKmdp38hEnxTunY9/Q4pRIgRY4UYjFzSGhKYL H8pU3pa4r5uwKDWyWRQsZYcAL+z6aXreFJc87siJbr+QnpycM9ix9nrEPLRPi7I1ewTB lNry8CsJ3LL6J5N/cqT1utmSw69p/Yzh3bObhGzs7Stl+WiH7FAr0VP73mz5zqJTbisD KYxbDihfuyoaiJhMrfnK20IqRf/sMO2ef+9bKjClFgSDhODKEilYoQbnV1s/zksBam9V M99w== X-Gm-Message-State: AOJu0YxjJVdCyaPDVFV4yyDIsphWdasBpRh4XkYwFauFPA2lciyp8LGd YeMf6YwrQmu14b6//zDpX+pX X-Google-Smtp-Source: AGHT+IF1NsklgKvoelO0XFlVGkzAAYenX/o37tqu17ievnl9SUj/NNRgMCd0bughBWseqXzIf4Htfw== X-Received: by 2002:a05:600c:2945:b0:3fb:e189:3532 with SMTP id n5-20020a05600c294500b003fbe1893532mr2116020wmd.20.1694010053651; Wed, 06 Sep 2023 07:20:53 -0700 (PDT) Received: from ?IPV6:2001:861:3207:f590:5fde:237a:dae8:f343? ([2001:861:3207:f590:5fde:237a:dae8:f343]) by smtp.gmail.com with ESMTPSA id o10-20020a1c750a000000b003fbb25da65bsm20323125wmc.30.2023.09.06.07.20.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Sep 2023 07:20:53 -0700 (PDT) Message-ID: Date: Wed, 6 Sep 2023 16:24:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: [PATCH 1/2] diagnostics: add error_meta Content-Language: en-US To: David Malcolm , gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org References: <20230906135303.3643659-1-arthur.cohen@embecosm.com> <20230906135303.3643659-2-arthur.cohen@embecosm.com> <7439d81e420de0081658509755a3aa3e55375d39.camel@redhat.com> From: Arthur Cohen In-Reply-To: <7439d81e420de0081658509755a3aa3e55375d39.camel@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham 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 9/6/23 16:12, David Malcolm wrote: > 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 > * diagnostic-core.h (error_meta): New decl. > * diagnostic.cc (error_meta): New. > > Also, needs a signed-off-by, so here's one: > > Signed-off-by: David Malcolm > Right! Now that we enforce Changelogs and SoB lines in our CI, I completely forgot to add them back to older commits. I'll fix the second commit too. Thanks for the fast review! > > OK for trunk with those added. > > Thanks > Dave > > > >> >> --- >>  gcc/diagnostic-core.h |  3 +++ >>  gcc/diagnostic.cc     | 15 +++++++++++++++ >>  2 files changed, 18 insertions(+) >> >> 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 *, >>  extern void error_at (location_t, const char *, ...) >> ATTRIBUTE_GCC_DIAG(2,3); >>  extern void error_at (rich_location *, const char *, ...) >>    ATTRIBUTE_GCC_DIAG(2,3); >> +extern void error_meta (rich_location *, const diagnostic_metadata >> &, >> +                       const char *, ...) >> +  ATTRIBUTE_GCC_DIAG(3,4); >>  extern void fatal_error (location_t, const char *, ...) >> ATTRIBUTE_GCC_DIAG(2,3) >>       ATTRIBUTE_NORETURN; >>  /* Pass one of the OPT_W* from options.h as the second parameter. >> */ >> 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, ...) >>    va_end (ap); >>  } >> >> +/* Same as above, but with metadata.  */ >> + >> +void >> +error_meta (rich_location *richloc, const diagnostic_metadata >> &metadata, >> +           const char *gmsgid, ...) >> +{ >> +  gcc_assert (richloc); >> + >> +  auto_diagnostic_group d; >> +  va_list ap; >> +  va_start (ap, gmsgid); >> +  diagnostic_impl (richloc, &metadata, -1, gmsgid, &ap, DK_ERROR); >> +  va_end (ap); >> +} >> + >>  /* "Sorry, not implemented."  Use for a language feature which is >>     required by the relevant specification but not implemented by >> GCC. >>     An object file will not be produced.  */ >