From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 165FB38582BC for ; Wed, 6 Sep 2023 13:49:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 165FB38582BC 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-wr1-x429.google.com with SMTP id ffacd0b85a97d-31dd10c2b8bso3085079f8f.3 for ; Wed, 06 Sep 2023 06:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694008179; x=1694612979; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iZ2/J9wWiX3+Y86nmNymSLSxOFNDt+XfMViaQzFKl+0=; b=NF2jwLFXaSFEz0vmxGtXyqPQNGQ0rpH9hnQGSGL4ty9nwAuqqdJGvpOECH1wVwsLCv 3eYwLchgf3SDHSy2OPgL/7oFJAhVhDdzAqin4evoupiBVb6EsGxnGTEaYSXVaAetfKzk 7LMSfpb8li/Pt3dqDb/7iWHkPFcT/JM+NWTL4A2zD6HNKZnCoWns2ZJLMFT7hOx1fnnD wYBh5bSoLhIyLkl5dic0ahV9wxkLmUSi1Wp09tiKGuk8LxFaSMp4fydXlVVPfgXEng2b 9yJvZptXylDMBXFg3cBlf9ogtI6EtICDeLw133GaBBn7tQ47N9wYuPMk/9rhn29mCguu /WfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694008179; x=1694612979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iZ2/J9wWiX3+Y86nmNymSLSxOFNDt+XfMViaQzFKl+0=; b=Aj3boGL9Y1j/+LdpcZ6WIxV0QiHD3iBg7lsz0CKCNsVyx8vTcYWQbhYLsQYi3zUkLc n/QyEKMRrPIc+reriR4sXp+w4QwctTHE8tRL1QhlEctrl37b35z16SbNJ4IMXE324knV Gv2gDh+dCXt0nJ6QZ6D+wCpMRfUCyElXo6KrSnwXZ3nfBi/GerNaAo0Lm0IeQlrg5RrG Xk5GTHhLFNjygZPRiVrclD/AWfOy0yXxf72UI9Dseonagook1K5wTkYAE0I95nQXAN7V R16MpVLKvygACJwCq+0C+GY3vEl2d+IQbt7QZbZOVoNmxomysYyH/lfx5J8zcyLtzwYw /+7A== X-Gm-Message-State: AOJu0YyxgFy2vRMV16c94UL6NW3atFr+Q8ukSC3lQwbdnVq/FDKePFnB 1TEjnQnbPtmhknDrbOljel3g X-Google-Smtp-Source: AGHT+IFeVoZVjy2HhLhxVQ62lV50Fi3qglNGEA/okiEcZlmxIhoohiwVkKjB7XEOmAKmhTGpGSHiGg== X-Received: by 2002:a5d:4d8f:0:b0:319:755c:3c1e with SMTP id b15-20020a5d4d8f000000b00319755c3c1emr2137457wru.11.1694008178812; Wed, 06 Sep 2023 06:49:38 -0700 (PDT) Received: from localhost.localdomain ([2001:861:5e4c:3bb0:fa3:84b9:61c0:bf1a]) by smtp.gmail.com with ESMTPSA id k8-20020a5d4288000000b003176aa612b1sm20528505wrq.38.2023.09.06.06.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Sep 2023 06:49:38 -0700 (PDT) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, dmalcolm@redhat.com Subject: [PATCH 1/2] diagnostics: add error_meta Date: Wed, 6 Sep 2023 15:53:02 +0200 Message-Id: <20230906135303.3643659-2-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230906135303.3643659-1-arthur.cohen@embecosm.com> References: <20230906135303.3643659-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: From: David Malcolm --- 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. */ -- 2.40.0