Qing Zhao <qing.z...@oracle.com> writes:

>> On Oct 30, 2024, at 10:48, David Malcolm <dmalc...@redhat.com> wrote:
>> 
>> On Wed, 2024-10-30 at 14:34 +0000, Sam James wrote:
>>> Qing Zhao <qing.z...@oracle.com> writes:
>>> 
>>>> Control this with a new option -fdiagnostics-details.
>>>> 
>>>> [...]
>>> 
>>> The patch doesn't apply for me on very latest trunk -- I think
>>> David's
>>> recent diag refactoring means it needs a slight rebase. Could you
>>> send
>>> that?
>> 
>> If it's broken, it was probably by:
>> 
>> r15-4610 ("Use unique_ptr in more places in pretty_printer/diagnostics
>> [PR116613]")
>> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=bf43fe6aa966eaf397ea3b8ebd6408d3d124e285
>
> Yes, due to the following change in the above commit:
>
> diff --git a/gcc/toplev.cc b/gcc/toplev.cc
> index 
> 62034c32b4aff32cdf2cb051bf9d0803b4730b3f..a12a2e1afba15ba16f6ade624cde3e60907ba5d2
>  100644 (file)
> --- a/gcc/toplev.cc
> +++ b/gcc/toplev.cc
> @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "cgraph.h"
>  #include "coverage.h"
>  #include "diagnostic.h"
> +#include "pretty-print-urlifier.h"
>  #include "varasm.h"
>  #include "tree-inline.h"
>  #include "realmpfr.h"  /* For GMP/MPFR/MPC versions, in print_version.  */
>
>
> [...]
>> 

To continue testing, I am using the attached hacked up patches (David,
please don't hurt me, it was minimal "just get it building" x "do more
than needed to reduce iterations" ;)).

>From f0d521fb56035e71a2b7da3a6c524abab811b42b Mon Sep 17 00:00:00 2001
Message-ID: <f0d521fb56035e71a2b7da3a6c524abab811b42b.1730309582.git....@gentoo.org>
In-Reply-To: <cover.1730309582.git....@gentoo.org>
References: <cover.1730309582.git....@gentoo.org>
From: Sam James <s...@gentoo.org>
Date: Wed, 30 Oct 2024 16:15:55 +0000
Subject: [PATCH 1/2] gcc: add INCLUDE_MEMORY to diagnostic-move-history (and
 friends)

gcc/ChangeLog:

	* diagnostic-move-history.cc (INCLUDE_MEMORY): Define INCLUDE_MEMORY.
	* move-history-diagnostic-path.cc (INCLUDE_MEMORY): Ditto.
	* move-history-diagnostic-path.h (INCLUDE_MEMORY): Ditto.
---
 gcc/diagnostic-move-history.cc      | 1 +
 gcc/gimple-array-bounds.cc          | 1 +
 gcc/move-history-diagnostic-path.cc | 1 +
 gcc/move-history-diagnostic-path.h  | 1 +
 4 files changed, 4 insertions(+)

diff --git a/gcc/diagnostic-move-history.cc b/gcc/diagnostic-move-history.cc
index e4c471ab50f..49adeac1094 100644
--- a/gcc/diagnostic-move-history.cc
+++ b/gcc/diagnostic-move-history.cc
@@ -18,6 +18,7 @@
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc
index 464dafa6555..a0b04ed0bc5 100644
--- a/gcc/gimple-array-bounds.cc
+++ b/gcc/gimple-array-bounds.cc
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/move-history-diagnostic-path.cc b/gcc/move-history-diagnostic-path.cc
index ab29893d1f6..15034616be7 100644
--- a/gcc/move-history-diagnostic-path.cc
+++ b/gcc/move-history-diagnostic-path.cc
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
diff --git a/gcc/move-history-diagnostic-path.h b/gcc/move-history-diagnostic-path.h
index d04337ea377..dd27eeeecec 100644
--- a/gcc/move-history-diagnostic-path.h
+++ b/gcc/move-history-diagnostic-path.h
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_MOVE_HISTORY_DIAGNOSTIC_PATH_H
 #define GCC_MOVE_HISTORY_DIAGNOSTIC_PATH_H
 
+#define INCLUDE_MEMORY
 #include "diagnostic-path.h"
 #include "simple-diagnostic-path.h"
 #include "diagnostic-move-history.h"
-- 
2.47.0

>From 4933baa95dd6994443e299606e4dbfc0bad67be0 Mon Sep 17 00:00:00 2001
Message-ID: <4933baa95dd6994443e299606e4dbfc0bad67be0.1730309582.git....@gentoo.org>
In-Reply-To: <cover.1730309582.git....@gentoo.org>
References: <cover.1730309582.git....@gentoo.org>
From: Sam James <s...@gentoo.org>
Date: Wed, 30 Oct 2024 17:12:08 +0000
Subject: [PATCH 2/2] gcc: adapt to m_printer change

gcc/ChangeLog:

	* move-history-diagnostic-path.cc (build_rich_location_with_diagnostic_path): Use get_reference_printer.
---
 gcc/move-history-diagnostic-path.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/move-history-diagnostic-path.cc b/gcc/move-history-diagnostic-path.cc
index 15034616be7..12de0050bb0 100644
--- a/gcc/move-history-diagnostic-path.cc
+++ b/gcc/move-history-diagnostic-path.cc
@@ -97,7 +97,7 @@ build_rich_location_with_diagnostic_path (location_t location, gimple *stmt)
 
   move_history_t mv_history = stmt ? get_move_history (stmt) : NULL;
   move_history_diagnostic_path *path
-    = new move_history_diagnostic_path (global_dc->m_printer,
+    = new move_history_diagnostic_path (global_dc->get_reference_printer (),
 					mv_history, location);
   path->populate_path_from_move_history ();
 
-- 
2.47.0

When the rebase is ready, I'll switch to those. Thank you both!

Reply via email to