diff mbox series

Use unique_ptr in more places in pretty_printer/diagnostics: 'gcc/config/gcn/mkoffload.cc' [PR116613] (was: [RFC/PATCH] Use unique_ptr in more places in pretty_printer/diagnostics [PR116613])

Message ID 871q05z4wl.fsf@euler.schwinge.ddns.net
State New
Headers show
Series Use unique_ptr in more places in pretty_printer/diagnostics: 'gcc/config/gcn/mkoffload.cc' [PR116613] (was: [RFC/PATCH] Use unique_ptr in more places in pretty_printer/diagnostics [PR116613]) | expand

Commit Message

Thomas Schwinge Oct. 24, 2024, 7:18 p.m. UTC
Hi!

On 2024-10-14T19:18:46-0400, David Malcolm <dmalcolm@redhat.com> wrote:
> [...]
> Unfortunately we can't directly include <memory> in our internal headers
> but instead any of our TUs that make use of std::unique_ptr must #define
> INCLUDE_MEMORY before including system.h.
>
> Hence the bulk of this patch is taken up with adding a define of
> INCLUDE_MEMORY to hundreds of source files: everything that includes
> diagnostic.h or pretty-print.h (and thus anything transitively such as
> includers of lto-wrapper.h, c-tree.h, cp-tree.h and rtl-ssa.h).

> I've successfully built stage 1 on all configurations with this patch
> *without* Modula 2.

..., and without offloading configured -- which would bring a little bit
of extra code.  (Indeed offloading configurations aren't covered in
'contrib/config-list.mk', hmm...)

> Pushed to trunk as r15-4610-gbf43fe6aa966ea.

So you've got the nvptx 'mkoffload' adjusted:

> --- a/gcc/config/nvptx/mkoffload.cc
> +++ b/gcc/config/nvptx/mkoffload.cc
> @@ -29,6 +29,7 @@
>  
>  #define IN_TARGET_CODE 1
>  
> +#define INCLUDE_MEMORY
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"

..., but we likewise need to adjust the GCN one; I've pushed to
trunk branch commit b3aa301db1b09b533b3635791a98d6bf906e9a15
"Use unique_ptr in more places in pretty_printer/diagnostics: 'gcc/config/gcn/mkoffload.cc' [PR116613]",
see attached.


Grüße
 Thomas

Comments

David Malcolm Oct. 24, 2024, 7:42 p.m. UTC | #1
On Thu, 2024-10-24 at 21:18 +0200, Thomas Schwinge wrote:
> Hi!
> 
> On 2024-10-14T19:18:46-0400, David Malcolm <dmalcolm@redhat.com>
> wrote:
> > [...]

[...]

> ..., and without offloading configured -- which would bring a little
> bit
> of extra code.  (Indeed offloading configurations aren't covered in
> 'contrib/config-list.mk', hmm...)
> 
> > Pushed to trunk as r15-4610-gbf43fe6aa966ea.
> 
> So you've got the nvptx 'mkoffload' adjusted:
> 
> > --- a/gcc/config/nvptx/mkoffload.cc
> > +++ b/gcc/config/nvptx/mkoffload.cc
> > @@ -29,6 +29,7 @@
> >  
> >  #define IN_TARGET_CODE 1
> >  
> > +#define INCLUDE_MEMORY
> >  #include "config.h"
> >  #include "system.h"
> >  #include "coretypes.h"
> 
> ..., but we likewise need to adjust the GCN one; I've pushed to
> trunk branch commit b3aa301db1b09b533b3635791a98d6bf906e9a15
> "Use unique_ptr in more places in pretty_printer/diagnostics:
> 'gcc/config/gcn/mkoffload.cc' [PR116613]",
> see attached.

Sorry about the breakage; thanks for the patch.

Dave
diff mbox series

Patch

From b3aa301db1b09b533b3635791a98d6bf906e9a15 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwinge@baylibre.com>
Date: Thu, 24 Oct 2024 20:56:21 +0200
Subject: [PATCH] Use unique_ptr in more places in pretty_printer/diagnostics:
 'gcc/config/gcn/mkoffload.cc' [PR116613]

After recent commit bf43fe6aa966eaf397ea3b8ebd6408d3d124e285
"Use unique_ptr in more places in pretty_printer/diagnostics [PR116613]":

    [...]
    In file included from ../../source-gcc/gcc/config/gcn/mkoffload.cc:31:0:
    ../../source-gcc/gcc/diagnostic.h:29:3: error: #error "You must define INCLUDE_MEMORY before including system.h to use diagnostic.h"
     # error "You must define INCLUDE_MEMORY before including system.h to use diagnostic.h"
       ^
    In file included from ../../source-gcc/gcc/diagnostic.h:34:0,
                     from ../../source-gcc/gcc/config/gcn/mkoffload.cc:31:
    ../../source-gcc/gcc/pretty-print.h:29:3: error: #error "You must define INCLUDE_MEMORY before including system.h to use pretty-print.h"
     # error "You must define INCLUDE_MEMORY before including system.h to use pretty-print.h"
       ^
    In file included from ../../source-gcc/gcc/diagnostic.h:34:0,
                     from ../../source-gcc/gcc/config/gcn/mkoffload.cc:31:
    ../../source-gcc/gcc/pretty-print.h:280:16: error: 'unique_ptr' in namespace 'std' does not name a template type
       virtual std::unique_ptr<pretty_printer> clone () const;
                    ^
    In file included from ../../source-gcc/gcc/config/gcn/mkoffload.cc:31:0:
    ../../source-gcc/gcc/diagnostic.h:585:32: error: 'std::unique_ptr' has not been declared
       void set_output_format (std::unique_ptr<diagnostic_output_format> output_format);
                                    ^
    [...]

	PR other/116613
	gcc/
	* config/gcn/mkoffload.cc: Add '#define INCLUDE_MEMORY'.
---
 gcc/config/gcn/mkoffload.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc
index c1d80aae59c..17a33421134 100644
--- a/gcc/config/gcn/mkoffload.cc
+++ b/gcc/config/gcn/mkoffload.cc
@@ -24,6 +24,7 @@ 
    This is not a complete assembler.  We presume the source is well
    formed from the compiler and can die horribly if it is not.  */
 
+#define INCLUDE_MEMORY
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-- 
2.34.1