[v2] : gcc/doc/extend.texi: Update builtin example for __builtin_FILE, __builtin_LINE __builtin_FUNCTION
Message ID | 74e2f370-c3ec-4bdb-a9a5-fe037797a7d1@jguk.org |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1065686dyi; Wed, 10 Jan 2024 13:31:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzbOJIsh4EbHsQZs0511a7DCAsOpQKd1d4ATnfsheFqkmy5G+oJ24QReMGyEuHIKTAMlku X-Received: by 2002:a05:6808:171c:b0:3bb:fc6b:e57e with SMTP id bc28-20020a056808171c00b003bbfc6be57emr256331oib.100.1704922263391; Wed, 10 Jan 2024 13:31:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704922263; cv=pass; d=google.com; s=arc-20160816; b=0bnRPvBGepQjIrtxsCsbbGV52a0fh5UfeHyhPpPUUKD+XOgR50kc4Tzw2Tq3Dss+tt I2moktg0BdoUY7fTUQw8p88ADtivq7pLIApFwPs28L56DOCIgwVPsVbe+YFMC/70UC7K 5Ur71W4JazSdL3tmGoP4CXVZKffScznN2Q/P5A3sWulrFBu215SIgNXP/u3bfBBHi4Em SMZLhRSJw+7CTn7t66CEoTywIg/UI7gq6EzaM1fpA/oivskGJyiz+Jn5cvrK0SH2S4CF GNTvMMsYpBPcsg4g4Pnk2/A2o9RnCFyZ8Qqwe1HJ6l0BeVh6QfxL+JmbEhWdK3ab/oc0 R1UQ== 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 :content-language:to:subject:from:user-agent:mime-version:date :message-id:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=d+5X2TAGghi56DK6uzg/c39Lk3+jxzPRzYQZ99wIehc=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=CIjGxutDLJW48JFrljX5RyG1fdr7Czdt2cfB50hqWks2Vu+N3mRC4RFKVpvBRhuAgl aFnIgSDBJfTYIW7jxdWTcZLPKBrWcpzeplcsBU49dblyiWeZEQMdi4JtL9BoOIDIM46f BgrBDN6Lfp5jkkX0DV3QuPw9Fjg9DmuvyOfvfVwystaXuF7rUq/5+4PvemoTZ+Jg9opT qVSLkPEHZSY2jqljCQBI1QV9gjcvQ/pOek+4nA0TA1ia989hMhF/X4mNh3L0IWvq+HUX pht79jSRmrgQewzGrW1qSMLybKuHQSS/iM4aO3dEvqkSnk6nyhXqKfGYaP/mh4Mn/VDQ Sljg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@jguk.org header.s=google header.b=qP3g8Lwn; 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v7-20020a05620a0f0700b0078320a85898si5310455qkl.295.2024.01.10.13.31.03 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 13:31:03 -0800 (PST) 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=@jguk.org header.s=google header.b=qP3g8Lwn; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 939EC3877019 for <ouuuleilei@gmail.com>; Wed, 10 Jan 2024 21:30:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 B109B3883006 for <gcc-patches@gcc.gnu.org>; Wed, 10 Jan 2024 21:28:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B109B3883006 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jguk.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jguk.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B109B3883006 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704922093; cv=none; b=vpr0ouZrCgJRY9ePvEOkejejGfuoxf1oTnkT1JleeDvLzzXmEhyFHyBov9cCO9mKdQI5PabuCJZKtSI8Ukl71/ZoTelltxEYVhqZZzNNVMclt9xW7WpPpNfUM6DBg9+gLsVMcQMAznpA8aKcFWS4f7qjnCz4qPzATql+fWSh/gI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704922093; c=relaxed/simple; bh=sBRCeMMwQfW5tU1NpZFuMyMmL6ixMqJXluI5xoIUqaI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:Subject:To; b=YUoSR0i4HQ5IfXOK6fuZ8+2X9Ol8gzpIRG4yEdGwi5ef0/G1OaYKo7aDG0s0JZi6KJuG05b3sOccGjtoY+ANiqJbWKRWrpIqwneBNxRYiKMOkUIxgFnJY7uZzQ66dZjqV+7iG9qNdGPngghZ8urbDQ9jO7LCHmHVnML1BXmIMfQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-336746c7b6dso4049837f8f.0 for <gcc-patches@gcc.gnu.org>; Wed, 10 Jan 2024 13:28:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; t=1704922090; x=1705526890; darn=gcc.gnu.org; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=d+5X2TAGghi56DK6uzg/c39Lk3+jxzPRzYQZ99wIehc=; b=qP3g8LwnbJd/mTwKce35c510eclr0nJxRDdcuL9MGphOR9cEOWo++bFd2QnshT4rmy OerVO8mkSuDkMaouXHq0UH0yiV1R4ef0Wax3hoT8YNksGH1ibPof/1uLdyin9t2GWalr 8Uvx4Oyyxwwj0jZhCluFbvuV0YyOFy3er+44/Aj3oXKckNDW72wG0SIdBCWJsfdr8cIq 3ixZQ5W/LmNUudN4lwzAcW3op50j/sweADjGm5KtB7n9Lo8Z5Ip9w8/M+Um1z8A3uL+z 3i+ixWBV0h7mFrrmxTWBGkkc1Ln4ynM9Iw+JZiqHUpNFUp20LWg3Mr3hPekFuD4Ro8aN 0Ijw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704922090; x=1705526890; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=d+5X2TAGghi56DK6uzg/c39Lk3+jxzPRzYQZ99wIehc=; b=VXrTe55deDh/mcziiCu66R3A/Wyi0XamfmNVMvBb/wZIc/QPWlE0x5OY5ROEGu8JTL nKR2d1gokH3ByvkjGs0P++qhsYJLU+6ztnfWDWkq117vLGaqxXAjb4KYhhtXDKjSAUEc FtHSkbd/7Pz0WbflRx24/rIBAMr65NUNXs7YkeRYG0fHi2B6Uxh8WBVIc0zMNG6CLoW6 P+Zwn3oedh/mAldv7+PKgS4l0JN4ToDihHaeIc9V5RFLXIEucvjKHHShpt3s0wLmOa4a k0kxD+LXxaMJQ7n2IyO+3ndA6EE54khOf16dh4S8bglGP7JYnEatNydXH+EgzTcrq6Qu I9aw== X-Gm-Message-State: AOJu0Yy1yUa2SBOe4Bhi9hTobnKqPjxJwFbI4qAUSDvtyFJglBipFS2u HLtzfcVQhSv6Ut2CcMs//z/Ku5tfSeuXkgXB3nt8njDKMPg= X-Received: by 2002:a5d:590b:0:b0:337:7086:b6c7 with SMTP id v11-20020a5d590b000000b003377086b6c7mr56646wrd.19.1704922090423; Wed, 10 Jan 2024 13:28:10 -0800 (PST) Received: from [192.168.0.12] (cpc87345-slou4-2-0-cust172.17-4.cable.virginm.net. [81.101.252.173]) by smtp.gmail.com with ESMTPSA id b6-20020a5d6346000000b0033667867a66sm5717119wrw.101.2024.01.10.13.28.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jan 2024 13:28:10 -0800 (PST) Message-ID: <74e2f370-c3ec-4bdb-a9a5-fe037797a7d1@jguk.org> Date: Wed, 10 Jan 2024 21:28:09 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Jonny Grant <jg@jguk.org> Subject: [PATCH v2]: gcc/doc/extend.texi: Update builtin example for __builtin_FILE, __builtin_LINE __builtin_FUNCTION To: gcc-patches@gcc.gnu.org Content-Language: en-GB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.1 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, 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: 1787740567352760912 X-GMAIL-MSGID: 1787740567352760912 |
Series |
[v2] : gcc/doc/extend.texi: Update builtin example for __builtin_FILE, __builtin_LINE __builtin_FUNCTION
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Jonny Grant
Jan. 10, 2024, 9:28 p.m. UTC
2024-01-10 Jonathan Grant <jg@jguk.org> gcc/ChangeLog: * doc/extend.texi: Update builtin example for __builtin_FILE __builtin_LINE __builtin_FUNCTION. >From 66290eb477dd1a99310ad9972c45391c2a87c1c7 Mon Sep 17 00:00:00 2001 From: Jonathan Grant <jg@jguk.org> Date: Wed, 29 Nov 2023 11:02:06 +0000 Subject: [PATCH] gcc/doc: Update builtin example for __builtin_FILE __builtin_LINE __builtin_FUNCTION Signed-off-by: Jonathan Grant <jg@jguk.org> --- gcc/doc/extend.texi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
Comments
On 1/10/24 14:28, Jonny Grant wrote: > > 2024-01-10 Jonathan Grant <jg@jguk.org> > gcc/ChangeLog: > * doc/extend.texi: Update builtin example for __builtin_FILE > __builtin_LINE __builtin_FUNCTION. > > > >>From 66290eb477dd1a99310ad9972c45391c2a87c1c7 Mon Sep 17 00:00:00 2001 > From: Jonathan Grant <jg@jguk.org> > Date: Wed, 29 Nov 2023 11:02:06 +0000 > Subject: [PATCH] gcc/doc: Update builtin example for __builtin_FILE > __builtin_LINE __builtin_FUNCTION > > > Signed-off-by: Jonathan Grant <jg@jguk.org> > --- > gcc/doc/extend.texi | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi > index 1ae589aeb29..f17a4b215de 100644 > --- a/gcc/doc/extend.texi > +++ b/gcc/doc/extend.texi > @@ -14660,20 +14660,22 @@ to @var{F} or the empty string if the call was not made at function > scope. > > For example, in the following, each call to function @code{foo} will > -print a line similar to @code{"file.c:123: foo: message"} with the name > +print a line similar to @code{"file.c:5: foo: message"} with the name Please also s/will print/prints/ > of the file and the line number of the @code{printf} call, the name of > the function @code{foo}, followed by the word @code{message}. > > @smallexample > -const char* > -function (const char *func = __builtin_FUNCTION ()) > +#include <stdio.h> > + > +void foo (void) > @{ > - return func; > + printf ("%s:%i: %s: message\n", __builtin_FILE (), __builtin_LINE (), __builtin_FUNCTION ()); > + printf ("%s:%i: %s: message\n", __builtin_FILE (), __builtin_LINE (), __builtin_FUNCTION ()); Is this duplicated code a mistake? As you have it, each call to foo prints *two* lines, not "a line". Maybe you mean to have more than one call to foo instead of more than one line printed per call? If it's intentional, please correct the above descriptive text. Also, I'm pretty sure this line of code is too long to format nicely in the PDF manual (it's well over 80 characters). I'd put a line break after the call to __builtin_FILE (). -Sandra
On 14/01/2024 05:34, Sandra Loosemore wrote: > On 1/10/24 14:28, Jonny Grant wrote: >> >> 2024-01-10 Jonathan Grant <jg@jguk.org> >> gcc/ChangeLog: >> * doc/extend.texi: Update builtin example for __builtin_FILE >> __builtin_LINE __builtin_FUNCTION. >> >> >> >>>From 66290eb477dd1a99310ad9972c45391c2a87c1c7 Mon Sep 17 00:00:00 2001 >> From: Jonathan Grant <jg@jguk.org> >> Date: Wed, 29 Nov 2023 11:02:06 +0000 >> Subject: [PATCH] gcc/doc: Update builtin example for __builtin_FILE >> __builtin_LINE __builtin_FUNCTION >> >> >> Signed-off-by: Jonathan Grant <jg@jguk.org> >> --- >> gcc/doc/extend.texi | 14 ++++++++------ >> 1 file changed, 8 insertions(+), 6 deletions(-) >> >> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi >> index 1ae589aeb29..f17a4b215de 100644 >> --- a/gcc/doc/extend.texi >> +++ b/gcc/doc/extend.texi >> @@ -14660,20 +14660,22 @@ to @var{F} or the empty string if the call was not made at function >> scope. >> >> For example, in the following, each call to function @code{foo} will >> -print a line similar to @code{"file.c:123: foo: message"} with the name >> +print a line similar to @code{"file.c:5: foo: message"} with the name > > Please also s/will print/prints/ > >> of the file and the line number of the @code{printf} call, the name of >> the function @code{foo}, followed by the word @code{message}. >> >> @smallexample >> -const char* >> -function (const char *func = __builtin_FUNCTION ()) >> +#include <stdio.h> >> + >> +void foo (void) >> @{ >> - return func; >> + printf ("%s:%i: %s: message\n", __builtin_FILE (), __builtin_LINE (), __builtin_FUNCTION ()); >> + printf ("%s:%i: %s: message\n", __builtin_FILE (), __builtin_LINE (), ); > > Is this duplicated code a mistake? As you have it, each call to foo prints *two* lines, not "a line". Maybe you mean to have more than one call to foo instead of more than one line printed per call? If it's intentional, please correct the above descriptive text. Thank you for the review comments Sandra. The duplicate lines were my mistake. > Also, I'm pretty sure this line of code is too long to format nicely in the PDF manual (it's well over 80 characters). I'd put a line break after the call to __builtin_FILE (). yes, that's good. If the __builtin_LINE () is on the next line, unfortunately line number won't be the same as the printf line. But I did move the __builtin_FUNCTION () so it's under 80, is that okay? Will a v3 version of the patch with a few other changes. Let me know what you think. Thanks, Jonny
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 1ae589aeb29..f17a4b215de 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -14660,20 +14660,22 @@ to @var{F} or the empty string if the call was not made at function scope. For example, in the following, each call to function @code{foo} will -print a line similar to @code{"file.c:123: foo: message"} with the name +print a line similar to @code{"file.c:5: foo: message"} with the name of the file and the line number of the @code{printf} call, the name of the function @code{foo}, followed by the word @code{message}. @smallexample -const char* -function (const char *func = __builtin_FUNCTION ()) +#include <stdio.h> + +void foo (void) @{ - return func; + printf ("%s:%i: %s: message\n", __builtin_FILE (), __builtin_LINE (), __builtin_FUNCTION ()); + printf ("%s:%i: %s: message\n", __builtin_FILE (), __builtin_LINE (), __builtin_FUNCTION ()); @} -void foo (void) +int main (void) @{ - printf ("%s:%i: %s: message\n", file (), line (), function ()); + foo(); @} @end smallexample