public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Longjun Luo <luolongjuna@gmail.com>,
	Joseph Myers <joseph@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, sangyan@huawei.com
Subject: Re: [PATCH] libcpp: suppress builtin macro redefined warnings for __LINE__
Date: Sun, 30 Apr 2023 17:14:50 -0600	[thread overview]
Message-ID: <60cbe8fc-31b2-c8d7-4ea7-3a629cc5b6e0@gmail.com> (raw)
In-Reply-To: <db125213-a022-eddb-413d-3cb623361e71@gmail.com>



On 4/30/23 12:30, Jeff Law wrote:
> 
> 
> On 1/12/23 09:02, Longjun Luo via Gcc-patches wrote:
>>  From 0821df518b264e754d698d399f98be1a62945e32 Mon Sep 17 00:00:00 2001
>> From: Longjun Luo <luolongjuna@gmail.com>
>> Date: Thu, 12 Jan 2023 23:59:54 +0800
>> Subject: [PATCH] libcpp: suppress builtin macro redefined warnings for
>>   __LINE__
>>
>> As implied in
>> gcc.gnu.org/legacy-ml/gcc-patches/2008-09/msg00076.html,
>> gcc provides -Wno-builtin-macro-redefined to suppress warning when
>> redefining builtin macro. However, at that time, there was no
>> scenario for __LINE__ macro.
>>
>> But, when we try to build a live-patch, we compare sections by using
>> -ffunction-sections. Some same functions are considered changed because
>> of __LINE__ macro.
>>
>> At present, to detect such a changed caused by __LINE__ macro, we
>> have to analyse code and maintain a function list. For example,
>> in kpatch, check this commit
>> github.com/dynup/kpatch/commit/0e1b95edeafa36edb7bcf11da6d1c00f76d7e03d.
>>
>> So, in this scenario, when we try to compared sections, it would
>> be better to support suppress builtin macro redefined warnings for
>> __LINE__ macro.
>>
>> Signed-off-by: Longjun Luo <luolongjuna@gmail.com>
>> ---
>>   gcc/testsuite/gcc.dg/builtin-redefine-1.c | 49 +++++++++++++++++++++++
>>   gcc/testsuite/gcc.dg/builtin-redefine.c   | 24 +++++++++--
>>   libcpp/init.cc                            |  2 +-
>>   3 files changed, 70 insertions(+), 5 deletions(-)
>>   create mode 100755 gcc/testsuite/gcc.dg/builtin-redefine-1.c
> Thanks.  I added a suitable ChangeLog and pushed this to the trunk.
This is causing regressions on various targets for a few tests:

lm32-sim: c-c++-common/cpp/pr92296-2.c  -Wc++-compat   (test for 
warnings, line 41)
lm32-sim: gcc.dg/cpp/undef2.c  (test for warnings, line 9)
lm32-sim: gcc.dg/cpp/undef2.c (test for excess errors)

I have reverted this patch from the trunk.  Please address the 
regressions and resubmit.

Thanks,
Jeff


  reply	other threads:[~2023-04-30 23:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01  4:31 Longjun Luo
2022-12-01 17:01 ` Joseph Myers
2022-12-01 18:23   ` Longjun Luo
2022-12-01 19:07     ` Joseph Myers
2022-12-01 19:51       ` Longjun Luo
2022-12-01 21:10         ` Joseph Myers
2023-01-12 16:02           ` Longjun Luo
2023-04-30 18:30             ` Jeff Law
2023-04-30 23:14               ` Jeff Law [this message]
2023-04-30 23:19                 ` Andrew Pinski
2023-01-12 16:05           ` Longjun Luo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60cbe8fc-31b2-c8d7-4ea7-3a629cc5b6e0@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=luolongjuna@gmail.com \
    --cc=sangyan@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).