From e7ce7c4905fd254760b1cd187752a03bc0c148ba Mon Sep 17 00:00:00 2001 From: Longjun Luo Date: Sun, 30 Apr 2023 12:28:06 -0600 Subject: [PATCH] libcpp: suppress builtin macro redefined warnings for __LINE__ From 0821df518b264e754d698d399f98be1a62945e32 Mon Sep 17 00:00:00 2001 From: Longjun Luo 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. libcpp: * init.cc (builtin_array): Do not always warn for a redefinition of __LINE__. gcc/testsuite * gcc.dg/builtin-redefine.c: Test for redefintion warnings for __LINE__. * gcc.dg/builtin-redefine-1.c: New test. --- libcpp/init.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libcpp') diff --git a/libcpp/init.cc b/libcpp/init.cc index c508f06..bdeccff 100644 --- a/libcpp/init.cc +++ b/libcpp/init.cc @@ -421,7 +421,7 @@ static const struct builtin_macro builtin_array[] = B("__FILE__", BT_FILE, false), B("__FILE_NAME__", BT_FILE_NAME, false), B("__BASE_FILE__", BT_BASE_FILE, false), - B("__LINE__", BT_SPECLINE, true), + B("__LINE__", BT_SPECLINE, false), B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL, true), B("__COUNTER__", BT_COUNTER, true), /* Make sure to update the list of built-in -- cgit v1.1 From 33b6b7919763d939a153fe6f4aa3250c107605ee Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Sun, 30 Apr 2023 17:12:19 -0600 Subject: Revert "[PATCH] libcpp: suppress builtin macro redefined warnings for __LINE__" This reverts commit e7ce7c4905fd254760b1cd187752a03bc0c148ba. --- libcpp/init.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libcpp') diff --git a/libcpp/init.cc b/libcpp/init.cc index bdeccff..c508f06 100644 --- a/libcpp/init.cc +++ b/libcpp/init.cc @@ -421,7 +421,7 @@ static const struct builtin_macro builtin_array[] = B("__FILE__", BT_FILE, false), B("__FILE_NAME__", BT_FILE_NAME, false), B("__BASE_FILE__", BT_BASE_FILE, false), - B("__LINE__", BT_SPECLINE, false), + B("__LINE__", BT_SPECLINE, true), B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL, true), B("__COUNTER__", BT_COUNTER, true), /* Make sure to update the list of built-in -- cgit v1.1 From 4d68c7f7b5aea5e95f44c3af13a24aa3daae9cf5 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 1 May 2023 00:16:44 +0000 Subject: Daily bump. --- libcpp/ChangeLog | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libcpp') diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 8510dc2..847db36 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,16 @@ +2023-04-30 Jeff Law + + Revert: + 2023-04-30 Longjun Luo + + * init.cc (builtin_array): Do not always warn for a redefinition + of __LINE__. + +2023-04-30 Longjun Luo + + * init.cc (builtin_array): Do not always warn for a redefinition + of __LINE__. + 2023-03-25 David Malcolm PR analyzer/109098 -- cgit v1.1